# fbraz3/generalsx architecture

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

- Interactive diagram: https://gitdiagram.com/fbraz3/generalsx
- Repository: https://github.com/fbraz3/generalsx

## Overview

GeneralsX is a cross-platform engine and game runtime for Command & Conquer: Generals and Zero Hour, with desktop multiplayer and a Zero Hour browser single-player option. The principal workflow is player input through the platform client into simulation, with rendering and audio presenting the result; campaign, skirmish, replay, and multiplayer are major modes. The graph reflects documented capabilities and the sampled entry points. Several subsystem links are dashed where the excerpts establish architecture but not the exact runtime call path.

Main entry points: [`Generals/Code/GameEngine/Source/Common/GameEngine.cpp`](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Source/Common/GameEngine.cpp) (Game Engine), [`Core/GameEngine/Source/GameClient/ClientInstance.cpp`](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/GameClient/ClientInstance.cpp) (Game Client), [`Generals/Code/GameEngine/Include/GameLogic/GameLogic.h`](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h) (Simulation Logic), [`Core/GameEngine/Source/Common/Audio/GameAudio.cpp`](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/Common/Audio/GameAudio.cpp) (Game Audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_game_engine["Game Engine<br/>[GameEngine.cpp]"]
  node_game_logic["Simulation Logic<br/>[GameLogic.h]"]
  node_script_engine["Script Engine<br/>[ScriptEngine.cpp]"]
  node_global_state["Game State<br/>[GlobalData.h]"]
  node_messages["Game Messages<br/>[MessageStream.h]"]
  node_asset_files["Asset Filesystem<br/>[FileSystem.h]"]
  node_file_io["File I/O<br/>[file.h]"]
end

subgraph group_presentation["Client Presentation"]
  node_game_client["Game Client<br/>[ClientInstance.cpp]"]
  node_shell["Game Shell<br/>[Shell.h]"]
  node_view["Game View<br/>[View.h]"]
  node_audio["Game Audio<br/>[GameAudio.cpp]"]
end

subgraph group_services["Persistence And Network"]
  node_replay["Replay Simulation"]
  node_network["Network Connections"]
  node_online["GeneralsOnline"]
  node_persistent_storage["Persistent Storage"]
end

subgraph group_platforms["Platform And Browser"]
  node_sdl_engine["SDL3 Platform<br/>[SDL3GameEngine.cpp]"]
  node_win_engine["Windows Platform"]
  node_web_app["Browser Client<br/>[main.ts]"]
end

node_player(("Player"))
node_web_player(("Browser Player"))
node_game_data[("Original Game Data")]

node_player -.->|"plays through"| node_game_client
node_game_client -.->|"interacts with"| node_game_engine
node_game_engine -.->|"runs simulation"| node_game_logic
node_game_logic -.->|"executes scripts"| node_script_engine
node_game_engine -.->|"uses state"| node_global_state
node_game_client -.->|"sends commands"| node_messages
node_game_logic -.->|"dispatches messages"| node_messages
node_game_client -.->|"presents menus"| node_shell
node_game_client -.->|"presents view"| node_view
node_game_engine -->|"uses audio"| node_audio
node_game_engine -.->|"loads assets"| node_asset_files
node_asset_files -->|"uses file interface"| node_file_io
node_game_engine -.->|"supports replay"| node_replay
node_game_engine -.->|"supports multiplayer"| node_network
node_online -.->|"provides matchmaking"| node_network
node_game_engine -.->|"uses persistence"| node_persistent_storage
node_sdl_engine -->|"configures audio"| node_audio
node_win_engine -->|"selects audio device"| node_audio
node_player -->|"plays in browser"| node_web_app
node_web_app -->|"requires original data"| node_game_data

click node_game_engine "https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Source/Common/GameEngine.cpp"
click node_game_logic "https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h"
click node_script_engine "https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp"
click node_global_state "https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Include/Common/GlobalData.h"
click node_messages "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/MessageStream.h"
click node_game_client "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/GameClient/ClientInstance.cpp"
click node_shell "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/GameClient/Shell.h"
click node_view "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/GameClient/View.h"
click node_audio "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/Common/Audio/GameAudio.cpp"
click node_asset_files "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/FileSystem.h"
click node_file_io "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/file.h"
click node_replay "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/Common/ReplaySimulation.cpp"
click node_network "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp"
click node_sdl_engine "https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngineDevice/Source/SDL3GameEngine.cpp"
click node_win_engine "https://github.com/fbraz3/generalsx/blob/main/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp"
click node_web_app "https://github.com/fbraz3/generalsx/blob/main/web/src/main.ts"

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_game_engine,node_game_logic,node_script_engine,node_global_state,node_messages,node_asset_files,node_file_io,node_web_player toneBlue
class node_game_client,node_shell,node_view,node_audio,node_game_data toneAmber
class node_replay,node_network,node_online,node_persistent_storage toneMint
class node_sdl_engine,node_win_engine,node_web_app toneRose
class node_player toneIndigo
```

## Components

### Game Runtime

- [Game Engine](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Source/Common/GameEngine.cpp): `Generals/Code/GameEngine/Source/Common/GameEngine.cpp`
- [Simulation Logic](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h): `Generals/Code/GameEngine/Include/GameLogic/GameLogic.h`
- [Script Engine](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp): `Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp`
- [Game State](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngine/Include/Common/GlobalData.h): `Generals/Code/GameEngine/Include/Common/GlobalData.h`
- [Game Messages](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/MessageStream.h): `Core/GameEngine/Include/Common/MessageStream.h`
- [Asset Filesystem](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/FileSystem.h): `Core/GameEngine/Include/Common/FileSystem.h`
- [File I/O](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/Common/file.h): `Core/GameEngine/Include/Common/file.h`

### Client Presentation

- [Game Client](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/GameClient/ClientInstance.cpp): `Core/GameEngine/Source/GameClient/ClientInstance.cpp`
- [Game Shell](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/GameClient/Shell.h): `Core/GameEngine/Include/GameClient/Shell.h`
- [Game View](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Include/GameClient/View.h): `Core/GameEngine/Include/GameClient/View.h`
- [Game Audio](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/Common/Audio/GameAudio.cpp): `Core/GameEngine/Source/Common/Audio/GameAudio.cpp`

### Persistence And Network

- [Replay Simulation](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/Common/ReplaySimulation.cpp): `Core/GameEngine/Source/Common/ReplaySimulation.cpp`
- [Network Connections](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp): `Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp`
- **GeneralsOnline**
- **Persistent Storage**

### Platform And Browser

- [SDL3 Platform](https://github.com/fbraz3/generalsx/blob/main/Generals/Code/GameEngineDevice/Source/SDL3GameEngine.cpp): `Generals/Code/GameEngineDevice/Source/SDL3GameEngine.cpp`
- [Windows Platform](https://github.com/fbraz3/generalsx/blob/main/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp): `Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp`
- [Browser Client](https://github.com/fbraz3/generalsx/blob/main/web/src/main.ts): `web/src/main.ts`

### Other components

- **Player**
- **Browser Player**
- **Original Game Data**

## Connections

- Player → Game Client: plays through
- Game Client → Game Engine: interacts with
- Game Engine → Simulation Logic: runs simulation
- Simulation Logic → Script Engine: executes scripts (evidence: `Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp`)
- Game Engine → Game State: uses state (evidence: `Generals/Code/GameEngine/Source/Common/GameEngine.cpp`)
- Game Client → Game Messages: sends commands
- Simulation Logic → Game Messages: dispatches messages
- Game Client → Game Shell: presents menus
- Game Client → Game View: presents view
- Game Engine → Game Audio: uses audio (evidence: `Generals/Code/GameEngine/Source/Common/GameEngine.cpp`)
- Game Engine → Asset Filesystem: loads assets (evidence: `Generals/Code/GameEngine/Source/Common/GameEngine.cpp`)
- Asset Filesystem → File I/O: uses file interface (evidence: `Core/GameEngine/Include/Common/FileSystem.h`)
- Game Engine → Replay Simulation: supports replay
- Game Engine → Network Connections: supports multiplayer
- GeneralsOnline → Network Connections: provides matchmaking (evidence: `README.md`)
- Game Engine → Persistent Storage: uses persistence
- SDL3 Platform → Game Audio: configures audio (evidence: `Generals/Code/GameEngineDevice/Source/SDL3GameEngine.cpp`)
- Windows Platform → Game Audio: selects audio device
- Player → Browser Client: plays in browser (evidence: `README.md`)
- Browser Client → Original Game Data: requires original data (evidence: `README.md`)
