How antonpup/counterstrike2gsi works
CounterStrike2GSI is a C# library that receives Counter-Strike 2 Game State Integration updates and exposes both full state snapshots and granular change events. The main workflow is game HTTP POSTs → listener/state parsing → change detection → event dispatch → application callbacks. The graph also includes configuration generation and the documented player, map/round, bomb, killfeed, grenade, and countdown event branches. README documents the workflow; unsampled subsystem wiring is shown only where the documented behavior or sampled dispatcher code supports it.
Main entry points: EventDispatcher.cs Event dispatcher · GameStateListener.cs HTTP listener · GameState.cs Game state · CS2GSIFile.cs GSI config
Components 17
Ingress and setup
- HTTP listener
CounterStrike2GSI/GameStateListener.cs - GSI config
CounterStrike2GSI/CS2GSIFile.cs - Steam utilities
CounterStrike2GSI/Utils/SteamUtils.cs
Game state
- Game state
CounterStrike2GSI/GameState.cs - State models
CounterStrike2GSI/Nodes/Node.cs - Other state nodes
CounterStrike2GSI/Nodes
Event processing
- State change handler
CounterStrike2GSI/GameStateHandler.cs - Event dispatcher
CounterStrike2GSI/EventDispatcher.cs - Event messages
CounterStrike2GSI/EventMessages/CS2GameEvent.cs - Player events
CounterStrike2GSI/StateHandlers/PlayerHandler.cs - Map and round events
CounterStrike2GSI/StateHandlers/MapHandler.cs - Bomb events
CounterStrike2GSI/StateHandlers/BombHandler.cs - Killfeed events
CounterStrike2GSI/StateHandlers/KillfeedHandler.cs - Other state handlers
CounterStrike2GSI/StateHandlers
Application API
- Events interface
CounterStrike2GSI/EventsInterface.cs
Other components
- CS2 game
- Application callbacks
Connections 24
- CS2 game → HTTP listener: sends POSTs
- HTTP listener → Game state: parses updates
- HTTP listener → State change handler: offers snapshots
- State change handler → Event dispatcher: broadcasts changes
- State change handler → Game state: caches previous
- Game state → State models: contains state
- Event dispatcher → Player events: dispatches updates
- Event dispatcher → Map and round events: dispatches updates
- Event dispatcher → Bomb events: dispatches updates
- Event dispatcher → Killfeed events: dispatches updates
- Event dispatcher → Other state handlers: dispatches updates
- Player events → Event dispatcher: broadcasts events
- Map and round events → Event dispatcher: broadcasts events
- Bomb events → Event dispatcher: broadcasts events
- Killfeed events → Event dispatcher: broadcasts events
- Other state handlers → Event dispatcher: broadcasts events
- Event dispatcher → Event messages: broadcasts typed events
- Events interface → Event dispatcher: exposes events
- Application callbacks → Events interface: subscribes
- Application callbacks → HTTP listener: starts listener
- Application callbacks → GSI config: requests generation
- GSI config → Steam utilities: locates game
- GSI config → CS2 game: writes game config
- Game state → Other state nodes: represents domains