Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sr2echa/TF2-Source-Code/llms.txt

Use this file to discover all available pages before exploring further.

TF2’s control point system is split across three server-side entities: CTeamControlPoint (the individual point), CTeamControlPointMaster (the map-level orchestrator), and CTFObjectiveResource (the networked HUD state broadcaster). A trigger_area_capture brush volume sits around each point and drives capture progress into the owning CTeamControlPoint.

CTeamControlPoint

Defined in game/server/team_control_point.h, this entity tracks per-team ownership, capture progress, and locking state.
// Key owner API
void  SetOwner( int iCapTeam, bool bMakeSound = true,
                int iNumCappers = 0, int *iCappingPlayers = NULL );
int   GetOwner( void ) const;
void  ForceOwner( int iTeam );   // used when selecting a specific round

// Locking
void  InputSetLocked( inputdata_t &inputdata );
void  InputSetUnlockTime( inputdata_t &inputdata );

// Capture progress
void  UpdateCapPercentage( void );
float GetTeamCapPercentage( int iTeam );
void  SetCappersRequiredForTeam( int iGameTeam, int iCappers );

Spawnflags

FlagValueEffect
SF_CAP_POINT_HIDEFLAG1<<0Hide HUD flag icon
SF_CAP_POINT_HIDE_MODEL1<<1Hide point model
SF_CAP_POINT_NO_CAP_SOUNDS1<<3Suppress capture sounds
SF_CAP_POINT_BOTS_IGNORE1<<4Bots will not attempt to cap
HasBeenContested() returns true only after an enemy team has first touched the point. This gates certain announcer lines and HUD cues.

CTeamControlPointMaster

One team_control_point_master entity is spawned per level. On activation it enumerates all team_control_point entities in the map and builds the m_ControlPoints list. It runs periodic win-condition checks and fires team-win outputs.
// game/server/team_control_point_master.h
void  CheckWinConditions( void );
bool  WouldNewCPOwnerWinGame( CTeamControlPoint *pPoint, int iNewOwner );
void  FireTeamWinOutput( int iWinningTeam );

int   GetNumPoints( void );
int   GetNumPointsOwnedByTeam( int iTeam );
int   CalcNumRoundsRemaining( int iTeam );

// Mini-rounds (A/D maps with sequential rounds)
bool  PlayingMiniRounds( void );   // true when m_ControlPointRounds.Count() > 0
int   GetNumRounds( void );
PlayingMiniRounds() returns true on maps like cp_dustbowl that use team_control_point_round entities to define ordered capture sequences. When mini-rounds are active, the master tracks the current active round separately from the full point list.

CTFObjectiveResource

CTFObjectiveResource (server) / C_TFObjectiveResource (client) is a singleton entity that replicates all objective HUD state via CNetworkVar. Clients read this to render cap progress bars, team icons, and MvM wave counters.
// game/server/tf/tf_objective_resource.h — networked fields (sample)
CNetworkVar( int,   m_nMannVsMachineMaxWaveCount );
CNetworkVar( int,   m_nMannVsMachineWaveCount );
CNetworkVar( int,   m_nMannVsMachineWaveEnemyCount );
CNetworkVar( int,   m_nMvMWorldMoney );
CNetworkVar( float, m_flMannVsMachineNextWaveTime );
CNetworkVar( bool,  m_bMannVsMachineBetweenWaves );
The resource entity also carries per-wave class icon names and counts used by the MvM wave status HUD, flag carrier upgrade levels, and bomb upgrade timing — all populated by CTFGameRules and CPopulationManager on the server.
To replicate a new piece of HUD state to all clients, add a CNetworkVar to CTFObjectiveResource and update it from the server whenever the value changes. Clients access the singleton via TFObjectiveResource.

Build docs developers (and LLMs) love