Player12
An open source football management simulator
Loading...
Searching...
No Matches
MatchRenderPlayer Struct Reference

#include <match_render_snapshot.h>

Public Attributes

const Player * player = nullptr
 
bool isHomeTeam = false
 
Vector2F previousPosition
 
Vector2F currentPosition
 
Vector2F movementTarget
 
PlayerIntent intent = PlayerIntent::HOLD_SHAPE
 
float previousFacingAngle = 0.0f
 
float currentFacingAngle = 0.0f
 
float stamina = 1.0f
 
bool possessesBall = false
 
bool onPitch = true
 
bool isGoalkeeper = false
 
bool isDiving = false
 
bool isInjured = false
 
int yellowCards = 0
 
float heightMetres = MatchTuning::Units::DEFAULT_PLAYER_HEIGHT_METRES
 
float speedMetresPerSecond = 0.0f
 
float tackleCooldown = 0.0f
 

Detailed Description

Read-only normalized world state consumed by renderers.

The snapshot is rebuilt every frame from a MatchEngine and carries the previous and current fixed-step positions plus the interpolation fraction, so 2D and 3D renderers can interpolate without touching the simulation. Renderers must never mutate this data or the engine.

Positions are copied, but Player pointers and the event/statistics pointers in MatchRenderSnapshot remain borrowed. Consume the snapshot while its source engine and players are alive and stable; it is not an owned replay record or a cross-thread publication format. See docs/development/match-engine.md.

Units: positions are normalised pitch coordinates (x along the 105 m length, home attacking +x; y across the 68 m width). Ball currentZ and previousZ are in length units (metres = z * 105); the *HeightMetres fields carry the same value already converted to metres.

Member Data Documentation

◆ currentFacingAngle

float MatchRenderPlayer::currentFacingAngle = 0.0f

◆ currentPosition

Vector2F MatchRenderPlayer::currentPosition
Initial value:
static constexpr float CENTRE
Definition match_tuning.h:37

◆ heightMetres

float MatchRenderPlayer::heightMetres = MatchTuning::Units::DEFAULT_PLAYER_HEIGHT_METRES

◆ intent

PlayerIntent MatchRenderPlayer::intent = PlayerIntent::HOLD_SHAPE

◆ isDiving

bool MatchRenderPlayer::isDiving = false

◆ isGoalkeeper

bool MatchRenderPlayer::isGoalkeeper = false

◆ isHomeTeam

bool MatchRenderPlayer::isHomeTeam = false

◆ isInjured

bool MatchRenderPlayer::isInjured = false

◆ movementTarget

Vector2F MatchRenderPlayer::movementTarget

◆ onPitch

bool MatchRenderPlayer::onPitch = true

False once sent off or forced off; such players wait by the bench.

◆ player

const Player* MatchRenderPlayer::player = nullptr

◆ possessesBall

bool MatchRenderPlayer::possessesBall = false

◆ previousFacingAngle

float MatchRenderPlayer::previousFacingAngle = 0.0f

◆ previousPosition

Vector2F MatchRenderPlayer::previousPosition

◆ speedMetresPerSecond

float MatchRenderPlayer::speedMetresPerSecond = 0.0f

Running speed in metres per simulated second (drives the stride).

◆ stamina

float MatchRenderPlayer::stamina = 1.0f

◆ tackleCooldown

float MatchRenderPlayer::tackleCooldown = 0.0f

Seconds before this player may challenge again; it jumps up when he goes into a tackle (renderers start the tackle pose on the rise).

◆ yellowCards

int MatchRenderPlayer::yellowCards = 0

The documentation for this struct was generated from the following file: