# openxray/xray-16 architecture

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

- Interactive diagram: https://gitdiagram.com/openxray/xray-16
- Repository: https://github.com/openxray/xray-16

## Overview

OpenXRay is a cross-platform, 64-bit-capable reimplementation of the X-Ray engine for supported S.T.A.L.K.E.R. games. The player-facing runtime begins with engine initialization and game/level execution; the broader engine includes rendering, scripting, AI/navigation, physics, sound, UI, and persistence. The graph preserves these documented product areas and major indexed modules. Many subsystem implementations were not sampled, so uncertain runtime links are shown as unverified rather than asserted as source-proven calls.

Main entry points: [`src/xrGame/Level.h`](https://github.com/openxray/xray-16/blob/dev/src/xrGame/Level.h) (Level runtime), [`src/xrEngine/Engine.cpp`](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/Engine.cpp) (Engine runtime), [`src/xrEngine/IGame_Persistent.h`](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/IGame_Persistent.h) (Game lifecycle), [`src/xrGame/wallmark_manager.cpp`](https://github.com/openxray/xray-16/blob/dev/src/xrGame/wallmark_manager.cpp) (Wallmark management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and game"]
  node_engine["Engine runtime<br/>[Engine.cpp]"]
  node_engine_api["Engine API<br/>[EngineAPI.cpp]"]
  node_persistent["Game lifecycle<br/>[IGame_Persistent.h]"]
  node_level["Level runtime<br/>[Level.h]"]
  node_alife["ALife persistence"]
  node_multiplayer["Multiplayer networking"]
end

subgraph group_graphics["Rendering and presentation"]
  node_render["Renderer selection<br/>[EngineAPI.cpp]"]
  node_wallmark_render["Wallmark rendering"]
  node_wallmark_game["Wallmark management"]
  node_shaders["Rendering shaders"]
end

subgraph group_simulation["World simulation"]
  node_ai_navigation["AI navigation"]
  node_physics["Physics"]
  node_collision["Collision database"]
  node_sound["Sound system"]
  node_game_materials["Game materials<br/>[GameMtlLib.h]"]
end

subgraph group_extension["Scripting and tools"]
  node_script_engine["Script engine<br/>[script_engine.cpp]"]
  node_script_bindings["Script bindings<br/>[ScriptExporter.hpp]"]
  node_weather_editor["Weather editor<br/>[engine_impl.cpp]"]
  node_ui["UI core"]
end

node_player(("Player"))

node_player -.->|"starts game"| node_engine
node_engine -.->|"initializes API"| node_engine_api
node_engine -.->|"runs lifecycle"| node_persistent
node_persistent -.->|"manages level"| node_level
node_level -.->|"saves state"| node_alife
node_engine_api -->|"selects renderer"| node_render
node_wallmark_game -->|"reads level"| node_level
node_wallmark_game -->|"uses materials"| node_game_materials
node_wallmark_game -->|"uses geometry"| node_physics
node_render -.->|"renders marks"| node_wallmark_render
node_render -.->|"uses shaders"| node_shaders
node_level -->|"network state"| node_multiplayer
node_level -->|"uses lifecycle"| node_persistent
node_level -.->|"uses navigation"| node_ai_navigation
node_level -.->|"uses physics"| node_physics
node_level -.->|"uses sound"| node_sound
node_script_engine -->|"loads bindings"| node_script_bindings
node_weather_editor -->|"accesses environment"| node_persistent
node_engine -->|"uses console"| node_ui
node_collision -.->|"supports collision"| node_physics

click node_engine "https://github.com/openxray/xray-16/blob/dev/src/xrEngine/Engine.cpp"
click node_engine_api "https://github.com/openxray/xray-16/blob/dev/src/xrEngine/EngineAPI.cpp"
click node_persistent "https://github.com/openxray/xray-16/blob/dev/src/xrEngine/IGame_Persistent.h"
click node_level "https://github.com/openxray/xray-16/blob/dev/src/xrGame/Level.h"
click node_alife "https://github.com/openxray/xray-16/blob/dev/src/xrGame/alife_storage_manager.cpp"
click node_render "https://github.com/openxray/xray-16/blob/dev/src/xrEngine/EngineAPI.cpp"
click node_wallmark_render "https://github.com/openxray/xray-16/blob/dev/src/Layers/xrRender/WallmarksEngine.cpp"
click node_wallmark_game "https://github.com/openxray/xray-16/blob/dev/src/xrGame/wallmark_manager.cpp"
click node_shaders "https://github.com/openxray/xray-16/tree/dev/res/gamedata/shaders"
click node_ai_navigation "https://github.com/openxray/xray-16/tree/dev/src/xrAICore/Navigation"
click node_physics "https://github.com/openxray/xray-16/tree/dev/src/xrPhysics"
click node_collision "https://github.com/openxray/xray-16/tree/dev/src/xrCDB"
click node_sound "https://github.com/openxray/xray-16/tree/dev/src/xrSound"
click node_script_engine "https://github.com/openxray/xray-16/blob/dev/src/xrScriptEngine/script_engine.cpp"
click node_script_bindings "https://github.com/openxray/xray-16/blob/dev/src/xrScriptEngine/ScriptExporter.hpp"
click node_weather_editor "https://github.com/openxray/xray-16/blob/dev/src/editors/xrWeatherEngine/engine_impl.cpp"
click node_game_materials "https://github.com/openxray/xray-16/blob/dev/src/xrMaterialSystem/GameMtlLib.h"
click node_ui "https://github.com/openxray/xray-16/tree/dev/src/xrUICore"
click node_multiplayer "https://github.com/openxray/xray-16/tree/dev/src/xrNetServer"

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_engine,node_engine_api,node_persistent,node_level,node_alife,node_multiplayer toneBlue
class node_render,node_wallmark_render,node_wallmark_game,node_shaders toneAmber
class node_ai_navigation,node_physics,node_collision,node_sound,node_game_materials toneMint
class node_script_engine,node_script_bindings,node_weather_editor,node_ui toneRose
class node_player toneIndigo
```

## Components

### Runtime and game

- [Engine runtime](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/Engine.cpp): `src/xrEngine/Engine.cpp`
- [Engine API](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/EngineAPI.cpp): `src/xrEngine/EngineAPI.cpp`
- [Game lifecycle](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/IGame_Persistent.h): `src/xrEngine/IGame_Persistent.h`
- [Level runtime](https://github.com/openxray/xray-16/blob/dev/src/xrGame/Level.h): `src/xrGame/Level.h`
- [ALife persistence](https://github.com/openxray/xray-16/blob/dev/src/xrGame/alife_storage_manager.cpp): `src/xrGame/alife_storage_manager.cpp`
- [Multiplayer networking](https://github.com/openxray/xray-16/tree/dev/src/xrNetServer): `src/xrNetServer`

### Rendering and presentation

- [Renderer selection](https://github.com/openxray/xray-16/blob/dev/src/xrEngine/EngineAPI.cpp): `src/xrEngine/EngineAPI.cpp`
- [Wallmark rendering](https://github.com/openxray/xray-16/blob/dev/src/Layers/xrRender/WallmarksEngine.cpp): `src/Layers/xrRender/WallmarksEngine.cpp`
- [Wallmark management](https://github.com/openxray/xray-16/blob/dev/src/xrGame/wallmark_manager.cpp): `src/xrGame/wallmark_manager.cpp`
- [Rendering shaders](https://github.com/openxray/xray-16/tree/dev/res/gamedata/shaders): `res/gamedata/shaders`

### World simulation

- [AI navigation](https://github.com/openxray/xray-16/tree/dev/src/xrAICore/Navigation): `src/xrAICore/Navigation`
- [Physics](https://github.com/openxray/xray-16/tree/dev/src/xrPhysics): `src/xrPhysics`
- [Collision database](https://github.com/openxray/xray-16/tree/dev/src/xrCDB): `src/xrCDB`
- [Sound system](https://github.com/openxray/xray-16/tree/dev/src/xrSound): `src/xrSound`
- [Game materials](https://github.com/openxray/xray-16/blob/dev/src/xrMaterialSystem/GameMtlLib.h): `src/xrMaterialSystem/GameMtlLib.h`

### Scripting and tools

- [Script engine](https://github.com/openxray/xray-16/blob/dev/src/xrScriptEngine/script_engine.cpp): `src/xrScriptEngine/script_engine.cpp`
- [Script bindings](https://github.com/openxray/xray-16/blob/dev/src/xrScriptEngine/ScriptExporter.hpp): `src/xrScriptEngine/ScriptExporter.hpp`
- [Weather editor](https://github.com/openxray/xray-16/blob/dev/src/editors/xrWeatherEngine/engine_impl.cpp): `src/editors/xrWeatherEngine/engine_impl.cpp`
- [UI core](https://github.com/openxray/xray-16/tree/dev/src/xrUICore): `src/xrUICore`

### Other components

- **Player**

## Connections

- Player → Engine runtime: starts game
- Engine runtime → Engine API: initializes API
- Engine runtime → Game lifecycle: runs lifecycle
- Game lifecycle → Level runtime: manages level (evidence: `src/xrGame/Level.h`)
- Level runtime → ALife persistence: saves state (evidence: `src/xrGame/alife_storage_manager.cpp`)
- Engine API → Renderer selection: selects renderer (evidence: `src/xrEngine/EngineAPI.cpp`)
- Wallmark management → Level runtime: reads level (evidence: `src/xrGame/wallmark_manager.cpp`)
- Wallmark management → Game materials: uses materials (evidence: `src/xrGame/wallmark_manager.cpp`)
- Wallmark management → Physics: uses geometry (evidence: `src/xrGame/wallmark_manager.cpp`)
- Renderer selection → Wallmark rendering: renders marks
- Renderer selection → Rendering shaders: uses shaders
- Level runtime → Multiplayer networking: network state (evidence: `src/xrGame/Level.h`)
- Level runtime → Game lifecycle: uses lifecycle (evidence: `src/xrGame/Level.h`)
- Level runtime → AI navigation: uses navigation
- Level runtime → Physics: uses physics
- Level runtime → Sound system: uses sound
- Script engine → Script bindings: loads bindings
- Weather editor → Game lifecycle: accesses environment (evidence: `src/editors/xrWeatherEngine/engine_impl.cpp`)
- Engine runtime → UI core: uses console (evidence: `src/xrEngine/Engine.cpp`)
- Collision database → Physics: supports collision
