CS2 Game State Integration Spec
Note
This spec is a draft. It will change as more CS2 payloads are captured and the open items get settled.
Valve has never published a spec for CS2. The only official document is Valve’s CS:GO page, and CS2 kept the same mechanism and config format. This spec takes that page and checks it against payloads CS2 actually sent.
Each fact is tagged with its evidence:
- [V] Valve’s page. It’s written for CS:GO, and the live page blocks automated clients, so it was read through the Internet Archive.
- [C] Payloads captured from CS2, in pygsi’s
tests/fixtures.json. They come from a practice match against bots onde_dust2(provider.version14141), plus one payload from a community server. Thepreviouslyandaddedblocks were stripped before they were saved. [C] also covers what pygsi’s git history records about earlier runs against CS2, cited by commit. - [B] u/Bkid’s Game State Integration: A Very Large and In-Depth Explanation (2019), a detailed write-up built from payloads captured in CS:GO. Much of CS:GO’s GSI carried over unchanged, so it’s the guide where CS2 data is missing, but each [B] fact still needs a CS2 payload to confirm it.
When sources disagree, the captured payloads and pygsi’s tested behavior win, then Valve, then [B]. Anything not confirmed in CS2 is marked open and listed under Open Items. Where [B] covers an open item, it’s the expected answer. Anything that only other GSI implementations suggest is listed as a lead to check, not as a fact.
Structure
These are the keys a payload can have. Fields marked [C] have been seen in a CS2 payload. The others come from Valve’s descriptions of the components.
payload
+-- auth [V] only with an "auth" block in the config
+-- provider [C]
| +-- name, appid, version, steamid, timestamp
+-- map [C]
| +-- mode, name, phase, round, num_matches_to_win_series
| +-- team_ct, team_t
| | +-- score, name, flag, consecutive_round_losses,
| | timeouts_remaining, matches_won_this_series
| +-- round_wins [C] with map_round_wins
| +-- "1", "2", ...
+-- round [C]
| +-- phase, bomb, win_team
+-- player [C]
| +-- steamid, name, observer_slot, team, activity
| +-- clan [V] open
| +-- state [C] with player_state
| | +-- health, armor, helmet, flashed, smoked, burning, money,
| | round_kills, round_killhs, equip_value
| +-- weapons [C] with player_weapons
| | +-- weapon_0, weapon_1, ...
| | +-- name, paintkit, type, state,
| | ammo_clip, ammo_clip_max, ammo_reserve
| +-- match_stats [C] with player_match_stats
| +-- kills, assists, deaths, mvps, score
+-- allplayers, bomb, phase_countdowns, grenades
| [V] observer-only, open
+-- previously [V] old values of what changed
+-- added [V] keys that weren't there before
1. The Config File
CS2 reads every file named gamestate_integration_<name>.cfg in game/csgo/cfg/ when it starts, and sends updates to each one [V][C]. A file saved with a UTF-8 BOM doesn’t load, and the console lists the files that did [V].
Valve’s sample for a player’s own client [V]:
"Console Sample v.1"
{
"uri" "http://127.0.0.1:3000"
"timeout" "5.0"
"buffer" "0.1"
"throttle" "0.5"
"heartbeat" "60.0"
"auth"
{
"token" "CCWJu64ZV3JHDT8hZc"
}
"output"
{
"precision_time" "3"
"precision_position" "1"
"precision_vector" "3"
}
"data"
{
"provider" "1"
"map" "1"
"round" "1"
"player_id" "1"
"player_state" "1"
"player_weapons" "1"
"player_match_stats" "1"
}
}
Endpoint Settings [V]
| Key | Default | Meaning |
|---|---|---|
uri | none | Where the game sends its POST requests. For an https URI, the Steam client uses TLS and validates the server’s certificate. |
timeout | 1.1 s | How long the game waits for a response. After a timeout, the request counts as failed, and the next one sends the full state with no deltas. |
buffer | 0.1 s | After a change, the game collects more changes for this long and reports them together. 0.0 turns buffering off. |
throttle | 1.0 s | The game sends nothing for at least this long after a 2xx response. |
heartbeat | not given | The game sends a request this long after the last 2xx response, even if nothing changed. |
The game expects a 2xx response, and it doesn’t send a new request while one is still in flight [V]. Valve doesn’t say what a non-2xx response does, beyond counting the request as failed. If an endpoint never sees a previously or added block, the game is probably treating every request as failed [V].
auth [V]
Optional. Each field in the config’s auth block is sent to the endpoint as a JSON string field, so the endpoint can check where the payload came from. Valve recommends https when you use it. Open.
output [V]
Optional. Sets how many digits after the decimal point the game sends: precision_time for durations such as countdowns and lifetimes, precision_position for positions, and precision_vector for vectors such as velocity and forward direction.
data Components
Each component turns on one part of the payload. Valve’s list [V]:
| Component | What it adds | Who gets it |
|---|---|---|
provider | The client sending the payload | Everyone |
map | Mode, map, phase, and score | Everyone |
map_round_wins | How each round so far was won | Everyone |
round | Round phase, bomb state, round winner | Everyone |
player_id | Name, SteamID, clan tag, observer slot, team | Everyone |
player_state | Health, armor, flashes, kills this round, and so on | Everyone |
player_weapons | Equipped weapons, ammo, and weapon state | Everyone |
player_match_stats | Kills, assists, deaths, MVPs, score | Everyone |
player_position | Position and forward direction of the spectated player | Observers only |
allplayers_id, allplayers_state, allplayers_match_stats, allplayers_weapons, allplayers_position | The player_* data for every player | Observers only |
bomb | Where the bomb is, who’s carrying it, whether it’s dropped | Observers only |
phase_countdowns | Time left in the current phase, and which phase | Observers only |
allgrenades | Every grenade’s owner, position, velocity, type, lifetime, and effect time | Observers only |
An observer is a client that’s spectating a match, watching GOTV, or watching a demo. A player in a match gets nothing from the observer-only components, which means no bomb timer and no data on other players [V].
2. The Payload
Each request is an HTTP POST with a JSON body. It holds the full current state of every component in the config, plus two blocks computed against the last payload that got a 2xx response [V]:
previouslyholds the old values of the data that changed.addedholds the root fields that are in the new state but weren’t in the old one.
A component with no data at the moment is left out [C]. In the main menu, for example, a payload has provider and a player with only steamid, name, and activity. During warmup, there’s a map but no round [C].
provider [C]
| Field | Type | Seen in CS2 |
|---|---|---|
name | string | "Counter-Strike: Global Offensive", unchanged in CS2 |
appid | int | 730 |
version | int | 14141 |
steamid | string | The SteamID64 of the client that sent the payload. It stays the same while the player spectates someone else. |
timestamp | int | Unix time in seconds |
map [C]
| Field | Type | Seen in CS2 |
|---|---|---|
mode | string | competitive. Other modes are open. |
name | string | de_dust2 |
phase | string | warmup, live, gameover. Valve also lists intermission, for halftime [V], which is open. |
round | int | The number of rounds already finished. It’s 0 in the first round and goes up as soon as a round’s phase becomes over. At gameover it equals the total rounds played. |
num_matches_to_win_series | int | 0 |
team_ct, team_t | object | See below |
round_wins | object | Only with map_round_wins. The keys are round numbers starting at "1". |
Each team object has these fields:
| Field | Type | Seen in CS2 |
|---|---|---|
score | int | Rounds won |
name | string | "CounterTerrorists", "Terrorists" |
flag | string | A country code, such as "us" or "de" |
consecutive_round_losses | int | |
timeouts_remaining | int | 1 |
matches_won_this_series | int | 0 |
name and flag are strings, and the other team fields are ints. The community-server payload has the same shape and types as the practice-match ones [C].
The round_wins values seen so far are ct_win_elimination, t_win_elimination, and t_win_bomb. Other win conditions, such as a defuse or the timer running out, are open.
round [C]
| Field | Type | Seen in CS2 |
|---|---|---|
phase | string | freezetime, live, over |
bomb | string | planted, exploded. Left out until the bomb is planted. Valve also lists defused [V], which is open. |
win_team | string | CT or T. Present once the phase is over. |
player [C]
After the player dies, CS2 fills player with the data of the teammate they’re spectating, while provider.steamid stays theirs. The only way to tell is to compare player.steamid with provider.steamid [C]. Bots have short IDs such as "503", not SteamID64s [C].
| Field | Type | Seen in CS2 |
|---|---|---|
steamid | string | |
name | string | |
observer_slot | int | Present for the local player as well as a spectated teammate, such as 5 and 9. |
team | string | T. CT hasn’t been captured in this field yet, though it appears in round.win_team. |
activity | string | playing, menu. [B] adds textinput, for the console, which is open. |
clan | string | The clan tag [V]. Open. |
player.state, with player_state:
| Field | Type | Seen in CS2 |
|---|---|---|
health | int | 0 to 100 |
armor | int | 0 seen |
helmet | bool | false seen |
flashed | int | 0 seen. How flashed the player is. |
smoked | int | 0 seen. How far inside a smoke the player is. |
burning | int | 0 seen. How much the player is burning. |
money | int | |
round_kills | int | Kills this round |
round_killhs | int | Headshot kills this round |
equip_value | int | The value of everything the player has |
Ranges for flashed, smoked, and burning aren’t in Valve’s page and haven’t been measured yet.
player.weapons, with player_weapons, is an object with the keys weapon_0, weapon_1, and so on. Each weapon has:
| Field | Type | Seen in CS2 |
|---|---|---|
name | string | weapon_ak47, weapon_deagle, weapon_glock, weapon_knife_t, weapon_c4, weapon_smokegrenade |
paintkit | string | The skin’s internal name, such as cu_desert_eagle_corroden, or default |
type | string | Rifle, Pistol, Knife, Grenade, C4 |
state | string | active, holstered, reloading |
ammo_clip | int | Rounds in the magazine. Left out for knives, grenades, and the C4. |
ammo_clip_max | int | Magazine size, left out in the same cases. |
ammo_reserve | int | Reserve ammo. A grenade has this field and nothing else about ammo. |
player.match_stats, with player_match_stats: kills, assists, deaths, mvps, score, all ints.
Observer-Only Blocks
Valve names these blocks and what they contain, but none of them has been captured from CS2, so their exact fields aren’t known yet [V]:
allplayers: theplayer_*data for every player.bomb: the bomb’s position, its carrier, and whether it’s dropped.phase_countdowns: the time left in the current phase and which phase it is.grenades, fromallgrenades: each grenade’s owner, position, velocity, type, lifetime, and effect time.
3. Behavior
- Snapshots, not events. Every payload is the full state, so events have to be worked out by comparing payloads, or from
previouslyandadded[V]. - One request at a time. The game waits for each response before it sends the next request, so a slow endpoint delays every update after it [V].
- Spectating after death. Once the player dies,
playerswitches to the teammate they’re watching, andproviderdoesn’t change [C]. - Round counter.
map.roundgoes up as soon as a round isover, not when the next round starts [C]. - No kill feed. No component says who killed whom, or with what [V].
4. Open Items
These need a captured payload, or a test against a real client, before the spec can state them. Where other GSI implementations expect something, it’s listed as a lead.
Protocol
- Non-2xx responses. Valve says a failed request makes the next one send the full state, but not whether the game slows down or stops after repeated failures. pygsi always answers
200to be safe. heartbeatdefault. Valve gives none. [B]: 30 s.- The shape of
previouslyandadded. Valve describes them in words only, and the captured payloads had them stripped. [B]:previouslymirrors the payload’s nesting with only the changed fields, such as{"player": {"state": {"flashed": 24}}}, andaddedmarks each new key withtrue, such as{"player": {"clan": true}}. authin the payload. [B]: the config’sauthfields arrive as strings, and the key doesn’t have to betoken.- A provider-only config. [B]: a change to
provider.timestampalone doesn’t trigger a request, so such a config only gets heartbeats.
Values Not Yet Seen
map.mode. Onlycompetitiveis captured. [B]:casual,deathmatch,gungameprogressive,scrimcomp2v2. Leads for CS2:wingmanin place ofscrimcomp2v2,custom,workshop,new_user_training,retakes,survival.map.phase. [V][B]:intermissionduring halftime.round.bomb. [V][B]:defused.round.phase. Onlyfreezetime,live, andoverare captured. [B]:freezetimealso covers team timeouts.round_wins. Onlyct_win_elimination,t_win_elimination, andt_win_bombare captured. [B]:ct_win_defuse,ct_win_time. Leads:ct_win_rescue,t_win_time.player.team. OnlyTis captured in this field. [B]:TorCT.player.activity. [B]:textinputwhile the console is open. It describes the client itself, even while spectating.- Weapon
type. [B]:SniperRifle,Submachine Gun. Leads:Shotgun, a machine gun type, and types for the Zeus, fists, melee weapons, and tablets. - Ranges. [B]:
flashed,smoked, andburningrun from0to255, andburningis255while on fire and then counts down after leaving it.moneyruns up to16000in competitive. player.observer_slot. [B] numbers the slots 1 to 9, then 0, and says the field only appears while spectating. The captured payloads have it for the local player too, so the second part doesn’t hold for CS2.
Fields Not Yet Seen
player.clan[V]. [B]: left out when the player has no clan tag.player.state. pygsi’s first version modeledround_totaldmganddefusekit, and removed both because CS2 never sent them in real runs (commitd72d174) [C]. Those runs may not have included a CT with a kit, sodefusekitcould still appear then. Lead:health_c4_preview.player.xpoverload. A lead only.map. [B]:current_spectatorsandsouvenirs_total.tournamentdraft. A lead only: a block with pick and ban details for tournaments.- Observer-only blocks. [B] has examples of these:
bombhasstate(carried,dropped,planting,planted,defusing,defused, and, per Valve’s round values,exploded),position,player(the SteamID64 of whoever carries, plants, or defuses it), andcountdown.countdownis the time to finish planting whileplanting, the time to explode whileplanted, and the time to finish defusing whiledefusing.phase_countdownshasphase(the round phases plusbomb,defuse, andwarmup) andphase_ends_in.player.spectarget,player.position, andplayer.forwardcome withplayer_position.- Positions and vectors are
"x, y, z"strings, and countdowns are strings such as"39.8". - Leads:
allplayerskeyed by SteamID64, each value shaped likeplayer, andgrenadeskeyed by ID, withowner,position,velocity,lifetime,type,effecttime, andflames.
Behavior
- Death and spectating. Is the first payload after a death always the player’s own data with
health0, or can it already show the teammate? pygsi’s death event depends on the first case. - The
gameoverpayload while spectating. The capturedgameoverpayload has noplayerblock, so it’s unclear whether one can show a teammate.
To close most of these, run a capture session with every component on and save each raw payload, previously and added included. It should cover a competitive match through halftime, a defuse, and a round lost on time. It should include a round as CT with a kit, armor, and a helmet, and a game in casual, deathmatch, and wingman. Finally, it should include spectating a demo, for the observer-only blocks.