# bohemiainteractive/cwr architecture

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

- Interactive diagram: https://gitdiagram.com/bohemiainteractive/cwr
- Repository: https://github.com/bohemiainteractive/cwr

## Overview

#### Purpose and build shape
This is the C++20 remastered engine/game source for Arma: Cold War Assault, centered on the Poseidon runtime. CMake is the top-level build system; Clang presets target Windows x64 and Linux x64. Game assets are external and must be supplied at runtime. Key build roots: `CMakeLists.txt`, `engine/Poseidon/CMakeLists.txt`, `vcpkg.json`.

#### Executable entry points
The primary client and dedicated-server applications wrap the shared engine:
- Client: `apps/cwr/Game/WinMain.cpp`, `apps/cwr/Game/GameApplication.cpp`
- Dedicated server: `apps/cwr/Server/ServerMain.cpp`, `apps/cwr/Server/ServerApplication.cpp`
- Demo client variant: `apps/cwr/GameDemo/GameDemoApplication.cpp`
Other executables expose engine capabilities: evaluator CLI (`apps/tools/Evaluator/Cli/main.cpp`), Studio asset browser (`apps/tools/Studio/main.cpp`), and format/tool commands (`apps/tools/Tools/main.cpp`).

#### Runtime orchestration, game, and scripting
Platform/application startup establishes global runtime state, configuration, modules, and frame lifecycle. The game loop drives world/UI/network progression; game commands expose behavior to mission scripts.
- `engine/Poseidon/Core/Application.cpp`
- `engine/Poseidon/Core/Game/GameLoop.cpp`
- `engine/Poseidon/Game/Commands/GameStateExt.cpp`
- `engine/Evaluator/EvalState.cpp`
- `engine/Evaluator/SqsRunner.cpp`

Control flow is broadly: application startup → config/profile/mod resolution → mission/world loading → per-frame input, simulation/AI/network, render/audio/UI → orderly shutdown.

#### Content and persistence boundary
The asset layer mounts loose files and packed addon archives, parses legacy configuration and binary formats, and makes models, terrain, audio, and mission content available to runtime systems. Mod selection/install is a core boundary between external game data and engine state.
- `engine/Poseidon/Asset/Addon/AddonSystem.cpp`
- `engine/Poseidon/IO/PackFiles.cpp`
- `engine/Poseidon/IO/ParamFile/ParamFile.cpp`
- `engine/Poseidon/Core/ModSystem.cpp`
- `engine/Poseidon/World/Terrain/WrpReader.cpp`

#### World simulation and presentation
World owns scenes, terrain, entities, animation, collision, and AI; it produces scene inputs for rendering. The graphics abstraction separates engine-facing rendering from the OpenGL 3.3 backend. Input is SDL-oriented, while audio uses interfaces with OpenAL production implementation and dummy/text alternatives.
- `engine/Poseidon/World/World.cpp`
- `engine/Poseidon/World/Simulation/Simul.cpp`
- `engine/Poseidon/AI/AICenter.cpp`
- `engine/Poseidon/Graphics/Rendering/Frame/BuildFrame.cpp`
- `engine/PoseidonGL33/GraphicsBackendGL33.cpp`
- `engine/PoseidonOpenAL/SoundSystemOAL.cpp`

#### Multiplayer and external services
Networking implements legacy and newer transport/session paths, client/server game replication, mission/custom-asset transfer, authentication, moderation, and voice routing. Clients browse and servers publish through the master-server protocol/service. Voice travels through network transport and Opus/OpenAL capture-playback components.
- `engine/Poseidon/Network/Network.cpp`
- `engine/Poseidon/Network/NetTransportNet.cpp`
- `engine/Poseidon/Network/MasterServerServiceClient.cpp`
- `engine/Poseidon/Audio/Voice/VonTransport.cpp`
- `mserver/MasterService/src/main.rs`

The master service is a separate Rust HTTP service with browser web assets; related Rust crates provide client protocol and PBO/archive support: `mserver/Client/src/lib.rs`, `mserver/Archive/src/lib.rs`.

#### Automation and deployment
Trident is a Rust harness that launches/coordinates game instances and scripted integration, multi-client, and stress scenarios. Docker includes master-service and Steam-runtime build images.
- `engine/Trident/src/main.rs`
- `engine/Trident/src/scenarios/integration.rs`
- `docker/papa-bear-master-service/Dockerfile`
- `docker/steamrt4/Dockerfile`

Main entry points: [`engine/Poseidon/Core/Application.cpp`](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Application.cpp) (Application lifecycle), [`engine/Poseidon/Core/Game/GameLoop.cpp`](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Game/GameLoop.cpp) (Game loop), [`engine/Poseidon/World/World.cpp`](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/World/World.cpp) (World simulation), [`CMakeLists.txt`](https://github.com/bohemiainteractive/cwr/blob/main/CMakeLists.txt) (CMake build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; delivery"]
  node_cmake["CMake build<br/>build system<br/>[CMakeLists.txt]"]
end

subgraph group_apps["Applications"]
  node_client["Game client<br/>client executable"]
  node_server["Dedicated server<br/>server executable"]
  node_demo["Demo client<br/>client variant"]
  node_tools["Engine tools<br/>CLI and Studio apps<br/>[main.cpp]"]
end

subgraph group_runtime["Poseidon runtime"]
  node_application["Application lifecycle<br/>runtime bootstrap<br/>[Application.cpp]"]
  node_game_loop["Game loop<br/>frame orchestration<br/>[GameLoop.cpp]"]
  node_scripts["Mission scripting<br/>evaluator and SQS<br/>[EvalState.cpp]"]
  node_content["Content &amp; mods<br/>asset boundary<br/>[AddonSystem.cpp]"]
  node_legacy_formats["Legacy format readers<br/>archive/config/world IO<br/>[PackFiles.cpp]"]
  node_world["World simulation<br/>scene and gameplay<br/>[World.cpp]"]
  node_ai["AI center<br/>AI subsystem<br/>[AICenter.cpp]"]
  node_render["Rendering pipeline<br/>frame builder + GL33<br/>[BuildFrame.cpp]"]
  node_audio["Audio &amp; voice<br/>OpenAL subsystem<br/>[SoundSystemOAL.cpp]"]
  node_network["Game networking<br/>transport and replication<br/>[Network.cpp]"]
end

subgraph group_services["Online services"]
  node_master{{"Master service<br/>Rust HTTP service<br/>[main.rs]"}}
  node_rust_support["Master client &amp; archive crates<br/>Rust libraries<br/>[lib.rs]"]
end

subgraph group_automation["Automation"]
  node_trident["Trident harness<br/>Rust scenario runner<br/>[main.rs]"]
  node_docker["Container images<br/>deployment images"]
end

node_cmake -->|"builds"| node_client
node_cmake -->|"builds"| node_server
node_cmake -->|"builds"| node_demo
node_cmake -->|"builds"| node_tools
node_client -->|"starts"| node_application
node_server -->|"starts"| node_application
node_demo -->|"starts"| node_application
node_tools -->|"uses engine"| node_application
node_application -->|"resolves config, profiles, mods"| node_content
node_application -->|"runs"| node_game_loop
node_content -->|"loads through"| node_legacy_formats
node_legacy_formats -->|"supplies missions and terrain"| node_world
node_game_loop -->|"executes"| node_scripts
node_scripts -->|"controls"| node_world
node_game_loop -->|"advances"| node_world
node_world -->|"coordinates"| node_ai
node_world -->|"produces scene inputs"| node_render
node_game_loop -->|"updates"| node_audio
node_game_loop -->|"updates"| node_network
node_network -->|"routes voice"| node_audio
node_network -->|"browse and publish"| node_master
node_master -->|"uses protocol/archive support"| node_rust_support
node_trident -.->|"launches"| node_client
node_trident -.->|"coordinates"| node_server
node_docker -->|"packages"| node_master

click node_cmake "https://github.com/bohemiainteractive/cwr/blob/main/CMakeLists.txt"
click node_client "https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/Game/GameApplication.cpp"
click node_server "https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/Server/ServerApplication.cpp"
click node_demo "https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/GameDemo/GameDemoApplication.cpp"
click node_tools "https://github.com/bohemiainteractive/cwr/blob/main/apps/tools/Tools/main.cpp"
click node_application "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Application.cpp"
click node_game_loop "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Game/GameLoop.cpp"
click node_scripts "https://github.com/bohemiainteractive/cwr/blob/main/engine/Evaluator/EvalState.cpp"
click node_content "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Asset/Addon/AddonSystem.cpp"
click node_legacy_formats "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/IO/PackFiles.cpp"
click node_world "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/World/World.cpp"
click node_ai "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/AI/AICenter.cpp"
click node_render "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Graphics/Rendering/Frame/BuildFrame.cpp"
click node_audio "https://github.com/bohemiainteractive/cwr/blob/main/engine/PoseidonOpenAL/SoundSystemOAL.cpp"
click node_network "https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Network/Network.cpp"
click node_master "https://github.com/bohemiainteractive/cwr/blob/main/mserver/MasterService/src/main.rs"
click node_rust_support "https://github.com/bohemiainteractive/cwr/blob/main/mserver/Client/src/lib.rs"
click node_trident "https://github.com/bohemiainteractive/cwr/blob/main/engine/Trident/src/main.rs"
click node_docker "https://github.com/bohemiainteractive/cwr/blob/main/docker/papa-bear-master-service/Dockerfile"

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_cmake toneBlue
class node_client,node_server,node_demo,node_tools toneAmber
class node_application,node_game_loop,node_scripts,node_content,node_legacy_formats,node_world,node_ai,node_render,node_audio,node_network toneMint
class node_master,node_rust_support toneRose
class node_trident,node_docker toneIndigo
```

## Components

### Build & delivery

- [CMake build](https://github.com/bohemiainteractive/cwr/blob/main/CMakeLists.txt): build system · Builds C++20 engine, applications, and platform targets. · `CMakeLists.txt`

### Applications

- [Game client](https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/Game/GameApplication.cpp): client executable · `apps/cwr/Game/GameApplication.cpp`
- [Dedicated server](https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/Server/ServerApplication.cpp): server executable · `apps/cwr/Server/ServerApplication.cpp`
- [Demo client](https://github.com/bohemiainteractive/cwr/blob/main/apps/cwr/GameDemo/GameDemoApplication.cpp): client variant · `apps/cwr/GameDemo/GameDemoApplication.cpp`
- [Engine tools](https://github.com/bohemiainteractive/cwr/blob/main/apps/tools/Tools/main.cpp): CLI and Studio apps · Evaluator, Studio, and format-tool executables expose engine capabilities. · `apps/tools/Tools/main.cpp`

### Poseidon runtime

- [Application lifecycle](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Application.cpp): runtime bootstrap · Establishes global state, configuration, modules, and shutdown. · `engine/Poseidon/Core/Application.cpp`
- [Game loop](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Core/Game/GameLoop.cpp): frame orchestration · Advances input, simulation, networking, presentation, and UI each frame. · `engine/Poseidon/Core/Game/GameLoop.cpp`
- [Mission scripting](https://github.com/bohemiainteractive/cwr/blob/main/engine/Evaluator/EvalState.cpp): evaluator and SQS · Game commands and evaluator state expose gameplay to mission scripts. · `engine/Evaluator/EvalState.cpp`
- [Content & mods](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Asset/Addon/AddonSystem.cpp): asset boundary · Mounts external loose/addon data and resolves profiles and selected mods. · `engine/Poseidon/Asset/Addon/AddonSystem.cpp`
- [Legacy format readers](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/IO/PackFiles.cpp): archive/config/world IO · Reads packed archives, parameter files, and terrain formats. · `engine/Poseidon/IO/PackFiles.cpp`
- [World simulation](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/World/World.cpp): scene and gameplay · Owns terrain, entities, collision, animation, AI, and simulation. · `engine/Poseidon/World/World.cpp`
- [AI center](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/AI/AICenter.cpp): AI subsystem · `engine/Poseidon/AI/AICenter.cpp`
- [Rendering pipeline](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Graphics/Rendering/Frame/BuildFrame.cpp): frame builder + GL33 · Builds scene frames through an engine-facing graphics abstraction. · `engine/Poseidon/Graphics/Rendering/Frame/BuildFrame.cpp`
- [Audio & voice](https://github.com/bohemiainteractive/cwr/blob/main/engine/PoseidonOpenAL/SoundSystemOAL.cpp): OpenAL subsystem · Provides sound output plus voice capture/playback and routing. · `engine/PoseidonOpenAL/SoundSystemOAL.cpp`
- [Game networking](https://github.com/bohemiainteractive/cwr/blob/main/engine/Poseidon/Network/Network.cpp): transport and replication · Supports legacy/new transport, sessions, replication, transfers, and moderation. · `engine/Poseidon/Network/Network.cpp`

### Online services

- [Master service](https://github.com/bohemiainteractive/cwr/blob/main/mserver/MasterService/src/main.rs): Rust HTTP service · Provides server publishing and client browsing protocol endpoints. · `mserver/MasterService/src/main.rs`
- [Master client & archive crates](https://github.com/bohemiainteractive/cwr/blob/main/mserver/Client/src/lib.rs): Rust libraries · Supply master protocol and PBO/archive support. · `mserver/Client/src/lib.rs`

### Automation

- [Trident harness](https://github.com/bohemiainteractive/cwr/blob/main/engine/Trident/src/main.rs): Rust scenario runner · Launches and coordinates integration, multi-client, and stress runs. · `engine/Trident/src/main.rs`
- [Container images](https://github.com/bohemiainteractive/cwr/blob/main/docker/papa-bear-master-service/Dockerfile): deployment images · Builds master-service and Steam-runtime environments. · `docker/papa-bear-master-service/Dockerfile`

## Connections

- CMake build → Game client: builds
- CMake build → Dedicated server: builds
- CMake build → Demo client: builds
- CMake build → Engine tools: builds
- Game client → Application lifecycle: starts
- Dedicated server → Application lifecycle: starts
- Demo client → Application lifecycle: starts
- Engine tools → Application lifecycle: uses engine
- Application lifecycle → Content & mods: resolves config, profiles, mods
- Application lifecycle → Game loop: runs
- Content & mods → Legacy format readers: loads through
- Legacy format readers → World simulation: supplies missions and terrain
- Game loop → Mission scripting: executes
- Mission scripting → World simulation: controls
- Game loop → World simulation: advances
- World simulation → AI center: coordinates
- World simulation → Rendering pipeline: produces scene inputs
- Game loop → Audio & voice: updates
- Game loop → Game networking: updates
- Game networking → Audio & voice: routes voice
- Game networking → Master service: browse and publish
- Master service → Master client & archive crates: uses protocol/archive support
- Trident harness → Game client: launches
- Trident harness → Dedicated server: coordinates
- Container images → Master service: packages
