Player12
An open source football management simulator
Loading...
Searching...
No Matches
match_engine.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <array>
12#include <cstdint>
13#include <limits>
14#include <optional>
15#include <random>
16#include <span>
17#include <string>
18#include <string_view>
19#include <vector>
20
21#include "global/stats_config.h"
22#include "global/types.h"
23#include "model/lineup.h"
24#include "model/match_context.h"
25#include "model/match_events.h"
26#include "model/match_rules.h"
29#include "model/match_tuning.h"
30#include "model/strategy.h"
31#include "model/tactics.h"
32
33enum class MatchState
34{
36 PLAYING,
41 PENALTY,
42 GOAL,
48};
49
61
80
93
105
108{
109 NONE,
110 SHOT,
111 PASS,
112 CARRY,
113 SHIELD,
114 CLEAR
115};
116
119{
121 SWEEP,
122 RUSH,
123 CLAIM,
124 DIVE,
125 HOLD,
127 RECOVER
128};
129
130std::string_view goalkeeperStateName(GoalkeeperState state);
131
133{
135 std::optional<PassDecision> best;
136 std::optional<PassDecision> runnerUp;
137 std::string reason;
138 float passUtility = -std::numeric_limits<float>::infinity();
139 float shotUtility = -std::numeric_limits<float>::infinity();
140 float carryUtility = -std::numeric_limits<float>::infinity();
141 float shieldUtility = -std::numeric_limits<float>::infinity();
142};
143
151{
152 const Player* player = nullptr;
153 bool isHomeTeam = false;
155 Vector2F velocity{0.0f, 0.0f};
164 bool urgentMovement = false;
165
166 float facingAngle = 0.0f;
167 float targetAngle = 0.0f;
169
170 bool isTrapping = false;
171 float trapTimer = 0.0f;
172 bool isDiving = false;
173 float diveTimer = 0.0f;
174 bool isPressing = false;
175 bool isMakingRun = false;
176
178 float stamina = 1.0f;
180 float sprintReserve = 1.0f;
185 bool isSprinting = false;
186 float tackleCooldown = 0.0f;
187 float actionCooldown = 0.0f;
188
200
202 bool onPitch = true;
204 bool isGoalkeeper = false;
205 bool isInjured = false;
208 std::int8_t formationSlot = -1;
209 int yellowCards = 0;
211 std::size_t statsIndex = 0;
212};
213
220{
222 float z = 0.0f;
223 Vector2F velocity{0.0f, 0.0f};
224 float velocityZ = 0.0f;
225 float curve = 0.0f;
226
227 const Player* possessedBy = nullptr;
228 const Player* lastPossessor = nullptr;
229 const Player* intendedReceiver = nullptr;
231 const Player* kicker = nullptr;
233 float kickerLockout = 0.0f;
235 std::uint32_t touchAttempts = 0;
238 float dribbleExposure = 0.0f;
239 float dribbleTouchLength = 0.0f;
241 float touchTimer = 0.0f;
242
243 bool isPass = false;
244 bool passByHome = false;
245 bool passWasOffside = false;
246 bool isShot = false;
247 bool shotByHome = false;
249 bool shotOnTarget = false;
250 float shotXG = 0.0f;
254 float shotElapsedSeconds = 0.0f;
255 bool shotIsHeader = false;
256 bool shotIsPenalty = false;
257 bool shotFromSetPiece = false;
258 bool shotSaveResolved = false;
260 bool isAerialDelivery = false;
262 bool fromThrowIn = false;
263};
264
266{
267 int homeShots = 0;
268 int awayShots = 0;
271 int homeCorners = 0;
272 int awayCorners = 0;
273 int homeFouls = 0;
274 int awayFouls = 0;
275 int homeSaves = 0;
276 int awaySaves = 0;
285 int homeCrosses = 0;
286 int awayCrosses = 0;
291 int homeTackles = 0;
292 int awayTackles = 0;
325 float homeShotXG = 0.0f;
326 float awayShotXG = 0.0f;
328 float ballInPlayMinutes = 0.0f;
329};
330
332enum class MatchShout : std::uint8_t
333{
337 CALM_DOWN,
338 ENCOURAGE,
341 STAND_OFF,
345};
346
348enum class MatchCommandType : std::uint8_t
349{
350 STRATEGY,
351 SHOUT,
352 FORMATION,
357};
358
365{
367 std::uint64_t step = 0;
369 bool homeTeam = true;
373 std::vector<Vector2F> formation;
379 std::optional<std::size_t> slot;
381 int talkHalf = 1;
382 float talkModifier = 0.0f;
383};
384
386enum class MatchInputAction : std::uint8_t
387{
388 NONE,
389 PASS,
391 SHOOT,
392 CLEAR,
393 TACKLE,
397};
398
410{
412 float moveX = 0.0f;
413 float moveY = 0.0f;
415 bool sprint = false;
425 float aimX = 0.0f;
426 float aimY = 0.0f;
432 float power = 0.0f;
437 bool jockey = false;
443 std::uint8_t passAssist = 1;
444};
445
457
459enum class MatchFidelity : std::uint8_t
460{
462 FULL,
471};
472
475{
480};
481
488{
490 double startSeconds = 0.0;
491 double triggerSeconds = 0.0;
492 double endSeconds = 0.0;
494 float triggerMinute = 0.0f;
495};
496
517{
518 public:
519 MatchEngine(const Lineup& home_lineup, const Lineup& away_lineup,
520 const Strategy& home_strat, const Strategy& away_strat,
521 const StatsConfig& config);
522 MatchEngine(const Lineup& home_lineup, const Lineup& away_lineup,
523 const Strategy& home_strat, const Strategy& away_strat,
524 const StatsConfig& config, uint32_t seed);
525
533 void update(float deltaTime);
539 float advance(float seconds);
542 void simulateToEnd();
548 void simulateToEnd(MatchFidelity fidelity);
550 double getSimulatedSeconds() const;
551
556 void setPlaybackSpeed(float simulatedSecondsPerWallSecond);
557 float getPlaybackSpeed() const { return playbackSpeed; }
559 void setHighlightPlaybackSpeed(float simulatedSecondsPerWallSecond);
569 bool advancePlayback(float wallSeconds);
571 bool isInHighlight() const;
573 const std::optional<MatchHighlight>& getScheduledHighlight() const
574 {
575 return scheduledHighlight;
576 }
582 std::optional<MatchHighlight> predictNextHighlight(
583 float horizonSeconds =
586 const std::vector<MatchHighlight>& getHighlights() const
587 {
588 return highlights;
589 }
595 void setTacticalFamiliarity(bool homeTeam, float familiarity);
598 float getTacticalFamiliarity(bool homeTeam) const
599 {
600 return effectiveFamiliarity(homeTeam ? 0 : 1);
601 }
606 void setStrategy(bool homeTeam, const Strategy& strategy);
614 void applyShout(bool homeTeam, MatchShout shout);
616 float getShoutStrength(bool homeTeam) const;
618 std::optional<MatchShout> getActiveShout(bool homeTeam) const;
624 std::vector<Vector2F> getFormation(bool homeTeam) const;
631 bool setFormation(bool homeTeam, std::span<const Vector2F> shape);
633 std::optional<std::size_t> getFormationSlot(PlayerID playerId) const;
638 bool movePlayerToSlot(PlayerID playerId, std::size_t slot);
640 StrategySliders getEffectiveSliders(bool homeTeam) const;
647 void setTeamTalkModifier(bool homeTeam, int half, float modifier);
648 float getTeamTalkModifier(bool homeTeam, int half) const;
656 float getTeamTalkEffect(bool homeTeam) const;
661 TacticalRole getSlotRole(bool homeTeam, std::size_t slot) const;
662
674 bool setControlledPlayer(PlayerID playerId);
676 void setPlayHalfMinutes(int minutes);
677 [[nodiscard]] int getPlayHalfMinutes() const { return playHalfMinutes; }
685 void submitInput(const MatchPlayerInput& input);
690 const std::vector<MatchInputRecord>& getInputLog() const { return inputLog; }
692 void loadInputReplay(std::vector<MatchInputRecord> log);
702 PlayerID suggestActivePlayer(bool homeTeam, PlayerID current) const;
708 PlayerID nextSwitchCandidate(bool homeTeam, PlayerID current,
709 PlayerID skip = 0) const;
714 bool stepsWithin(float deltaSeconds) const;
717 bool wasControlled(bool homeTeam) const
718 {
719 return everControlled[homeTeam ? 0 : 1];
720 }
721 int getControlledActions(bool homeTeam) const
722 {
723 return controlledActions[homeTeam ? 0 : 1];
724 }
732 const std::vector<MatchCommandRecord>& getCommandLog() const
733 {
734 return commandLog;
735 }
738 void loadCommandReplay(std::vector<MatchCommandRecord> log);
740 std::uint64_t getSimulatedSteps() const { return stepCounter; }
741
742 const std::vector<MatchPlayer>& getPlayers() const { return players; }
743 const MatchBall& getBall() const { return ball; }
744 const std::vector<MatchEvent>& getEvents() const { return events; }
749 void setTeamNames(std::string homeTeam, std::string awayTeam);
750 MatchState getState() const { return state; }
751 const MatchStats& getStats() const { return stats; }
752 TeamPhase getHomePhase() const { return homePhase; }
753 TeamPhase getAwayPhase() const { return awayPhase; }
755 {
757 }
759
767 bool substitutePlayer(uint32_t outPlayerId, const Player* inPlayer,
768 std::optional<std::size_t> slot = std::nullopt);
770 bool canSubstitute(bool homeTeam) const;
771 int getSubstitutionsUsed(bool homeTeam) const;
772 int getSubstitutionWindowsUsed(bool homeTeam) const;
778 void setAutoSubstitutions(bool home, bool away);
789 void setMedicalFlags(PlayerID playerId, std::uint8_t flags);
790 const std::vector<MatchSubstitution>& getSubstitutions() const
791 {
792 return substitutions;
793 }
794
796 const std::vector<PlayerMatchStats>& getPlayerStats() const
797 {
798 return playerStats;
799 }
800 const PlayerMatchStats* findPlayerStats(PlayerID playerId) const;
806 const MatchTracker& getTracker() const { return tracker; }
807 void setTracking(bool on) { tracker.setEnabled(on); }
812 std::optional<float> getPlayerCondition(PlayerID playerId) const;
818 bool setPlayerCondition(PlayerID playerId, float condition);
819
821 int getPeriod() const { return period; }
823 int getAddedMinutes(int half) const
824 {
825 return half >= 1 && half <= static_cast<int>(addedMinutes.size())
826 ? addedMinutes[static_cast<std::size_t>(half - 1)]
827 : 0;
828 }
834 void setKnockout(const MatchRules::Knockout& rules);
835 const MatchRules::Knockout& getKnockout() const { return knockout; }
840 void setMatchContext(const MatchContext& context);
841 const MatchContext& getMatchContext() const { return matchContext; }
843 bool wentToExtraTime() const { return extraTimeReached; }
845 bool hasShootout() const { return shootout.started; }
847 int getShootoutScore(bool homeTeam) const
848 {
849 return shootout.goals[homeTeam ? 0 : 1];
850 }
852 int getShootoutKicks(bool homeTeam) const
853 {
854 return shootout.kicks[homeTeam ? 0 : 1];
855 }
861 std::optional<bool> getTieWinnerHome() const;
862 bool isInAddedTime() const;
864 bool isAbandoned() const { return abandoned; }
866 float getRefereeStrictness() const { return refereeStrictness; }
867
868 int getHomeScore() const { return homeScore; }
869 int getAwayScore() const { return awayScore; }
870 float getMatchTimeMinutes() const { return matchTimeMinutes; }
874 std::uint64_t getDroppedSimulationSteps() const
875 {
877 }
878
880 bool getGoalScoredByHome() const { return goalScoredByHome; }
881
889
894 float getInterpolationAlpha() const;
895 const std::vector<Vector2F>& getPreviousPlayerPositions() const
896 {
898 }
899 const std::vector<float>& getPreviousPlayerFacingAngles() const
900 {
902 }
904 float getPreviousBallZ() const { return previousBallZ; }
905
907 std::string getDebugSnapshotJson() const;
908 bool writeDebugSnapshot(std::string_view path) const;
909
911 GoalkeeperState getHomeGoalkeeperState() const { return keepers[0].state; }
912 GoalkeeperState getAwayGoalkeeperState() const { return keepers[1].state; }
913
923 bool applyScenario(const MatchScenario& scenario,
924 MatchState scenarioState = MatchState::PLAYING,
925 float scenarioMatchTime = 0.0f, int scenarioHomeScore = 0,
926 int scenarioAwayScore = 0);
928 {
930 }
931
932 private:
934 {
936 FAR_POST,
938 };
939
940 std::vector<MatchPlayer> players;
945 std::mt19937 rng;
946 // Referee decisions and injuries draw from their own stream so tuning them
947 // does not reshuffle player decisions and ball physics.
948 std::mt19937 incidentRng;
949 std::uint32_t matchSeed = 0;
951 std::uint64_t stepCounter = 0;
953 std::uint32_t stepTicks = 1;
954 float refereeStrictness = 1.0f;
956 float refereeDraw = 0.0f;
959 float finishingPrecision = 1.0f;
962 float levelShift = 0.0f;
963 float levelPrecision = 1.0f;
964
965 std::vector<PlayerMatchStats> playerStats;
966 std::vector<MatchSubstitution> substitutions;
967 std::vector<const Player*> homeBench;
968 std::vector<const Player*> awayBench;
970 std::vector<const Player*> squad;
972 std::array<SetPieceDesignations, 2> designations{};
977 std::uint32_t stoppageSequence = 0;
978 std::uint64_t lastStoppageStep = 0;
980 std::numeric_limits<std::uint64_t>::max();
981 std::uint32_t homeLastWindowStoppage = 0;
982 std::uint32_t awayLastWindowStoppage = 0;
983 std::uint32_t homeLastAiReviewStoppage = 0;
984 std::uint32_t awayLastAiReviewStoppage = 0;
985
986 int period = 1;
987 bool abandoned = false;
988 std::array<int, 4> addedMinutes{0, 0, 0, 0};
989 std::array<MatchRules::StoppageLog, 4> stoppageLogs{};
991 bool extraTimeReached = false;
993 struct Shootout
994 {
995 bool started = false;
996 bool homeFirst = true;
997 bool inFlight = false;
998 bool kickerHome = true;
1000 float timer = 0.0f;
1001 std::array<int, 2> kicks{0, 0};
1002 std::array<int, 2> goals{0, 0};
1004 std::array<std::vector<PlayerID>, 2> order;
1005 };
1008 float injuryCheckTimer = 0.0f;
1009
1018
1020 const Player* lastCompletedPasser = nullptr;
1022 const Player* shotAssistCandidate = nullptr;
1023 const Player* lastShooter = nullptr;
1024 bool restartIsSetPiece = false;
1029 bool setPieceHome = true;
1030
1031 std::vector<Vector2F> previousPlayerPositions;
1032 std::vector<float> previousPlayerFacingAngles;
1035 float previousBallZ = 0.0f;
1036
1037 std::vector<MatchEvent> events;
1039 std::size_t undescribedEvents = 0;
1040 std::array<std::string, 2> teamNames;
1054 std::array<GoalkeeperControl, 2> keepers{};
1058 std::optional<bool> lastControlledTeamHome;
1061 std::optional<std::size_t> restartTakerIndex;
1062 float setPieceTimer = 0.0f;
1063 bool goalScoredByHome = false;
1065 float accumulator = 0.0f;
1072 float substepBallZ = 0.0f;
1073 float homeFamiliarity = 1.0f;
1074 float awayFamiliarity = 1.0f;
1076 {
1078 float remainingSeconds = 0.0f;
1080 float impact = 1.0f;
1082 float repeats = 0.0f;
1083 };
1085 std::array<ShoutState, 2> shouts{};
1087 std::array<StrategySliders, 2> effectiveSliders{};
1089 bool slidersStale = false;
1091 std::array<float, 2> underdogShares{};
1093 std::array<std::array<float, 2>, 2> teamTalks{};
1102 std::array<std::array<SlotTactic, 16>, 2> slotTactics{};
1103 std::array<RoleProfile, 2> keeperProfiles{};
1106 std::array<std::vector<Vector2F>, 2> slotAnchors{};
1108 std::array<std::vector<PlayerInstruction>, 2> oppositionOrders{};
1110 std::array<float, 4> targetBlends{};
1111 std::array<std::uint8_t, 32> separationOrder{};
1112 std::size_t separationCount = 0;
1115 std::array<Vector2F, 32> separationPositions{};
1116 bool separationClear = false;
1118 const Player* tacticalOwner = nullptr;
1119 std::uint8_t tacticalFlags = 0;
1121 float loadSeconds = 0.0f;
1122 std::vector<Vector2F> loadAnchors;
1124 std::array<std::int8_t, 32> markAssignments{};
1126 std::vector<std::pair<PlayerID, std::uint8_t>> medicalFlags;
1128 std::vector<std::pair<PlayerID, float>> benchConditions;
1129
1131 std::optional<std::size_t> controlledIndex;
1135 std::array<bool, 2> everControlled{};
1136 std::array<int, 2> controlledActions{};
1139 [[nodiscard]] float matchClockRate() const
1140 {
1142 static_cast<float>(playHalfMinutes)
1143 : 1.0F;
1144 }
1150 {
1151 bool active = false;
1153 std::optional<float> aimMetres;
1154 float power = 0.0f;
1155 };
1157 std::vector<MatchInputRecord> inputLog;
1158 std::size_t inputCursor = 0;
1159 std::vector<MatchCommandRecord> commandLog;
1160 std::size_t commandCursor = 0;
1162 std::array<std::vector<Vector2F>, 2> formations{};
1164 std::array<float, 2> reshapeFamiliarityCost{};
1165 std::array<float, 2> reshapeSecondsRemaining{};
1166
1167 std::vector<MatchHighlight> highlights;
1168 std::uint64_t highlightTriggerCount = 0;
1171 float lastTriggerMinute = 0.0f;
1175 std::optional<MatchHighlight> scheduledHighlight;
1177 std::uint32_t inputRevision = 0;
1178 std::uint32_t scheduledRevision = 0;
1181 float matchTimeMinutes = 0.0f;
1182 int homeScore = 0;
1183 int awayScore = 0;
1185 std::uint64_t droppedSimulationSteps = 0;
1186
1200 void initializePlayers(const Lineup& lineup, bool isHomeTeam);
1201 void loadAttributes(MatchPlayer& matchPlayer, const Player* player) const;
1202 std::size_t addPlayerStats(const MatchPlayer& matchPlayer, bool started);
1203 PlayerMatchStats& statsOf(const MatchPlayer& matchPlayer);
1204 void refreshRatings();
1206 void advanceClock(float dt);
1207 void accumulatePlayerLoad(float dt);
1208 void updateMatchClock();
1209 void announceAddedTime();
1210 void endPeriod();
1212 void beginBreak(float seconds, float recovery);
1214 bool tieLevel() const;
1215 void finishMatch();
1216 void startShootout();
1217 void updateShootout(float dt);
1218 void beginShootoutKick();
1221 int maxSubstitutions() const;
1222 void checkInjuries();
1223 void injurePlayer(MatchPlayer& player, bool fromContact);
1224 void removeFromPitch(MatchPlayer& player);
1225 void rebalanceShape(bool homeTeam, Vector2F vacatedBase,
1226 std::int8_t vacatedSlot);
1227 void ensureGoalkeeper(bool homeTeam);
1228 void beginStoppage();
1230 void extendRestart(float seconds);
1231 void runAiSubstitutions();
1232 void runAiSubstitutionsFor(bool homeTeam);
1234 void runMedicalSubstitutions(bool homeTeam);
1235 bool performSubstitution(MatchPlayer& outgoing, const Player* inPlayer,
1236 SubstitutionReason reason);
1237 const Player* chooseReplacement(bool homeTeam, PlayerRole role,
1238 bool wantGoalkeeper) const;
1239 void commitFoul(MatchPlayer& offender, MatchPlayer& victim, bool ballWon,
1240 bool reckless);
1241 void applySanction(MatchPlayer& offender, MatchRules::FoulSanction sanction);
1242 bool deniesGoalChance(const MatchPlayer& victim,
1243 const MatchPlayer& offender) const;
1244 void updatePendingAdvantage(float dt);
1246 float currentTopSpeed(const MatchPlayer& player) const;
1252 void integrateMovements(std::span<const std::uint8_t> slots, float dt,
1253 bool walking);
1254 void updateRestartMovement(float dt);
1255 bool userRestartPassRequested() const;
1256 void updateRestartSupport(MatchPlayer& player,
1257 const MatchPlayer* taker) const;
1258 void separatePlayers();
1259 Vector2F goalkeeperTarget(MatchPlayer& keeper, const MatchPlayer* carrier);
1260 void diveGoalkeeper(MatchPlayer& keeper, float dt);
1261 void planGoalkeeperDive(bool defendingHome, bool penalty);
1262 void resolveShotAtGoalkeeper(MatchPlayer& goalkeeper);
1263 bool resolveAerialContest();
1264 void headBall(MatchPlayer& header);
1267 bool tryOwnGoalTouch(MatchPlayer& defender);
1268 void clearBehind(MatchPlayer& defender);
1269 void clearBall(MatchPlayer& defender);
1270 void parryShot(MatchPlayer& goalkeeper, bool overTheBar);
1276 void launchBall(const MatchPlayer& kicker, Vector2F origin, Vector2F target,
1277 float horizontalSpeed, float verticalSpeed, float curve);
1279 static float groundLaunchSpeed(float distanceMetres, float arrivalSpeed);
1282 static float loftVerticalSpeed(float distanceMetres, float horizontalSpeed,
1283 float startHeight, float arrivalHeight);
1284 void takeSetPiece(MatchPlayer& taker, MatchState restartState);
1285 void takeCorner(MatchPlayer& taker);
1286 void takeDirectFreeKick(MatchPlayer& taker);
1287 void arrangeSetPiece(bool attackingHome, Vector2F ballPosition);
1288 MatchPlayer* bestSetPieceTaker(bool homeTeam, bool shooting);
1294 MatchPlayer* dutyTaker(bool homeTeam, SetPieceDuty duty);
1295 void placeTaker(MatchPlayer& taker, Vector2F spot);
1297 void setRestartTaker(MatchPlayer* taker);
1298 std::size_t slotOf(const MatchPlayer& player) const;
1299 float familiarityOf(const MatchPlayer& player) const;
1301 float talkOf(bool homeTeam) const;
1302 // Roles, opposition instructions and team talks (see model/tactics.h).
1304 void resolveTactics(bool homeTeam);
1305 const RoleProfile& roleProfileOf(const MatchPlayer& player) const;
1307 Vector2F possessionAnchor(const MatchPlayer& player) const;
1309 float defensiveRoleShift(const MatchPlayer& player) const;
1312 const MatchPlayer* tightMarkTarget(const MatchPlayer& marker) const;
1314 Vector2F tightMarkPoint(const MatchPlayer& marker, const MatchPlayer& target,
1315 Vector2F current) const;
1317 float tightMarkPenalty(const MatchPlayer& receiver) const;
1319 float passingRoleBias(const MatchPlayer& passer, const MatchPlayer& receiver,
1320 float progression, float completion) const;
1322 float pressEagerness(const MatchPlayer& candidate,
1323 const MatchPlayer* carrier) const;
1325 float engageBoost(const MatchPlayer& defender,
1326 const MatchPlayer& carrier) const;
1328 float pressStandOffShare(const MatchPlayer& presser,
1329 const MatchPlayer& carrier) const;
1332 float weakFootShade(const MatchPlayer& carrier) const;
1334 float weakFootPressure(const MatchPlayer& carrier) const;
1336 std::optional<Vector2F> doubleUpPoint(const MatchPlayer& helper,
1337 const MatchPlayer& carrier,
1338 const MatchPlayer* firstPresser) const;
1340 float doubleUpPenalty(const MatchPlayer& carrier,
1341 const MatchPlayer& defender) const;
1343 float talkSwing(bool homeTeam) const;
1344 StrategySliders computeEffectiveSliders(bool homeTeam) const;
1346 void computeUnderdogShares();
1349 float teamEdge(bool homeTeam) const;
1351 float drawRefereeStrictness() const;
1353 float shoutShotBias(bool homeTeam) const;
1355 float shoutWorkRate(bool homeTeam) const;
1357 void runAiTouchline(bool homeTeam);
1358 void refreshTargetBlends();
1359 void assignMarks();
1361 void setStepTicks(std::uint32_t ticks);
1363 std::uint32_t backgroundStepTicks() const;
1365 float stepSeconds() const;
1368 bool periodElapsed(std::uint64_t ticks) const;
1369 float hashNoise(std::uint32_t salt, std::uint32_t key) const;
1371 float epochNoise(std::uint32_t salt, std::uint32_t key,
1372 std::uint32_t epochSteps) const;
1373 float executionErrorScale(const MatchPlayer& player) const;
1374 void recordPassCompletion(MatchPlayer& receiver);
1376 void simulateStep(float dt);
1377 void updateTeamPhases();
1378 void setTransitionPhases(bool attackingHome);
1379 void setControlledPhases(bool attackingHome, float ballX);
1380 void updateMovement(float dt);
1382 void refreshTacticalTargets(float dt);
1383 float estimatedArrivalTime(const MatchPlayer& candidate,
1384 Vector2F pressurePosition,
1385 const MatchPlayer* carrier);
1386 std::array<MatchPlayer*, 2> closestOutfieldPair(bool homeTeam,
1387 const MatchPlayer* carrier,
1388 Vector2F pressurePosition);
1389 float runPriority(const MatchPlayer& candidate, const MatchPlayer* carrier);
1390 std::array<MatchPlayer*, MatchTuning::Shape::MAX_COMMITTED_RUNNERS>
1391 selectAttackingRunners(bool homeTeam, const MatchPlayer* carrier,
1392 const MatchPlayer* transitionSource);
1393 float runChannel(const MatchPlayer& runner) const;
1395 bool homeTeam, TacticalArrival arrival, const MatchPlayer* carrier,
1396 const std::array<MatchPlayer*, MatchTuning::Shape::MAX_COMMITTED_RUNNERS>&
1397 homeRunners,
1398 const std::array<MatchPlayer*, MatchTuning::Shape::MAX_COMMITTED_RUNNERS>&
1399 awayRunners);
1400 std::array<MatchPlayer*, MatchTuning::Shape::MAX_ACTIVE_SUPPORTERS>
1402 bool homeTeam, const MatchPlayer* carrier,
1403 const std::array<MatchPlayer*, MatchTuning::Shape::MAX_COMMITTED_RUNNERS>&
1404 runners,
1405 const MatchPlayer* midfieldArrival, const MatchPlayer* farPostRunner,
1406 const MatchPlayer* overlappingFullback);
1407 const MatchPlayer* findCoverOutlet(bool defendingHome,
1408 const MatchPlayer* carrier) const;
1410 void updateBall(float dt);
1412 void integrateBall(float dt);
1413 void updateBallInNet(float dt);
1414 void resolvePossessionAndActions(float dt);
1417 bool updateDribble(const MatchPlayer& carrier, float dt);
1419 float dribbleExposureShare() const;
1421 bool attemptTakeOn(MatchPlayer& carrier, MatchPlayer& defender);
1423 void resolveLooseBall();
1424 void attemptTackle(MatchPlayer& carrier, MatchPlayer& defender, bool sliding);
1425 void decideAction(MatchPlayer& carrier);
1427 void applyDueInputs();
1430 bool executeCommand(const MatchCommandRecord& command);
1432 bool recordCommand(const MatchCommandRecord& command);
1433 void applyDueCommands();
1434 void startShout(bool homeTeam, MatchShout shout);
1437 void placeFormation(bool homeTeam);
1439 float effectiveFamiliarity(std::size_t team) const;
1440 bool isControlled(const MatchPlayer& player) const;
1443 bool cutsInside(const MatchPlayer& player) const;
1445 void integrateControlled(MatchPlayer& player, float dt);
1447 bool performControlledAction(MatchPlayer& carrier);
1449 Vector2F controlledAim(const MatchPlayer& carrier) const;
1452 bool throughBall);
1454 void playControlledPass(MatchPlayer& carrier, MatchInputAction action);
1456 void shapeControlledShot(const MatchPlayer& shooter, float halfGoal,
1457 float inset, float& aimY, float& aimZ,
1458 float& spread) const;
1461 std::optional<Vector2F> controlledAssistTarget(
1462 const MatchPlayer& player) const;
1465 float switchSeconds(const MatchPlayer& candidate) const;
1467 void stepKinematics(MatchPlayer& player, Vector2F desired, float desiredSpeed,
1468 float topSpeed, float fatigue, float dt) const;
1469 void passBall(MatchPlayer& passer, const PassOption& option,
1470 bool forceLofted = false);
1471 void takeShot(MatchPlayer& shooter, float forcedXG = -1.0f,
1472 bool header = false, bool freeKick = false);
1475 float strikeShot(const MatchPlayer& shooter, float forcedXG, bool header,
1476 bool penalty, bool freeKick = false);
1478 {
1479 bool saved = false;
1480 float stretch = 0.0f;
1481 float speedExcess = 0.0f;
1482 float crossingHeight = 0.0f;
1483 };
1486 SaveAttempt attemptSave(const MatchPlayer& keeper);
1487 void setPossession(MatchPlayer& player);
1488 // Feeds the tracker (match_engine_tracking.cpp); no effect when it is off.
1489 void trackTouch(const MatchPlayer& player);
1490 void trackPassRelease(const MatchPlayer& passer);
1491 void trackPassCompletion(const MatchPlayer& passer,
1492 const MatchPlayer& receiver);
1493 void trackShot(const MatchPlayer& shooter, float xg, bool setPiece,
1494 bool header, bool penalty);
1496 void trackPressures();
1497 void clearFlightState();
1498
1499 std::optional<PassOption> choosePassTarget(MatchPlayer& passer);
1501 MatchPlayer& receiver) const;
1502 MatchPlayer* findClosestPlayer(Vector2F position, bool homeTeam,
1503 bool includeGoalkeeper = true);
1504 MatchPlayer* findGoalkeeper(bool homeTeam);
1505 MatchPlayer* findMatchPlayer(const Player* player);
1506 float nearestOpponentDistance(const MatchPlayer& player) const;
1507 float openSpaceAhead(const MatchPlayer& carrier) const;
1508 float passingLaneRisk(const MatchPlayer& passer,
1509 const MatchPlayer& receiver) const;
1510 float estimateShotXG(const MatchPlayer& shooter) const;
1513 bool isOffside(const MatchPlayer& receiver, bool attackingHome,
1514 float defenderLine, float lineTolerance = 0.0f) const;
1515 float offsideLine(bool attackingHome) const;
1516
1517 void checkOutOfBounds();
1518 void scoreGoal(bool homeTeam);
1519 void makeSave(MatchPlayer& goalkeeper);
1520 void completeRestart();
1521 void setupKickOff(bool homeKickingOff);
1522 void setupThrowIn(bool homeTeam);
1523 void setupGoalKick(bool homeTeam);
1524 void setupCorner(bool homeTeam, bool topCorner);
1525 void setupFreeKick(bool homeTeam, Vector2F foulPos);
1526 void setupPenalty(bool homeTeam);
1527 void resetPositions();
1529 Vector2F kickOffPosition(const MatchPlayer& player) const;
1530
1532 float attribute(const Player* player, std::string_view name) const;
1534 float rawAttribute(const Player* player, std::string_view name) const;
1536 void computeLevel(const Lineup& home, const Lineup& away);
1538 float randomFloat(float minimum, float maximum);
1540 float incidentRoll();
1541 bool isHomePlayer(const Player* player) const;
1543 MatchEvent& logEvent(MatchEventType type, const MatchPlayer& actor);
1545 void describePendingEvents();
1547 std::string squadPlayerName(PlayerID playerId) const;
1549 void simulateStepBody(float dt);
1550};
Manages the starting XI and reserves of a team.
Definition lineup.h:85
Definition match_engine.h:517
const PlayerMatchStats * findPlayerStats(PlayerID playerId) const
Definition match_engine.cpp:699
void trackPassCompletion(const MatchPlayer &passer, const MatchPlayer &receiver)
Definition match_engine_tracking.cpp:40
std::uint32_t stoppageSequence
Definition match_engine.h:977
void setTacticalFamiliarity(bool homeTeam, float familiarity)
Definition match_engine.cpp:748
std::uint64_t manualSubstitutionStep
Definition match_engine.h:979
bool applyScenario(const MatchScenario &scenario, MatchState scenarioState=MatchState::PLAYING, float scenarioMatchTime=0.0f, int scenarioHomeScore=0, int scenarioAwayScore=0)
Definition match_engine.cpp:9514
std::vector< MatchHighlight > highlights
Definition match_engine.h:1167
float levelPrecision
Definition match_engine.h:963
const std::vector< MatchCommandRecord > & getCommandLog() const
Definition match_engine.h:732
float getPreviousBallZ() const
Definition match_engine.h:904
Vector2F possessionAnchor(const MatchPlayer &player) const
Definition match_engine.cpp:4023
bool periodElapsed(std::uint64_t ticks) const
Definition match_engine.cpp:788
void initializePlayers(const Lineup &lineup, bool isHomeTeam)
Definition match_engine.cpp:603
std::uint64_t stepCounter
Definition match_engine.h:951
float estimatedArrivalTime(const MatchPlayer &candidate, Vector2F pressurePosition, const MatchPlayer *carrier)
Definition match_engine.cpp:2282
PlayerMatchStats & statsOf(const MatchPlayer &matchPlayer)
Definition match_engine.cpp:694
void trackShot(const MatchPlayer &shooter, float xg, bool setPiece, bool header, bool penalty)
Definition match_engine_tracking.cpp:48
const Player * shotAssistCandidate
Definition match_engine.h:1022
float getPlaybackSpeed() const
Definition match_engine.h:557
void simulateToEnd()
Definition match_engine.cpp:1422
Vector2F getPreviousBallPosition() const
Definition match_engine.h:903
void setPlaybackMode(MatchPlaybackMode mode)
Definition match_engine.cpp:1469
bool movePlayerToSlot(PlayerID playerId, std::size_t slot)
Definition match_engine.cpp:880
TeamPhase awayPhase
Definition match_engine.h:1057
std::uint32_t awayLastWindowStoppage
Definition match_engine.h:982
std::uint32_t inputRevision
Definition match_engine.h:1177
double getSimulatedSeconds() const
Definition match_engine.cpp:1464
bool isOffside(const MatchPlayer &receiver, bool attackingHome, float defenderLine, float lineTolerance=0.0f) const
Definition match_engine.cpp:8920
void setMatchContext(const MatchContext &context)
Definition match_engine.cpp:573
void launchBall(const MatchPlayer &kicker, Vector2F origin, Vector2F target, float horizontalSpeed, float verticalSpeed, float curve)
Definition match_engine.cpp:6298
int maxSubstitutions() const
Definition match_engine.cpp:1924
bool advancePlayback(float wallSeconds)
Definition match_engine.cpp:1491
float teamEdge(bool homeTeam) const
Definition match_engine.cpp:1294
float substepBallZ
Definition match_engine.h:1072
std::optional< std::size_t > getFormationSlot(PlayerID playerId) const
Definition match_engine.cpp:868
void takeCorner(MatchPlayer &taker)
Definition match_engine.cpp:8574
Vector2F tightMarkPoint(const MatchPlayer &marker, const MatchPlayer &target, Vector2F current) const
Definition match_engine.cpp:4085
void takeDirectFreeKick(MatchPlayer &taker)
Definition match_engine.cpp:8639
std::uint64_t droppedSimulationSteps
Definition match_engine.h:1185
const Player * lastShooter
Definition match_engine.h:1023
std::uint8_t tacticalFlags
Definition match_engine.h:1119
void applyDueCommands()
Definition match_engine.cpp:914
Vector2F substepBallPosition
Definition match_engine.h:1070
bool isControlled(const MatchPlayer &player) const
Definition match_engine.cpp:3365
void loadInputReplay(std::vector< MatchInputRecord > log)
Definition match_engine.cpp:3425
std::size_t slotOf(const MatchPlayer &player) const
Definition match_engine.cpp:8243
void finishShootoutKick(MatchEventDetail outcome)
Definition match_engine.cpp:2113
void takeShot(MatchPlayer &shooter, float forcedXG=-1.0f, bool header=false, bool freeKick=false)
Definition match_engine.cpp:6244
void simulateStepBody(float dt)
Definition match_engine.cpp:1636
void endPeriod()
Definition match_engine.cpp:1845
float awayFamiliarity
Definition match_engine.h:1074
std::array< StrategySliders, 2 > effectiveSliders
Definition match_engine.h:1087
int getShootoutScore(bool homeTeam) const
Definition match_engine.h:847
float controlActionRemaining
Definition match_engine.h:1146
const ScenarioDecision & getLastScenarioDecision() const
Definition match_engine.h:927
std::optional< Vector2F > controlledAssistTarget(const MatchPlayer &player) const
Definition match_engine.cpp:3577
void stepKinematics(MatchPlayer &player, Vector2F desired, float desiredSpeed, float topSpeed, float fatigue, float dt) const
Definition match_engine.cpp:4570
void parryShot(MatchPlayer &goalkeeper, bool overTheBar)
Definition match_engine.cpp:6910
float hashNoise(std::uint32_t salt, std::uint32_t key) const
Definition match_engine.cpp:1352
std::uint32_t stepTicks
Definition match_engine.h:953
int lastUpdateStepCount
Definition match_engine.h:1184
Vector2F kickOffPosition(const MatchPlayer &player) const
Definition match_engine.cpp:7985
void runMedicalSubstitutions(bool homeTeam)
Definition match_engine.cpp:9178
float ratingRefreshTimer
Definition match_engine.h:1066
MatchBall ball
Definition match_engine.h:941
const Player * chooseReplacement(bool homeTeam, PlayerRole role, bool wantGoalkeeper) const
Definition match_engine.cpp:9124
bool getGoalScoredByHome() const
Definition match_engine.h:880
const MatchStats & getStats() const
Definition match_engine.h:751
void updatePendingAdvantage(float dt)
Definition match_engine.cpp:5427
void integrateMovements(std::span< const std::uint8_t > slots, float dt, bool walking)
Definition match_engine.cpp:4343
PassOption evaluatePassOption(const MatchPlayer &passer, MatchPlayer &receiver) const
Definition match_engine.cpp:5678
std::array< int, 4 > addedMinutes
Definition match_engine.h:988
const std::vector< PlayerMatchStats > & getPlayerStats() const
Definition match_engine.h:796
float tightMarkPenalty(const MatchPlayer &receiver) const
Definition match_engine.cpp:4099
float pressEagerness(const MatchPlayer &candidate, const MatchPlayer *carrier) const
Definition match_engine.cpp:4131
StrategySliders getEffectiveSliders(bool homeTeam) const
Definition match_engine.cpp:1091
const std::vector< MatchHighlight > & getHighlights() const
Definition match_engine.h:586
void takeSetPiece(MatchPlayer &taker, MatchState restartState)
Definition match_engine.cpp:8508
MatchEventType lastTriggerType
Definition match_engine.h:1169
const MatchBall & getBall() const
Definition match_engine.h:743
void recordPassCompletion(MatchPlayer &receiver)
Definition match_engine.cpp:6954
bool goalScoredByHome
Definition match_engine.h:1063
float elapsedMatchMinutes
Definition match_engine.h:1007
std::array< GoalkeeperControl, 2 > keepers
Definition match_engine.h:1054
float injuryCheckTimer
Definition match_engine.h:1008
void computeLevel(const Lineup &home, const Lineup &away)
Definition match_engine.cpp:8955
int playHalfMinutes
Definition match_engine.h:1137
bool writeDebugSnapshot(std::string_view path) const
Definition match_engine.cpp:9898
float goalCelebrationRemaining
Definition match_engine.h:1064
static float groundLaunchSpeed(float distanceMetres, float arrivalSpeed)
Definition match_engine.cpp:6316
bool resolveAerialContest()
Definition match_engine.cpp:7254
MatchPlayer * controlledPassReceiver(MatchPlayer &carrier, Vector2F aim, bool throughBall)
Definition match_engine.cpp:3681
TeamPhase getAwayPhase() const
Definition match_engine.h:753
void diveGoalkeeper(MatchPlayer &keeper, float dt)
Definition match_engine.cpp:6545
void arrangeSetPiece(bool attackingHome, Vector2F ballPosition)
Definition match_engine.cpp:8328
void trackPressures()
Definition match_engine_tracking.cpp:59
std::array< std::string, 2 > teamNames
Definition match_engine.h:1040
float homePossessionMinutes
Definition match_engine.h:1179
void applyShout(bool homeTeam, MatchShout shout)
Definition match_engine.cpp:818
bool tieLevel() const
Definition match_engine.cpp:1901
void resolveShotAtGoalkeeper(MatchPlayer &goalkeeper)
Definition match_engine.cpp:6884
void setupGoalKick(bool homeTeam)
Definition match_engine.cpp:8035
Vector2F controlledAim(const MatchPlayer &carrier) const
Definition match_engine.cpp:3621
std::array< Vector2F, 32 > separationPositions
Definition match_engine.h:1115
void removeFromPitch(MatchPlayer &player)
Definition match_engine.cpp:9369
MatchEvent & logEvent(MatchEventType type)
Definition match_engine.cpp:9604
void checkOutOfBounds()
Definition match_engine.cpp:7692
int awayScore
Definition match_engine.h:1183
MatchPlayer * dutyTaker(bool homeTeam, SetPieceDuty duty)
Definition match_engine.cpp:8270
bool updateDribble(const MatchPlayer &carrier, float dt)
Definition match_engine.cpp:5053
void updateRestartSupport(MatchPlayer &player, const MatchPlayer *taker) const
Definition match_engine.cpp:4657
bool setPlayerCondition(PlayerID playerId, float condition)
Definition match_engine.cpp:719
void setupFreeKick(bool homeTeam, Vector2F foulPos)
Definition match_engine.cpp:8098
void refreshEffectiveSliders()
Definition match_engine.cpp:1096
static float loftVerticalSpeed(float distanceMetres, float horizontalSpeed, float startHeight, float arrivalHeight)
Definition match_engine.cpp:6391
float shoutWorkRate(bool homeTeam) const
Definition match_engine.cpp:1248
float shoutShotBias(bool homeTeam) const
Definition match_engine.cpp:1236
std::uint32_t homeLastWindowStoppage
Definition match_engine.h:981
std::uint64_t getSimulatedSteps() const
Definition match_engine.h:740
void simulateStep(float dt)
Definition match_engine.cpp:1630
float weakFootShade(const MatchPlayer &carrier) const
Definition match_engine.cpp:4164
int getPeriod() const
Definition match_engine.h:821
float refereeDraw
Definition match_engine.h:956
std::optional< float > getPlayerCondition(PlayerID playerId) const
Definition match_engine.cpp:707
void updateShootout(float dt)
Definition match_engine.cpp:2044
void scoreGoal(bool homeTeam)
Definition match_engine.cpp:7778
int awaySubstitutionWindows
Definition match_engine.h:976
TeamPhase homePhase
Definition match_engine.h:1056
bool canSubstitute(bool homeTeam) const
Definition match_engine.cpp:9009
float familiarityOf(const MatchPlayer &player) const
Definition match_engine.cpp:794
const MatchPlayer * tightMarkTarget(const MatchPlayer &marker) const
Definition match_engine.cpp:4072
std::vector< Vector2F > previousPlayerPositions
Definition match_engine.h:1031
bool wasControlled(bool homeTeam) const
Definition match_engine.h:717
std::uint32_t matchSeed
Definition match_engine.h:949
float incidentRoll()
Definition match_engine.cpp:8988
float setPiecePhaseRemaining
Definition match_engine.h:1028
double possessionStartSeconds
Definition match_engine.h:1068
std::uint32_t homeLastAiReviewStoppage
Definition match_engine.h:983
MatchPlayer * findGoalkeeper(bool homeTeam)
Definition match_engine.cpp:8731
std::vector< PlayerMatchStats > playerStats
Definition match_engine.h:965
float lastTriggerMinute
Definition match_engine.h:1171
bool extraTimeReached
Definition match_engine.h:991
void updateMovement(float dt)
Definition match_engine.cpp:2231
MatchPlayer * restartTaker()
Definition match_engine.cpp:8228
void passBall(MatchPlayer &passer, const PassOption &option, bool forceLofted=false)
Definition match_engine.cpp:5946
void applySanction(MatchPlayer &offender, MatchRules::FoulSanction sanction)
Definition match_engine.cpp:5383
float playbackSpeed
Definition match_engine.h:1173
void update(float deltaTime)
Definition match_engine.cpp:1375
void applyDueInputs()
Definition match_engine.cpp:3436
void integrateBall(float dt)
Definition match_engine.cpp:6811
std::vector< MatchSubstitution > substitutions
Definition match_engine.h:966
bool setPieceHome
Definition match_engine.h:1029
std::array< float, 4 > targetBlends
Definition match_engine.h:1110
void setRestartTaker(MatchPlayer *taker)
Definition match_engine.cpp:8235
void setStepTicks(std::uint32_t ticks)
Definition match_engine.cpp:774
TacticalRole getSlotRole(bool homeTeam, std::size_t slot) const
Definition match_engine.cpp:4006
const MatchPlayer * findCoverOutlet(bool defendingHome, const MatchPlayer *carrier) const
Definition match_engine.cpp:2583
bool recordCommand(const MatchCommandRecord &command)
Definition match_engine.cpp:902
float talkSwing(bool homeTeam) const
Definition match_engine.cpp:4230
MatchInputAction lastInputAction
Definition match_engine.h:1147
float getHighlightPlaybackSpeed() const
Definition match_engine.h:560
int pendingPlayHalfMinutes
Definition match_engine.h:1138
const std::vector< Vector2F > & getPreviousPlayerPositions() const
Definition match_engine.h:895
float levelShift
Definition match_engine.h:962
std::mt19937 incidentRng
Definition match_engine.h:948
void loadAttributes(MatchPlayer &matchPlayer, const Player *player) const
Definition match_engine.cpp:641
float strikeShot(const MatchPlayer &shooter, float forcedXG, bool header, bool penalty, bool freeKick=false)
Definition match_engine.cpp:6107
float executionErrorScale(const MatchPlayer &player) const
Definition match_engine.cpp:1364
MatchState getState() const
Definition match_engine.h:750
bool hasShootout() const
Definition match_engine.h:845
bool wentToExtraTime() const
Definition match_engine.h:843
int homeSubstitutionWindows
Definition match_engine.h:975
bool isInHighlight() const
Definition match_engine.cpp:1549
MatchState state
Definition match_engine.h:1055
int getShootoutKicks(bool homeTeam) const
Definition match_engine.h:852
float getGoalCelebrationDuration() const
Definition match_engine.h:884
void setHighlightPlaybackSpeed(float simulatedSecondsPerWallSecond)
Definition match_engine.cpp:1483
float randomFloat(float minimum, float maximum)
Definition match_engine.cpp:8983
float getRefereeStrictness() const
Definition match_engine.h:866
const MatchRules::Knockout & getKnockout() const
Definition match_engine.h:835
std::array< MatchPlayer *, MatchTuning::Shape::MAX_COMMITTED_RUNNERS > selectAttackingRunners(bool homeTeam, const MatchPlayer *carrier, const MatchPlayer *transitionSource)
Definition match_engine.cpp:2398
void refreshTacticalTargets(float dt)
Definition match_engine.cpp:2615
float getTacticalFamiliarity(bool homeTeam) const
Definition match_engine.h:598
void captureInterpolationFrame()
Definition match_engine.cpp:1601
std::vector< std::pair< PlayerID, float > > benchConditions
Definition match_engine.h:1128
float getElapsedMatchMinutes() const
Definition match_engine.h:872
std::optional< MatchHighlight > predictNextHighlight(float horizonSeconds=MatchTuning::Playback::PREDICTION_HORIZON_SECONDS) const
Definition match_engine.cpp:1561
std::vector< const Player * > awayBench
Definition match_engine.h:968
int getControlledActions(bool homeTeam) const
Definition match_engine.h:721
void setControlledPhases(bool attackingHome, float ballX)
Definition match_engine.cpp:2166
const Player * lastCompletedPasser
Definition match_engine.h:1020
SaveAttempt attemptSave(const MatchPlayer &keeper)
Definition match_engine.cpp:6843
std::vector< MatchCommandRecord > commandLog
Definition match_engine.h:1159
GoalkeeperState getAwayGoalkeeperState() const
Definition match_engine.h:912
PassDecision lastPassDecision
Definition match_engine.h:1043
void setPlayHalfMinutes(int minutes)
Definition match_engine.cpp:3370
bool isAbandoned() const
Definition match_engine.h:864
void startShootout()
Definition match_engine.cpp:1930
ScenarioDecision lastScenarioDecision
Definition match_engine.h:1044
bool restartIsSetPiece
Definition match_engine.h:1024
float rawAttribute(const Player *player, std::string_view name) const
Definition match_engine.cpp:8939
std::vector< Vector2F > loadAnchors
Definition match_engine.h:1122
float refereeStrictness
Definition match_engine.h:954
bool userRestartPassRequested() const
Definition match_engine.cpp:8419
std::array< float, 2 > reshapeFamiliarityCost
Definition match_engine.h:1164
bool cutsInside(const MatchPlayer &player) const
Definition match_engine.cpp:3337
void setupPenalty(bool homeTeam)
Definition match_engine.cpp:8140
void completeRestart()
Definition match_engine.cpp:8445
Vector2F goalkeeperTarget(MatchPlayer &keeper, const MatchPlayer *carrier)
Definition match_engine.cpp:6604
void setPossession(MatchPlayer &player)
Definition match_engine.cpp:7632
std::vector< const Player * > homeBench
Definition match_engine.h:967
void accumulatePlayerLoad(float dt)
Definition match_engine.cpp:4820
float advance(float seconds)
Definition match_engine.cpp:1403
std::array< RoleProfile, 2 > keeperProfiles
Definition match_engine.h:1103
void clearBall(MatchPlayer &defender)
Definition match_engine.cpp:7469
bool stepsWithin(float deltaSeconds) const
Definition match_engine.cpp:3940
const std::vector< float > & getPreviousPlayerFacingAngles() const
Definition match_engine.h:899
double lastTriggerSeconds
Definition match_engine.h:1170
float offsideLine(bool attackingHome) const
Definition match_engine.cpp:8879
float openSpaceAhead(const MatchPlayer &carrier) const
Definition match_engine.cpp:8766
bool executeCommand(const MatchCommandRecord &command)
Definition match_engine.cpp:921
bool abandoned
Definition match_engine.h:987
float getShoutStrength(bool homeTeam) const
Definition match_engine.cpp:838
std::optional< Vector2F > doubleUpPoint(const MatchPlayer &helper, const MatchPlayer &carrier, const MatchPlayer *firstPresser) const
Definition match_engine.cpp:4189
TeamPhase getHomePhase() const
Definition match_engine.h:752
bool homeAutoSubstitutions
Definition match_engine.h:973
void integrateControlled(MatchPlayer &player, float dt)
Definition match_engine.cpp:3493
float previousBallZ
Definition match_engine.h:1035
void decideAction(MatchPlayer &carrier)
Definition match_engine.cpp:5443
PlayerID suggestActivePlayer(bool homeTeam, PlayerID current) const
Definition match_engine.cpp:3870
void attemptTackle(MatchPlayer &carrier, MatchPlayer &defender, bool sliding)
Definition match_engine.cpp:5177
std::size_t addPlayerStats(const MatchPlayer &matchPlayer, bool started)
Definition match_engine.cpp:679
MatchContext matchContext
Definition match_engine.h:957
float switchSeconds(const MatchPlayer &candidate) const
Definition match_engine.cpp:3824
float getTeamTalkEffect(bool homeTeam) const
Definition match_engine.cpp:4236
void commitFoul(MatchPlayer &offender, MatchPlayer &victim, bool ballWon, bool reckless)
Definition match_engine.cpp:5303
void updateBallInNet(float dt)
Definition match_engine.cpp:7874
float attribute(const Player *player, std::string_view name) const
Definition match_engine.cpp:8949
float pressStandOffShare(const MatchPlayer &presser, const MatchPlayer &carrier) const
Definition match_engine.cpp:4154
bool substitutePlayer(uint32_t outPlayerId, const Player *inPlayer, std::optional< std::size_t > slot=std::nullopt)
Definition match_engine.cpp:9036
float getTeamTalkModifier(bool homeTeam, int half) const
Definition match_engine.cpp:1270
void setStrategy(bool homeTeam, const Strategy &strategy)
Definition match_engine.cpp:809
TacticalArrival
Definition match_engine.h:934
void updateTeamPhases()
Definition match_engine.cpp:2177
float estimateShotXG(const MatchPlayer &shooter) const
Definition match_engine.cpp:8831
Strategy homeStrategy
Definition match_engine.h:943
std::optional< PassOption > choosePassTarget(MatchPlayer &passer)
Definition match_engine.cpp:5866
void runAiTouchline(bool homeTeam)
Definition match_engine.cpp:1308
void announceAddedTime()
Definition match_engine.cpp:1835
void setPlaybackSpeed(float simulatedSecondsPerWallSecond)
Definition match_engine.cpp:1475
void beginShootoutKick()
Definition match_engine.cpp:2001
float finishingPrecision
Definition match_engine.h:959
bool setFormation(bool homeTeam, std::span< const Vector2F > shape)
Definition match_engine.cpp:859
std::vector< float > previousPlayerFacingAngles
Definition match_engine.h:1032
float loadSeconds
Definition match_engine.h:1121
std::array< SetPieceDesignations, 2 > designations
Definition match_engine.h:972
std::vector< MatchEvent > events
Definition match_engine.h:1037
MatchPlayer * bestSetPieceTaker(bool homeTeam, bool shooting)
Definition match_engine.cpp:8248
StrategySliders computeEffectiveSliders(bool homeTeam) const
Definition match_engine.cpp:1131
MatchPlaybackMode playbackMode
Definition match_engine.h:1172
void computeUnderdogShares()
Definition match_engine.cpp:1102
void refreshRatings()
Definition match_engine.cpp:1322
Vector2F previousBallPosition
Definition match_engine.h:1033
void runAiSubstitutions()
Definition match_engine.cpp:9151
bool deniesGoalChance(const MatchPlayer &victim, const MatchPlayer &offender) const
Definition match_engine.cpp:5277
std::size_t separationCount
Definition match_engine.h:1112
std::vector< Vector2F > getFormation(bool homeTeam) const
Definition match_engine.cpp:854
void setTeamNames(std::string homeTeam, std::string awayTeam)
Definition match_engine.cpp:9624
bool isInAddedTime() const
Definition match_engine.cpp:1797
void shapeControlledShot(const MatchPlayer &shooter, float halfGoal, float inset, float &aimY, float &aimZ, float &spread) const
Definition match_engine.cpp:3804
std::optional< MatchShout > getActiveShout(bool homeTeam) const
Definition match_engine.cpp:847
const PassDecision & getLastPassDecision() const
Definition match_engine.h:758
void assignMarks()
Definition match_engine.cpp:4241
std::array< std::vector< Vector2F >, 2 > formations
Definition match_engine.h:1162
float highlightSpeed
Definition match_engine.h:1174
const std::vector< MatchSubstitution > & getSubstitutions() const
Definition match_engine.h:790
void setKnockout(const MatchRules::Knockout &rules)
Definition match_engine.cpp:1907
const std::vector< MatchPlayer > & getPlayers() const
Definition match_engine.h:742
const MatchTracker & getTracker() const
Definition match_engine.h:806
void setTransitionPhases(bool attackingHome)
Definition match_engine.cpp:2159
float accumulator
Definition match_engine.h:1065
void trackPassRelease(const MatchPlayer &passer)
Definition match_engine_tracking.cpp:34
void startShout(bool homeTeam, MatchShout shout)
Definition match_engine.cpp:827
Strategy awayStrategy
Definition match_engine.h:944
float effectiveFamiliarity(std::size_t team) const
Definition match_engine.cpp:799
std::array< std::array< SlotTactic, 16 >, 2 > slotTactics
Definition match_engine.h:1102
ControlledShot controlledShot
Definition match_engine.h:1156
std::uint32_t awayLastAiReviewStoppage
Definition match_engine.h:984
int period
Definition match_engine.h:986
float runPriority(const MatchPlayer &candidate, const MatchPlayer *carrier)
Definition match_engine.cpp:2354
std::array< int, 2 > controlledActions
Definition match_engine.h:1136
void checkInjuries()
Definition match_engine.cpp:9336
std::optional< std::size_t > restartTakerIndex
Definition match_engine.h:1061
void beginStoppage()
Definition match_engine.cpp:7933
float getTransitionSecondsRemaining() const
Definition match_engine.h:754
std::mt19937 rng
Definition match_engine.h:945
float runChannel(const MatchPlayer &runner) const
Definition match_engine.cpp:2456
void describePendingEvents()
Definition match_engine.cpp:9636
std::optional< MatchHighlight > scheduledHighlight
Definition match_engine.h:1175
PlayerID nextSwitchCandidate(bool homeTeam, PlayerID current, PlayerID skip=0) const
Definition match_engine.cpp:3910
void updateBall(float dt)
Definition match_engine.cpp:6762
std::array< MatchRules::StoppageLog, 4 > stoppageLogs
Definition match_engine.h:989
std::uint64_t highlightTriggerCount
Definition match_engine.h:1168
void planGoalkeeperDive(bool defendingHome, bool penalty)
Definition match_engine.cpp:6470
void setAutoSubstitutions(bool home, bool away)
Definition match_engine.cpp:9028
MatchStats stats
Definition match_engine.h:1041
std::optional< std::size_t > controlledIndex
Definition match_engine.h:1131
std::array< MatchPlayer *, MatchTuning::Shape::MAX_ACTIVE_SUPPORTERS > selectActiveSupporters(bool homeTeam, const MatchPlayer *carrier, const std::array< MatchPlayer *, MatchTuning::Shape::MAX_COMMITTED_RUNNERS > &runners, const MatchPlayer *midfieldArrival, const MatchPlayer *farPostRunner, const MatchPlayer *overlappingFullback)
Definition match_engine.cpp:2535
std::array< std::vector< PlayerInstruction >, 2 > oppositionOrders
Definition match_engine.h:1108
const std::vector< MatchEvent > & getEvents() const
Definition match_engine.h:744
MatchPlaybackMode getPlaybackMode() const
Definition match_engine.h:554
std::optional< bool > lastControlledTeamHome
Definition match_engine.h:1058
void finishMatch()
Definition match_engine.cpp:2146
std::optional< bool > getTieWinnerHome() const
Definition match_engine.cpp:1913
std::array< ShoutState, 2 > shouts
Definition match_engine.h:1085
const std::optional< MatchHighlight > & getScheduledHighlight() const
Definition match_engine.h:573
std::array< MatchPlayer *, 2 > closestOutfieldPair(bool homeTeam, const MatchPlayer *carrier, Vector2F pressurePosition)
Definition match_engine.cpp:2312
void setupKickOff(bool homeKickingOff)
Definition match_engine.cpp:7945
bool separationClear
Definition match_engine.h:1116
float passingLaneRisk(const MatchPlayer &passer, const MatchPlayer &receiver) const
Definition match_engine.cpp:8789
std::array< std::array< float, 2 >, 2 > teamTalks
Definition match_engine.h:1093
int getHomeScore() const
Definition match_engine.h:868
float getGoalCelebrationRemaining() const
Definition match_engine.h:883
std::vector< MatchPlayer > players
Definition match_engine.h:940
void refreshTargetBlends()
Definition match_engine.cpp:757
void separatePlayers()
Definition match_engine.cpp:4728
float awayPossessionMinutes
Definition match_engine.h:1180
float getInterpolationAlpha() const
Definition match_engine.cpp:1614
float stepSeconds() const
Definition match_engine.cpp:782
PlayerID controlledPlayerId
Definition match_engine.h:1133
std::vector< std::pair< PlayerID, std::uint8_t > > medicalFlags
Definition match_engine.h:1126
void recordHighlight(MatchEventType type)
Definition match_engine.cpp:9648
int getPlayHalfMinutes() const
Definition match_engine.h:677
void makeSave(MatchPlayer &goalkeeper)
Definition match_engine.cpp:7894
float transitionSecondsRemaining
Definition match_engine.h:1059
std::uint64_t getDroppedSimulationSteps() const
Definition match_engine.h:874
void rebalanceShape(bool homeTeam, Vector2F vacatedBase, std::int8_t vacatedSlot)
Definition match_engine.cpp:9423
bool setControlledPlayer(PlayerID playerId)
Definition match_engine.cpp:3384
MatchRules::Knockout knockout
Definition match_engine.h:990
bool isHomePlayer(const Player *player) const
Definition match_engine.cpp:8990
float getMatchTimeMinutes() const
Definition match_engine.h:870
float talkOf(bool homeTeam) const
Definition match_engine.cpp:1276
void headBall(MatchPlayer &header)
Definition match_engine.cpp:7498
std::uint32_t backgroundStepTicks() const
Definition match_engine.cpp:1442
void clearFlightState()
Definition match_engine.cpp:7674
bool slidersStale
Definition match_engine.h:1089
void ensureGoalkeeper(bool homeTeam)
Definition match_engine.cpp:9466
void resolveLooseBall()
Definition match_engine.cpp:6977
void submitInput(const MatchPlayerInput &input)
Definition match_engine.cpp:3415
int getAwayScore() const
Definition match_engine.h:869
std::size_t commandCursor
Definition match_engine.h:1160
GoalkeeperState getHomeGoalkeeperState() const
Definition match_engine.h:911
void beginBreak(float seconds, float recovery)
Definition match_engine.cpp:1885
void advanceClock(float dt)
Definition match_engine.cpp:1620
void resetPositions()
Definition match_engine.cpp:8694
float dribbleExposureShare() const
Definition match_engine.cpp:5044
std::vector< MatchInputRecord > inputLog
Definition match_engine.h:1157
const StatsConfig & statsConfig
Definition match_engine.h:942
MatchPlayer * findClosestPlayer(Vector2F position, bool homeTeam, bool includeGoalkeeper=true)
Definition match_engine.cpp:8709
bool tryOwnGoalTouch(MatchPlayer &defender)
Definition match_engine.cpp:7411
void trackTouch(const MatchPlayer &player)
Definition match_engine_tracking.cpp:27
float matchTimeMinutes
Definition match_engine.h:1181
std::array< float, 2 > underdogShares
Definition match_engine.h:1091
void updateRestartMovement(float dt)
Definition match_engine.cpp:4700
void placeTaker(MatchPlayer &taker, Vector2F spot)
Definition match_engine.cpp:8195
float drawRefereeStrictness() const
Definition match_engine.cpp:565
std::vector< const Player * > squad
Definition match_engine.h:970
bool attemptTakeOn(MatchPlayer &carrier, MatchPlayer &defender)
Definition match_engine.cpp:5134
float weakFootPressure(const MatchPlayer &carrier) const
Definition match_engine.cpp:4178
float currentTopSpeed(const MatchPlayer &player) const
Definition match_engine.cpp:3952
const RoleProfile & roleProfileOf(const MatchPlayer &player) const
Definition match_engine.cpp:4012
std::array< bool, 2 > everControlled
Definition match_engine.h:1135
std::uint64_t lastStoppageStep
Definition match_engine.h:978
int getSubstitutionWindowsUsed(bool homeTeam) const
Definition match_engine.cpp:9004
std::array< std::vector< Vector2F >, 2 > slotAnchors
Definition match_engine.h:1106
const std::vector< MatchInputRecord > & getInputLog() const
Definition match_engine.h:690
float matchClockRate() const
Definition match_engine.h:1139
MatchPlayer * selectFinalThirdPlayer(bool homeTeam, TacticalArrival arrival, const MatchPlayer *carrier, const std::array< MatchPlayer *, MatchTuning::Shape::MAX_COMMITTED_RUNNERS > &homeRunners, const std::array< MatchPlayer *, MatchTuning::Shape::MAX_COMMITTED_RUNNERS > &awayRunners)
Definition match_engine.cpp:2474
void resolvePossessionAndActions(float dt)
Definition match_engine.cpp:4951
const Player * lastCompletedReceiver
Definition match_engine.h:1021
float doubleUpPenalty(const MatchPlayer &carrier, const MatchPlayer &defender) const
Definition match_engine.cpp:4213
OppositionInstruction instructionAgainst(const MatchPlayer &target) const
Definition match_engine.cpp:4061
void playControlledPass(MatchPlayer &carrier, MatchInputAction action)
Definition match_engine.cpp:3722
void resolveTactics(bool homeTeam)
Definition match_engine.cpp:3976
void updateMatchClock()
Definition match_engine.cpp:1805
void loadCommandReplay(std::vector< MatchCommandRecord > log)
Definition match_engine.cpp:892
int homeScore
Definition match_engine.h:1182
void setTracking(bool on)
Definition match_engine.h:807
std::array< float, 2 > reshapeSecondsRemaining
Definition match_engine.h:1165
void injurePlayer(MatchPlayer &player, bool fromContact)
Definition match_engine.cpp:9355
std::uint32_t scheduledRevision
Definition match_engine.h:1178
float setPieceTimer
Definition match_engine.h:1062
float passingRoleBias(const MatchPlayer &passer, const MatchPlayer &receiver, float progression, float completion) const
Definition match_engine.cpp:4118
void extendRestart(float seconds)
Definition match_engine.cpp:7923
void setupCorner(bool homeTeam, bool topCorner)
Definition match_engine.cpp:8061
MatchPlayerInput controlInput
Definition match_engine.h:1145
PendingAdvantage pendingAdvantage
Definition match_engine.h:1017
bool performControlledAction(MatchPlayer &carrier)
Definition match_engine.cpp:3634
float engageBoost(const MatchPlayer &defender, const MatchPlayer &carrier) const
Definition match_engine.cpp:4141
float defensiveRoleShift(const MatchPlayer &player) const
Definition match_engine.cpp:4053
float epochNoise(std::uint32_t salt, std::uint32_t key, std::uint32_t epochSteps) const
Definition match_engine.cpp:1357
std::size_t inputCursor
Definition match_engine.h:1158
Shootout shootout
Definition match_engine.h:1006
std::array< std::int8_t, 32 > markAssignments
Definition match_engine.h:1124
int getLastUpdateStepCount() const
Definition match_engine.h:873
int getSubstitutionsUsed(bool homeTeam) const
Definition match_engine.cpp:8999
const MatchContext & getMatchContext() const
Definition match_engine.h:841
void clearBehind(MatchPlayer &defender)
Definition match_engine.cpp:7449
void setupThrowIn(bool homeTeam)
Definition match_engine.cpp:7997
void placeFormation(bool homeTeam)
Definition match_engine.cpp:1064
PlayerID getControlledPlayer() const
Definition match_engine.cpp:3402
std::array< std::uint8_t, 32 > separationOrder
Definition match_engine.h:1111
std::string squadPlayerName(PlayerID playerId) const
Definition match_engine.cpp:9629
void runAiSubstitutionsFor(bool homeTeam)
Definition match_engine.cpp:9205
const Player * tacticalOwner
Definition match_engine.h:1118
int getAddedMinutes(int half) const
Definition match_engine.h:823
bool performSubstitution(MatchPlayer &outgoing, const Player *inPlayer, SubstitutionReason reason)
Definition match_engine.cpp:9049
void setTeamTalkModifier(bool homeTeam, int half, float modifier)
Definition match_engine.cpp:1258
float homeFamiliarity
Definition match_engine.h:1073
bool awayAutoSubstitutions
Definition match_engine.h:974
std::string getDebugSnapshotJson() const
Definition match_engine.cpp:9750
std::size_t undescribedEvents
Definition match_engine.h:1039
MatchTracker tracker
Definition match_engine.h:1042
float nearestOpponentDistance(const MatchPlayer &player) const
Definition match_engine.cpp:8752
void setMedicalFlags(PlayerID playerId, std::uint8_t flags)
Definition match_engine.cpp:9167
MatchPlayer * findMatchPlayer(const Player *player)
Definition match_engine.cpp:8743
Definition match_tracking.h:85
void setEnabled(bool on)
Definition match_tracking.h:87
Persistent career identity, attributes, traits and day-to-day state.
Definition player.h:104
Represents the tactical setup of a team for a match.
Definition strategy.h:61
ImGuiKey key
Definition input_actions.cpp:25
const char * name
Definition input_actions.cpp:26
SetPieceDuty
Leadership and dead-ball duties the manager can hand out (values are persisted in the lineup).
Definition lineup.h:27
MatchPlaybackMode
Definition match_engine.h:475
MatchInputAction
Definition match_engine.h:387
PlayerIntent
Definition match_engine.h:64
TeamPhase
Definition match_engine.h:52
@ DEFENSIVE_TRANSITION
@ ATTACKING_TRANSITION
PassIntent
Definition match_engine.h:83
std::string_view goalkeeperStateName(GoalkeeperState state)
Definition match_engine.cpp:491
MatchFidelity
Definition match_engine.h:460
GoalkeeperState
Definition match_engine.h:119
MatchState
Definition match_engine.h:34
MatchShout
Definition match_engine.h:333
@ WORK_BALL_INTO_BOX
MatchCommandType
Definition match_engine.h:349
ScenarioAction
Definition match_engine.h:108
MatchEventType
Definition match_events.h:20
MatchEventDetail
Definition match_events.h:57
SubstitutionReason
Definition match_events.h:175
FoulSanction
Definition match_rules.h:90
std::int64_t minimum
Definition runtime_editor_validation.cpp:46
std::int64_t maximum
Definition runtime_editor_validation.cpp:47
Contains structures to simplify JSON parsing and loading of player statistics.
Definition match_engine.h:220
float z
Definition match_engine.h:222
bool passByHome
Definition match_engine.h:244
bool shotIsPenalty
Definition match_engine.h:256
Vector2F velocity
Definition match_engine.h:223
float shotTargetHeightMetres
Definition match_engine.h:253
float dribbleExposure
Definition match_engine.h:238
float dribbleTouchLength
Definition match_engine.h:239
bool shotIsHeader
Definition match_engine.h:255
const Player * kicker
Definition match_engine.h:231
bool shotFromSetPiece
Definition match_engine.h:257
bool shotByHome
Definition match_engine.h:247
float kickerLockout
Definition match_engine.h:233
std::uint32_t touchAttempts
Definition match_engine.h:235
bool passWasOffside
Definition match_engine.h:245
Vector2F position
Definition match_engine.h:221
bool isAerialDelivery
Definition match_engine.h:260
bool fromThrowIn
Definition match_engine.h:262
float curve
Definition match_engine.h:225
float shotXG
Definition match_engine.h:250
bool shotOnTarget
Definition match_engine.h:249
float touchTimer
Definition match_engine.h:241
float velocityZ
Definition match_engine.h:224
Vector2F dribbleDirection
Definition match_engine.h:240
float shotElapsedSeconds
Definition match_engine.h:254
bool isShot
Definition match_engine.h:246
bool isPass
Definition match_engine.h:243
const Player * intendedReceiver
Definition match_engine.h:229
const Player * lastPossessor
Definition match_engine.h:228
bool shotSaveResolved
Definition match_engine.h:258
float shotTargetY
Definition match_engine.h:252
const Player * possessedBy
Definition match_engine.h:227
Definition match_engine.h:365
PlayerID incoming
Definition match_engine.h:377
MatchCommandType type
Definition match_engine.h:368
float talkModifier
Definition match_engine.h:382
Strategy strategy
Definition match_engine.h:370
int talkHalf
Definition match_engine.h:381
std::uint64_t step
Definition match_engine.h:367
std::vector< Vector2F > formation
Definition match_engine.h:373
bool homeTeam
Definition match_engine.h:369
std::optional< std::size_t > slot
Definition match_engine.h:379
MatchShout shout
Definition match_engine.h:371
PlayerID player
Definition match_engine.h:375
Definition match_context.h:26
Definition match_engine.h:1150
std::optional< float > aimMetres
Definition match_engine.h:1153
bool active
Definition match_engine.h:1151
float power
Definition match_engine.h:1154
Definition match_engine.h:1046
float timer
Definition match_engine.h:1048
GoalkeeperState state
Definition match_engine.h:1047
float diveTargetY
Definition match_engine.h:1050
float reactionRemaining
Definition match_engine.h:1049
float lateralVelocity
Definition match_engine.h:1051
Definition match_engine.h:1188
float laneRisk
Definition match_engine.h:1195
MatchPlayer * receiver
Definition match_engine.h:1189
float utility
Definition match_engine.h:1193
bool lofted
Definition match_engine.h:1198
Vector2F targetPoint
Definition match_engine.h:1190
float passDistance
Definition match_engine.h:1197
float completionProbability
Definition match_engine.h:1196
float progression
Definition match_engine.h:1194
PassIntent intent
Definition match_engine.h:1192
Definition match_engine.h:1011
bool active
Definition match_engine.h:1012
Vector2F position
Definition match_engine.h:1014
bool fouledTeamHome
Definition match_engine.h:1013
float secondsRemaining
Definition match_engine.h:1015
Definition match_engine.h:1478
float crossingHeight
Definition match_engine.h:1482
bool saved
Definition match_engine.h:1479
float stretch
Definition match_engine.h:1480
float speedExcess
Definition match_engine.h:1481
Definition match_engine.h:994
float timer
Definition match_engine.h:1000
bool inFlight
Definition match_engine.h:997
std::array< int, 2 > goals
Definition match_engine.h:1002
PlayerID taker
Definition match_engine.h:999
bool started
Definition match_engine.h:995
bool kickerHome
Definition match_engine.h:998
std::array< std::vector< PlayerID >, 2 > order
Definition match_engine.h:1004
bool homeFirst
Definition match_engine.h:996
std::array< int, 2 > kicks
Definition match_engine.h:1001
Definition match_engine.h:1076
float remainingSeconds
Definition match_engine.h:1078
MatchShout shout
Definition match_engine.h:1077
float repeats
Definition match_engine.h:1082
float impact
Definition match_engine.h:1080
Definition match_engine.h:1096
Vector2F possessionOffset
Definition match_engine.h:1099
RoleProfile profile
Definition match_engine.h:1098
TacticalRole role
Definition match_engine.h:1097
Definition match_events.h:93
Definition match_engine.h:488
float triggerMinute
Definition match_engine.h:494
double startSeconds
Definition match_engine.h:490
double endSeconds
Definition match_engine.h:492
MatchEventType type
Definition match_engine.h:489
double triggerSeconds
Definition match_engine.h:491
Definition match_engine.h:448
int playHalfMinutes
Definition match_engine.h:455
PlayerID player
Definition match_engine.h:452
std::uint64_t step
Definition match_engine.h:450
MatchPlayerInput input
Definition match_engine.h:453
Definition match_engine.h:410
float moveY
Definition match_engine.h:413
std::uint8_t passAssist
Definition match_engine.h:443
bool jockey
Definition match_engine.h:437
float aimY
Definition match_engine.h:426
float aimX
Definition match_engine.h:425
float moveX
Definition match_engine.h:412
bool sprint
Definition match_engine.h:415
MatchInputAction action
Definition match_engine.h:423
float power
Definition match_engine.h:432
Definition match_engine.h:151
bool urgentMovement
Definition match_engine.h:164
int yellowCards
Definition match_engine.h:209
std::int8_t formationSlot
Definition match_engine.h:208
float stamina
Definition match_engine.h:178
float sprintReserve
Definition match_engine.h:180
float diveTimer
Definition match_engine.h:173
Vector2F position
Definition match_engine.h:154
float vision
Definition match_engine.h:198
bool isTrapping
Definition match_engine.h:170
bool isInjured
Definition match_engine.h:205
float trapTimer
Definition match_engine.h:171
float endurance
Definition match_engine.h:197
float physicality
Definition match_engine.h:195
float passing
Definition match_engine.h:191
bool isPressing
Definition match_engine.h:174
bool isHomeTeam
Definition match_engine.h:153
float actionCooldown
Definition match_engine.h:187
float defending
Definition match_engine.h:193
bool isMakingRun
Definition match_engine.h:175
bool isDiving
Definition match_engine.h:172
bool isSprinting
Definition match_engine.h:185
float pace
Definition match_engine.h:189
Vector2F basePosition
Definition match_engine.h:156
float heightMetres
Definition match_engine.h:199
float facingAngle
Definition match_engine.h:166
float turnRate
Definition match_engine.h:168
std::size_t statsIndex
Definition match_engine.h:211
const Player * player
Definition match_engine.h:152
bool onPitch
Definition match_engine.h:202
float targetAngle
Definition match_engine.h:167
float braking
Definition match_engine.h:184
Vector2F velocity
Definition match_engine.h:155
Vector2F tacticalTarget
Definition match_engine.h:162
bool isGoalkeeper
Definition match_engine.h:204
float dribbling
Definition match_engine.h:192
float acceleration
Definition match_engine.h:183
float goalkeeping
Definition match_engine.h:194
float maxSpeed
Definition match_engine.h:182
float tackleCooldown
Definition match_engine.h:186
float shooting
Definition match_engine.h:190
Vector2F movementTarget
Definition match_engine.h:157
PlayerIntent intent
Definition match_engine.h:159
Definition match_rules.h:48
Definition match_scenario.h:34
Definition match_engine.h:266
int homeCrosses
Definition match_engine.h:285
int homeProgressivePasses
Definition match_engine.h:281
float awayPossession
Definition match_engine.h:324
int awayProgressivePasses
Definition match_engine.h:282
float ballInPlayMinutes
Definition match_engine.h:328
int homeAdvantagesPlayed
Definition match_engine.h:313
int awaySaves
Definition match_engine.h:276
int awayHeadedGoals
Definition match_engine.h:318
int homeTackleAttempts
Definition match_engine.h:299
float awayShotXG
Definition match_engine.h:326
int awayOnTarget
Definition match_engine.h:270
int homeFouls
Definition match_engine.h:273
int homeSaves
Definition match_engine.h:275
float homeShotXG
Definition match_engine.h:325
int awayTackles
Definition match_engine.h:292
int homeYellowCards
Definition match_engine.h:295
int homeOffsides
Definition match_engine.h:293
int homeHeadedShots
Definition match_engine.h:309
int awayHeadedShots
Definition match_engine.h:310
int homeAerialDuelsWon
Definition match_engine.h:307
int awaySubstitutions
Definition match_engine.h:306
int awayPenaltyGoals
Definition match_engine.h:322
int awayPenalties
Definition match_engine.h:304
int awayPassesCompleted
Definition match_engine.h:280
int awayShots
Definition match_engine.h:268
int homeRedCards
Definition match_engine.h:297
int awaySwitchesOfPlay
Definition match_engine.h:290
int homeOnTarget
Definition match_engine.h:269
int awayTackleAttempts
Definition match_engine.h:300
int homeThroughBalls
Definition match_engine.h:283
int homeHeadedGoals
Definition match_engine.h:317
int awayAerialDuelsWon
Definition match_engine.h:308
int homeShots
Definition match_engine.h:267
int awayCorners
Definition match_engine.h:272
int homeCutbacks
Definition match_engine.h:287
int homePenalties
Definition match_engine.h:303
int homeSubstitutions
Definition match_engine.h:305
int awayOffsides
Definition match_engine.h:294
int awaySetPieceGoals
Definition match_engine.h:320
int homePassesCompleted
Definition match_engine.h:279
int homeShotsInsideBox
Definition match_engine.h:315
int awayYellowCards
Definition match_engine.h:296
float homePossession
Definition match_engine.h:323
int awayRedCards
Definition match_engine.h:298
int homeSetPieceGoals
Definition match_engine.h:319
int awayInjuries
Definition match_engine.h:302
int awayFouls
Definition match_engine.h:274
int homeSetPieceShots
Definition match_engine.h:311
int awaySetPieceShots
Definition match_engine.h:312
int awayCutbacks
Definition match_engine.h:288
int awayShotsInsideBox
Definition match_engine.h:316
int awayThroughBalls
Definition match_engine.h:284
int awayAdvantagesPlayed
Definition match_engine.h:314
int homeTackles
Definition match_engine.h:291
int homePenaltyGoals
Definition match_engine.h:321
int homePassesAttempted
Definition match_engine.h:277
int awayCrosses
Definition match_engine.h:286
int awayPassesAttempted
Definition match_engine.h:278
int homeInjuries
Definition match_engine.h:301
int homeCorners
Definition match_engine.h:271
int homeSwitchesOfPlay
Definition match_engine.h:289
static constexpr float CENTRE
Definition match_tuning.h:37
static constexpr float PREDICTION_HORIZON_SECONDS
Definition match_tuning.h:152
static constexpr float DEFAULT_SPEED
Definition match_tuning.h:142
static constexpr float DEFAULT_HIGHLIGHT_SPEED
Definition match_tuning.h:143
static constexpr float BRAKING_BASE
Definition match_tuning.h:194
static constexpr float FACING_TURN_RATE_RADIANS
Definition match_tuning.h:202
static constexpr float ACCELERATION_BASE
Definition match_tuning.h:191
static constexpr float DEFAULT_ATTRIBUTE
Definition match_tuning.h:165
static constexpr float TOP_SPEED_BASE
Definition match_tuning.h:188
static constexpr float EVEN_POSSESSION_PERCENT
Definition match_tuning.h:1228
static constexpr float PLAY_STOPPAGE_SECONDS
Definition match_tuning.h:86
static constexpr float GOAL_CELEBRATION_SECONDS
Definition match_tuning.h:126
static constexpr float HALF_TIME_MINUTE
Definition match_tuning.h:96
static constexpr float DEFAULT_PLAYER_HEIGHT_METRES
Definition match_tuning.h:903
Definition match_engine.h:95
std::uint32_t receiverId
Definition match_engine.h:97
float laneRisk
Definition match_engine.h:102
float progression
Definition match_engine.h:101
float utility
Definition match_engine.h:100
float completionProbability
Definition match_engine.h:103
std::uint32_t passerId
Definition match_engine.h:96
PassIntent intent
Definition match_engine.h:99
Vector2F targetPoint
Definition match_engine.h:98
Definition match_events.h:122
Measurable behaviour of a role and duty in the match engine. Distances are metres,...
Definition tactics.h:92
Definition match_engine.h:133
ScenarioAction action
Definition match_engine.h:134
float passUtility
Definition match_engine.h:138
std::string reason
Definition match_engine.h:137
float carryUtility
Definition match_engine.h:140
float shotUtility
Definition match_engine.h:139
std::optional< PassDecision > best
Definition match_engine.h:135
std::optional< PassDecision > runnerUp
Definition match_engine.h:136
float shieldUtility
Definition match_engine.h:141
Configuration mapping roles to their focus areas and listing all possible stats.
Definition stats_config.h:42
Team-wide tactical preferences in [0, 1].
Definition strategy.h:27
A simple 2D float vector for pitch coordinates.
Definition types.h:84
OppositionInstruction
Individual instruction against one opposing player (values are persisted in OppositionInstructions; a...
Definition tactics.h:77
TacticalRole
How a player interprets his slot (values are persisted in the tactic). Standard plays the position as...
Definition tactics.h:43
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21
PlayerRole
Represents a specific tactical role on the pitch.
Definition types.h:63