# antonpup/counterstrike2gsi architecture

> Architecture diagram of the GitHub repository antonpup/counterstrike2gsi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/antonpup/counterstrike2gsi
- Repository: https://github.com/antonpup/counterstrike2gsi

## Overview

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: [`CounterStrike2GSI/EventDispatcher.cs`](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventDispatcher.cs) (Event dispatcher), [`CounterStrike2GSI/GameStateListener.cs`](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameStateListener.cs) (HTTP listener), [`CounterStrike2GSI/GameState.cs`](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameState.cs) (Game state), [`CounterStrike2GSI/CS2GSIFile.cs`](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/CS2GSIFile.cs) (GSI config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Ingress and setup"]
  node_listener["HTTP listener"]
  node_config["GSI config<br/>[CS2GSIFile.cs]"]
  node_steam["Steam utilities<br/>[SteamUtils.cs]"]
end

subgraph group_state["Game state"]
  node_stateobj["Game state<br/>[GameState.cs]"]
  node_models["State models<br/>[Node.cs]"]
  node_othermodels["Other state nodes"]
end

subgraph group_events["Event processing"]
  node_statehandler["State change handler"]
  node_dispatcher["Event dispatcher<br/>[EventDispatcher.cs]"]
  node_messages["Event messages<br/>[CS2GameEvent.cs]"]
  node_player["Player events<br/>[PlayerHandler.cs]"]
  node_map["Map and round events<br/>[MapHandler.cs]"]
  node_bomb["Bomb events<br/>[BombHandler.cs]"]
  node_killfeed["Killfeed events<br/>[KillfeedHandler.cs]"]
  node_otherhandlers["Other state handlers"]
end

subgraph group_api["Application API"]
  node_facade["Events interface<br/>[EventsInterface.cs]"]
end

node_game(("CS2 game"))
node_app(("Application callbacks"))

node_game -->|"sends POSTs"| node_listener
node_listener -->|"parses updates"| node_stateobj
node_listener -->|"offers snapshots"| node_statehandler
node_statehandler -->|"broadcasts changes"| node_dispatcher
node_statehandler -->|"caches previous"| node_stateobj
node_stateobj -->|"contains state"| node_models
node_dispatcher -->|"dispatches updates"| node_player
node_dispatcher -->|"dispatches updates"| node_map
node_dispatcher -->|"dispatches updates"| node_bomb
node_dispatcher -->|"dispatches updates"| node_killfeed
node_dispatcher -->|"dispatches updates"| node_otherhandlers
node_player -->|"broadcasts events"| node_dispatcher
node_map -->|"broadcasts events"| node_dispatcher
node_bomb -->|"broadcasts events"| node_dispatcher
node_killfeed -->|"broadcasts events"| node_dispatcher
node_otherhandlers -->|"broadcasts events"| node_dispatcher
node_dispatcher -->|"broadcasts typed events"| node_messages
node_facade -->|"exposes events"| node_dispatcher
node_app -->|"subscribes"| node_facade
node_app -->|"starts listener"| node_listener
node_app -->|"requests generation"| node_config
node_config -->|"locates game"| node_steam
node_config -->|"writes game config"| node_game
node_stateobj -->|"represents domains"| node_othermodels

click node_listener "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameStateListener.cs"
click node_config "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/CS2GSIFile.cs"
click node_steam "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/Utils/SteamUtils.cs"
click node_facade "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventsInterface.cs"
click node_stateobj "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameState.cs"
click node_models "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/Nodes/Node.cs"
click node_statehandler "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameStateHandler.cs"
click node_dispatcher "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventDispatcher.cs"
click node_messages "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventMessages/CS2GameEvent.cs"
click node_player "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/PlayerHandler.cs"
click node_map "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/MapHandler.cs"
click node_bomb "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/BombHandler.cs"
click node_killfeed "https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/KillfeedHandler.cs"
click node_otherhandlers "https://github.com/antonpup/counterstrike2gsi/tree/master/CounterStrike2GSI/StateHandlers"
click node_othermodels "https://github.com/antonpup/counterstrike2gsi/tree/master/CounterStrike2GSI/Nodes"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_listener,node_config,node_steam toneBlue
class node_stateobj,node_models,node_othermodels toneAmber
class node_statehandler,node_dispatcher,node_messages,node_player,node_map,node_bomb,node_killfeed,node_otherhandlers toneMint
class node_facade toneRose
class node_game,node_app toneIndigo
```

## Components

### Ingress and setup

- [HTTP listener](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameStateListener.cs): `CounterStrike2GSI/GameStateListener.cs`
- [GSI config](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/CS2GSIFile.cs): `CounterStrike2GSI/CS2GSIFile.cs`
- [Steam utilities](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/Utils/SteamUtils.cs): `CounterStrike2GSI/Utils/SteamUtils.cs`

### Game state

- [Game state](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameState.cs): `CounterStrike2GSI/GameState.cs`
- [State models](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/Nodes/Node.cs): `CounterStrike2GSI/Nodes/Node.cs`
- [Other state nodes](https://github.com/antonpup/counterstrike2gsi/tree/master/CounterStrike2GSI/Nodes): `CounterStrike2GSI/Nodes`

### Event processing

- [State change handler](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/GameStateHandler.cs): `CounterStrike2GSI/GameStateHandler.cs`
- [Event dispatcher](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventDispatcher.cs): `CounterStrike2GSI/EventDispatcher.cs`
- [Event messages](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventMessages/CS2GameEvent.cs): `CounterStrike2GSI/EventMessages/CS2GameEvent.cs`
- [Player events](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/PlayerHandler.cs): `CounterStrike2GSI/StateHandlers/PlayerHandler.cs`
- [Map and round events](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/MapHandler.cs): `CounterStrike2GSI/StateHandlers/MapHandler.cs`
- [Bomb events](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/BombHandler.cs): `CounterStrike2GSI/StateHandlers/BombHandler.cs`
- [Killfeed events](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/StateHandlers/KillfeedHandler.cs): `CounterStrike2GSI/StateHandlers/KillfeedHandler.cs`
- [Other state handlers](https://github.com/antonpup/counterstrike2gsi/tree/master/CounterStrike2GSI/StateHandlers): `CounterStrike2GSI/StateHandlers`

### Application API

- [Events interface](https://github.com/antonpup/counterstrike2gsi/blob/master/CounterStrike2GSI/EventsInterface.cs): `CounterStrike2GSI/EventsInterface.cs`

### Other components

- **CS2 game**
- **Application callbacks**

## Connections

- 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
