# beyond-all-reason/recoilengine architecture

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

- Interactive diagram: https://gitdiagram.com/beyond-all-reason/recoilengine
- Repository: https://github.com/beyond-all-reason/recoilengine

## Overview

Recoil is an open-source real-time strategy game engine. Its broad user workflow is to set up or join a game, run the simulation, and present the evolving world through rendering and player-facing controls; Lua and external skirmish AIs provide extension paths. The excerpts show selected links among pathfinding, map data, menus, and AI dispatch, but do not expose the main game loop or most simulation and networking wiring, so those relationships are not asserted as inspected calls.

Main entry points: [`rts/Game/Game.cpp`](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/Game.cpp) (Game runtime), [`rts/Game/GameSetup.cpp`](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameSetup.cpp) (Game setup), [`rts/Sim`](https://github.com/beyond-all-reason/recoilengine/tree/master/rts/Sim) (World simulation), [`rts/Sim/Path/QTPFS/PathManager.cpp`](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Sim/Path/QTPFS/PathManager.cpp) (Pathfinding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game runtime"]
  node_game_setup["Game setup<br/>[GameSetup.cpp]"]
  node_game_loop["Game runtime<br/>[Game.cpp]"]
  node_network["Game networking"]
end

subgraph group_world["World simulation"]
  node_simulation["World simulation"]
  node_map["Map data<br/>[MapInfo.h]"]
  node_pathfinding["Pathfinding<br/>[PathManager.cpp]"]
end

subgraph group_presentation["Player experience"]
  node_rendering["World rendering<br/>[GlobalRendering.h]"]
  node_camera["Camera control"]
  node_text_input["Game text input"]
  node_lua_menu["Lua menu"]
end

subgraph group_extensions["Scripting and AI"]
  node_lua_runtime["Lua engine API<br/>[LuaConstEngine.cpp]"]
  node_skirmish_dispatch["AI event dispatch"]
  node_ai_runtime["Skirmish AI runtime"]
  node_ai_interface["AI interface<br/>[Interface.cpp]"]
end

subgraph group_foundation["Runtime foundations"]
  node_config["Configuration<br/>[ConfigHandler.h]"]
  node_logging["Logging API<br/>[ILog.h]"]
  node_version["Engine version<br/>[GameVersion.h]"]
end

node_player(("Player or host"))

node_player -.->|"sets up"| node_game_setup
node_game_setup -.->|"starts game"| node_game_loop
node_game_loop -.->|"advances simulation"| node_simulation
node_game_loop -.->|"draws world"| node_rendering
node_player -.->|"joins game"| node_network
node_simulation -.->|"requests paths"| node_pathfinding
node_pathfinding -->|"reads map data"| node_map
node_camera -->|"queries terrain"| node_map
node_player -.->|"enters commands"| node_text_input
node_player -.->|"uses menu"| node_lua_menu
node_lua_menu -.->|"runs Lua"| node_lua_runtime
node_skirmish_dispatch -->|"dispatches events"| node_ai_runtime
node_ai_runtime -.->|"uses interface"| node_ai_interface
node_game_setup -.->|"reads settings"| node_config
node_lua_runtime -->|"exposes version"| node_version
node_game_loop -.->|"records events"| node_logging

click node_game_setup "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameSetup.cpp"
click node_game_loop "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/Game.cpp"
click node_network "https://github.com/beyond-all-reason/recoilengine/tree/master/rts/Net"
click node_simulation "https://github.com/beyond-all-reason/recoilengine/tree/master/rts/Sim"
click node_map "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Map/MapInfo.h"
click node_pathfinding "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Sim/Path/QTPFS/PathManager.cpp"
click node_rendering "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Rendering/GlobalRendering.h"
click node_camera "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/Camera/SpringController.cpp"
click node_text_input "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameControllerTextInput.cpp"
click node_lua_menu "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Menu/LuaMenuController.cpp"
click node_lua_runtime "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Lua/LuaConstEngine.cpp"
click node_skirmish_dispatch "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/ExternalAI/EngineOutHandler.cpp"
click node_ai_runtime "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/ExternalAI/SkirmishAIHandler.cpp"
click node_ai_interface "https://github.com/beyond-all-reason/recoilengine/blob/master/AI/Interfaces/C/src/Interface.cpp"
click node_config "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/System/Config/ConfigHandler.h"
click node_logging "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/System/Log/ILog.h"
click node_version "https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameVersion.h"

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_setup,node_game_loop,node_network toneBlue
class node_simulation,node_map,node_pathfinding toneAmber
class node_rendering,node_camera,node_text_input,node_lua_menu toneMint
class node_lua_runtime,node_skirmish_dispatch,node_ai_runtime,node_ai_interface toneRose
class node_config,node_logging,node_version,node_player toneIndigo
```

## Components

### Game runtime

- [Game setup](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameSetup.cpp): `rts/Game/GameSetup.cpp`
- [Game runtime](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/Game.cpp): `rts/Game/Game.cpp`
- [Game networking](https://github.com/beyond-all-reason/recoilengine/tree/master/rts/Net): `rts/Net`

### World simulation

- [World simulation](https://github.com/beyond-all-reason/recoilengine/tree/master/rts/Sim): `rts/Sim`
- [Map data](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Map/MapInfo.h): `rts/Map/MapInfo.h`
- [Pathfinding](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Sim/Path/QTPFS/PathManager.cpp): `rts/Sim/Path/QTPFS/PathManager.cpp`

### Player experience

- [World rendering](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Rendering/GlobalRendering.h): `rts/Rendering/GlobalRendering.h`
- [Camera control](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/Camera/SpringController.cpp): `rts/Game/Camera/SpringController.cpp`
- [Game text input](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameControllerTextInput.cpp): `rts/Game/GameControllerTextInput.cpp`
- [Lua menu](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Menu/LuaMenuController.cpp): `rts/Menu/LuaMenuController.cpp`

### Scripting and AI

- [Lua engine API](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Lua/LuaConstEngine.cpp): `rts/Lua/LuaConstEngine.cpp`
- [AI event dispatch](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/ExternalAI/EngineOutHandler.cpp): `rts/ExternalAI/EngineOutHandler.cpp`
- [Skirmish AI runtime](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/ExternalAI/SkirmishAIHandler.cpp): `rts/ExternalAI/SkirmishAIHandler.cpp`
- [AI interface](https://github.com/beyond-all-reason/recoilengine/blob/master/AI/Interfaces/C/src/Interface.cpp): `AI/Interfaces/C/src/Interface.cpp`

### Runtime foundations

- [Configuration](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/System/Config/ConfigHandler.h): `rts/System/Config/ConfigHandler.h`
- [Logging API](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/System/Log/ILog.h): `rts/System/Log/ILog.h`
- [Engine version](https://github.com/beyond-all-reason/recoilengine/blob/master/rts/Game/GameVersion.h): `rts/Game/GameVersion.h`

### Other components

- **Player or host**

## Connections

- Player or host → Game setup: sets up
- Game setup → Game runtime: starts game
- Game runtime → World simulation: advances simulation
- Game runtime → World rendering: draws world
- Player or host → Game networking: joins game
- World simulation → Pathfinding: requests paths (evidence: `rts/Sim/Path/QTPFS/PathManager.cpp`)
- Pathfinding → Map data: reads map data (evidence: `rts/Sim/Path/QTPFS/PathManager.cpp`)
- Camera control → Map data: queries terrain (evidence: `rts/Game/Camera/SpringController.cpp`)
- Player or host → Game text input: enters commands
- Player or host → Lua menu: uses menu
- Lua menu → Lua engine API: runs Lua
- AI event dispatch → Skirmish AI runtime: dispatches events (evidence: `rts/ExternalAI/EngineOutHandler.cpp`)
- Skirmish AI runtime → AI interface: uses interface
- Game setup → Configuration: reads settings
- Lua engine API → Engine version: exposes version (evidence: `rts/Lua/LuaConstEngine.cpp`)
- Game runtime → Logging API: records events
