# yvt/openspades architecture

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

- Interactive diagram: https://gitdiagram.com/yvt/openspades
- Repository: https://github.com/yvt/openspades

## Overview

OpenSpades is a cross-platform Ace of Spades 0.75 client. The principal workflow is launching the game, connecting to a compatible server, receiving map and gameplay updates, updating the client world, and presenting the game through rendering, audio, and UI. Its runtime also includes game modes and an AngelScript extension layer. The graph reflects the README and the supplied source index/excerpts; several UI, renderer, audio, and scripting links are not directly evidenced in the sampled code, so those connections are omitted or marked unverified.

Main entry points: [`Sources/Client/Client.h`](https://github.com/yvt/openspades/blob/master/Sources/Client/Client.h) (Client runtime), [`Sources/Client/NetClient.cpp`](https://github.com/yvt/openspades/blob/master/Sources/Client/NetClient.cpp) (Network client), [`Sources/Client/World.h`](https://github.com/yvt/openspades/blob/master/Sources/Client/World.h) (Game world), [`Sources/Client/Client_Update.cpp`](https://github.com/yvt/openspades/blob/master/Sources/Client/Client_Update.cpp) (Client updates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and UI"]
  node_main["Game startup<br/>[Main.cpp]"]
  node_screens["Game screens<br/>[MainScreen.cpp]"]
end

subgraph group_network["Networking and world"]
  node_client["Client runtime<br/>[Client.h]"]
  node_net["Network client<br/>[NetClient.cpp]"]
end

subgraph group_gameplay["Gameplay"]
  node_world["Game world<br/>[World.h]"]
  node_map["Voxel map<br/>[GameMap.h]"]
  node_player["Player simulation<br/>[Player.h]"]
  node_modes["Game modes<br/>[IGameMode.h]"]
  node_gameplay_update["Client updates<br/>[Client_Update.cpp]"]
end

subgraph group_presentation["Presentation"]
  node_player_view["Player presentation<br/>[ClientPlayer.cpp]"]
  node_renderer["Renderer interface<br/>[IRenderer.h]"]
  node_gl["OpenGL renderer"]
  node_framebuffers["Framebuffers"]
  node_audio["Audio devices<br/>[ALDevice.cpp]"]
end

subgraph group_scripting["Scripting"]
  node_scripts["Script manager<br/>[ScriptManager.h]"]
  node_bindings["Script bindings"]
end

node_user(("Player"))
node_server(("Game server"))

node_user -->|"launches"| node_main
node_main -->|"opens"| node_screens
node_user -.->|"uses"| node_screens
node_client -.->|"owns"| node_net
node_net -->|"connects"| node_server
node_net -->|"updates"| node_world
node_net -->|"loads"| node_map
node_world -->|"uses"| node_map
node_world -.->|"simulates"| node_player
node_net -->|"updates mode"| node_modes
node_client -->|"updates"| node_gameplay_update
node_gameplay_update -->|"reads state"| node_world
node_gameplay_update -.->|"updates"| node_player
node_client -.->|"renders player"| node_player_view
node_player_view -->|"requests rendering"| node_renderer
node_renderer -.->|"uses backend"| node_gl
node_gl -.->|"allocates buffers"| node_framebuffers
node_client -.->|"uses audio"| node_audio
node_client -.->|"uses scripting"| node_scripts
node_scripts -.->|"registers"| node_bindings

click node_main "https://github.com/yvt/openspades/blob/master/Sources/Gui/Main.cpp"
click node_screens "https://github.com/yvt/openspades/blob/master/Sources/Gui/MainScreen.cpp"
click node_client "https://github.com/yvt/openspades/blob/master/Sources/Client/Client.h"
click node_net "https://github.com/yvt/openspades/blob/master/Sources/Client/NetClient.cpp"
click node_world "https://github.com/yvt/openspades/blob/master/Sources/Client/World.h"
click node_map "https://github.com/yvt/openspades/blob/master/Sources/Client/GameMap.h"
click node_player "https://github.com/yvt/openspades/blob/master/Sources/Client/Player.h"
click node_modes "https://github.com/yvt/openspades/blob/master/Sources/Client/IGameMode.h"
click node_gameplay_update "https://github.com/yvt/openspades/blob/master/Sources/Client/Client_Update.cpp"
click node_player_view "https://github.com/yvt/openspades/blob/master/Sources/Client/ClientPlayer.cpp"
click node_renderer "https://github.com/yvt/openspades/blob/master/Sources/Client/IRenderer.h"
click node_gl "https://github.com/yvt/openspades/blob/master/Sources/Draw/GLProgramManager.cpp"
click node_framebuffers "https://github.com/yvt/openspades/blob/master/Sources/Draw/GLFramebufferManager.cpp"
click node_audio "https://github.com/yvt/openspades/blob/master/Sources/Audio/ALDevice.cpp"
click node_scripts "https://github.com/yvt/openspades/blob/master/Sources/ScriptBindings/ScriptManager.h"
click node_bindings "https://github.com/yvt/openspades/tree/master/Sources/ScriptBindings"

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_main,node_screens toneBlue
class node_client,node_net toneAmber
class node_world,node_map,node_player,node_modes,node_gameplay_update,node_server toneMint
class node_player_view,node_renderer,node_gl,node_framebuffers,node_audio toneRose
class node_scripts,node_bindings,node_user toneIndigo
```

## Components

### Launch and UI

- [Game startup](https://github.com/yvt/openspades/blob/master/Sources/Gui/Main.cpp): `Sources/Gui/Main.cpp`
- [Game screens](https://github.com/yvt/openspades/blob/master/Sources/Gui/MainScreen.cpp): `Sources/Gui/MainScreen.cpp`

### Networking and world

- [Client runtime](https://github.com/yvt/openspades/blob/master/Sources/Client/Client.h): `Sources/Client/Client.h`
- [Network client](https://github.com/yvt/openspades/blob/master/Sources/Client/NetClient.cpp): `Sources/Client/NetClient.cpp`

### Gameplay

- [Game world](https://github.com/yvt/openspades/blob/master/Sources/Client/World.h): `Sources/Client/World.h`
- [Voxel map](https://github.com/yvt/openspades/blob/master/Sources/Client/GameMap.h): `Sources/Client/GameMap.h`
- [Player simulation](https://github.com/yvt/openspades/blob/master/Sources/Client/Player.h): `Sources/Client/Player.h`
- [Game modes](https://github.com/yvt/openspades/blob/master/Sources/Client/IGameMode.h): `Sources/Client/IGameMode.h`
- [Client updates](https://github.com/yvt/openspades/blob/master/Sources/Client/Client_Update.cpp): `Sources/Client/Client_Update.cpp`

### Presentation

- [Player presentation](https://github.com/yvt/openspades/blob/master/Sources/Client/ClientPlayer.cpp): `Sources/Client/ClientPlayer.cpp`
- [Renderer interface](https://github.com/yvt/openspades/blob/master/Sources/Client/IRenderer.h): `Sources/Client/IRenderer.h`
- [OpenGL renderer](https://github.com/yvt/openspades/blob/master/Sources/Draw/GLProgramManager.cpp): `Sources/Draw/GLProgramManager.cpp`
- [Framebuffers](https://github.com/yvt/openspades/blob/master/Sources/Draw/GLFramebufferManager.cpp): `Sources/Draw/GLFramebufferManager.cpp`
- [Audio devices](https://github.com/yvt/openspades/blob/master/Sources/Audio/ALDevice.cpp): `Sources/Audio/ALDevice.cpp`

### Scripting

- [Script manager](https://github.com/yvt/openspades/blob/master/Sources/ScriptBindings/ScriptManager.h): `Sources/ScriptBindings/ScriptManager.h`
- [Script bindings](https://github.com/yvt/openspades/tree/master/Sources/ScriptBindings): `Sources/ScriptBindings`

### Other components

- **Player**
- **Game server**

## Connections

- Player → Game startup: launches (evidence: `Sources/Gui/Main.cpp`)
- Game startup → Game screens: opens (evidence: `Sources/Gui/Main.cpp`)
- Player → Game screens: uses
- Client runtime → Network client: owns (evidence: `Sources/Client/NetClient.cpp`)
- Network client → Game server: connects
- Network client → Game world: updates (evidence: `Sources/Client/NetClient.cpp`)
- Network client → Voxel map: loads (evidence: `Sources/Client/NetClient.cpp`)
- Game world → Voxel map: uses (evidence: `Sources/Client/World.h`)
- Game world → Player simulation: simulates
- Network client → Game modes: updates mode (evidence: `Sources/Client/NetClient.cpp`)
- Client runtime → Client updates: updates (evidence: `Sources/Client/Client_Update.cpp`)
- Client updates → Game world: reads state (evidence: `Sources/Client/Client_Update.cpp`)
- Client updates → Player simulation: updates
- Client runtime → Player presentation: renders player (evidence: `Sources/Client/ClientPlayer.cpp`)
- Player presentation → Renderer interface: requests rendering (evidence: `Sources/Client/ClientPlayer.cpp`)
- Renderer interface → OpenGL renderer: uses backend
- OpenGL renderer → Framebuffers: allocates buffers
- Client runtime → Audio devices: uses audio
- Client runtime → Script manager: uses scripting
- Script manager → Script bindings: registers (evidence: `Sources/ScriptBindings/ScriptManager.cpp`)
