# qbic/cyb-engine architecture

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

- Interactive diagram: https://gitdiagram.com/qbic/cyb-engine
- Repository: https://github.com/qbic/cyb-engine

## Overview

cyb-engine is a modifiable 3D engine with a sample game. The principal documented workflow is game code using the high-level interface (HLI) and input, with HLI driving rendering and the editor; rendering relies on engine systems and graphics. The repository also includes scene/ECS, resource loading, model import, terrain tools, and profiling. Edges follow the README dependency graph or explicit source references; unsampled implementation details are not inferred.

Main entry points: [`engine/graphics/renderer.cpp`](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/renderer.cpp) (Renderer), [`engine/graphics/device.h`](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/device.h) (Graphics device API), [`engine/hli/application.cpp`](https://github.com/qbic/cyb-engine/blob/master/engine/hli/application.cpp) (Application loop), [`engine/systems/scene.cpp`](https://github.com/qbic/cyb-engine/blob/master/engine/systems/scene.cpp) (Scene and ECS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game entry"]
  node_game_code["Game logic<br/>[game.cpp]"]
  node_game_entry["Windows entry<br/>[main_windows.cpp]"]
end

subgraph group_hli["High-level interface"]
  node_application["Application loop<br/>[application.cpp]"]
  node_renderpath["3D render path<br/>[renderpath_3d.cpp]"]
  node_renderpath2d["2D render path<br/>[renderpath_2d.cpp]"]
  node_canvas["Canvas API<br/>[canvas.h]"]
end

subgraph group_editor["Editor tools"]
  node_editor_ui["Editor interface<br/>[editor.cpp]"]
  node_terrain["Terrain tools"]
  node_heightmap["Heightmap tools<br/>[heightmap.cpp]"]
  node_undo["Undo history<br/>[undo_manager.cpp]"]
end

subgraph group_runtime["Engine runtime"]
  node_input["Input handling<br/>[input.cpp]"]
  node_scene["Scene and ECS<br/>[scene.cpp]"]
  node_resources[("Resource loading")]
  node_events["Event system<br/>[event_system.h]"]
  node_jobs["Job system<br/>[job_system.cpp]"]
  node_profiler["Runtime profiler<br/>[profiler.cpp]"]
  node_model_import["Model import"]
  node_noise["Noise generation<br/>[noise.cpp]"]
  node_core_services["Core services<br/>[filesystem.cpp]"]
end

subgraph group_platform["Platform graphics"]
  node_renderer["Renderer<br/>[renderer.cpp]"]
  node_graphics_device["Graphics device API<br/>[device.h]"]
  node_vulkan["Vulkan backend<br/>[device_vulkan.cpp]"]
  node_display["Display<br/>[display.cpp]"]
  node_window["Windows client window<br/>[window_win32.cpp]"]
end

node_game_code -->|"uses HLI"| node_application
node_game_code -->|"uses input"| node_input
node_application -->|"drives rendering"| node_renderer
node_application -->|"integrates editor"| node_editor_ui
node_renderpath -.->|"uses renderer"| node_renderer
node_renderer -->|"uses scene"| node_scene
node_renderer -->|"uses events"| node_events
node_renderer -->|"uses profiling"| node_profiler
node_renderer -->|"uses resources"| node_resources
node_renderer -->|"uses device API"| node_graphics_device
node_graphics_device -->|"uses core types"| node_core_services
node_graphics_device -->|"uses display types"| node_display
node_vulkan -->|"implements API"| node_graphics_device
node_input -->|"uses core types"| node_core_services
node_scene -->|"uses renderer types"| node_renderer
node_scene -->|"uses serialization"| node_core_services
node_resources -->|"creates GPU assets"| node_graphics_device
node_undo -->|"uses scene"| node_scene
node_game_entry -->|"uses window API"| node_window
node_application -->|"owns window"| node_window
node_application -->|"owns device"| node_graphics_device

click node_game_code "https://github.com/qbic/cyb-engine/blob/master/game/game.cpp"
click node_game_entry "https://github.com/qbic/cyb-engine/blob/master/game/main_windows.cpp"
click node_application "https://github.com/qbic/cyb-engine/blob/master/engine/hli/application.cpp"
click node_renderpath "https://github.com/qbic/cyb-engine/blob/master/engine/hli/renderpath_3d.cpp"
click node_renderpath2d "https://github.com/qbic/cyb-engine/blob/master/engine/hli/renderpath_2d.cpp"
click node_canvas "https://github.com/qbic/cyb-engine/blob/master/engine/hli/canvas.h"
click node_editor_ui "https://github.com/qbic/cyb-engine/blob/master/engine/editor/editor.cpp"
click node_terrain "https://github.com/qbic/cyb-engine/blob/master/engine/editor/terrain_generator.cpp"
click node_heightmap "https://github.com/qbic/cyb-engine/blob/master/engine/editor/heightmap.cpp"
click node_undo "https://github.com/qbic/cyb-engine/blob/master/engine/editor/undo_manager.cpp"
click node_input "https://github.com/qbic/cyb-engine/blob/master/engine/input/input.cpp"
click node_scene "https://github.com/qbic/cyb-engine/blob/master/engine/systems/scene.cpp"
click node_resources "https://github.com/qbic/cyb-engine/blob/master/engine/systems/resource_manager.cpp"
click node_events "https://github.com/qbic/cyb-engine/blob/master/engine/systems/event_system.h"
click node_jobs "https://github.com/qbic/cyb-engine/blob/master/engine/systems/job_system.cpp"
click node_profiler "https://github.com/qbic/cyb-engine/blob/master/engine/systems/profiler.cpp"
click node_model_import "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/model_import_gltf.cpp"
click node_noise "https://github.com/qbic/cyb-engine/blob/master/engine/core/noise.cpp"
click node_core_services "https://github.com/qbic/cyb-engine/blob/master/engine/core/filesystem.cpp"
click node_renderer "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/renderer.cpp"
click node_graphics_device "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/device.h"
click node_vulkan "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/device_vulkan.cpp"
click node_display "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/display.cpp"
click node_window "https://github.com/qbic/cyb-engine/blob/master/engine/graphics/window_win32.cpp"

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_code,node_game_entry toneBlue
class node_application,node_renderpath,node_renderpath2d,node_canvas toneAmber
class node_editor_ui,node_terrain,node_heightmap,node_undo toneMint
class node_input,node_scene,node_resources,node_events,node_jobs,node_profiler,node_model_import,node_noise,node_core_services toneRose
class node_renderer,node_graphics_device,node_vulkan,node_display,node_window toneIndigo
```

## Components

### Game entry

- [Game logic](https://github.com/qbic/cyb-engine/blob/master/game/game.cpp): `game/game.cpp`
- [Windows entry](https://github.com/qbic/cyb-engine/blob/master/game/main_windows.cpp): `game/main_windows.cpp`

### High-level interface

- [Application loop](https://github.com/qbic/cyb-engine/blob/master/engine/hli/application.cpp): `engine/hli/application.cpp`
- [3D render path](https://github.com/qbic/cyb-engine/blob/master/engine/hli/renderpath_3d.cpp): `engine/hli/renderpath_3d.cpp`
- [2D render path](https://github.com/qbic/cyb-engine/blob/master/engine/hli/renderpath_2d.cpp): `engine/hli/renderpath_2d.cpp`
- [Canvas API](https://github.com/qbic/cyb-engine/blob/master/engine/hli/canvas.h): `engine/hli/canvas.h`

### Editor tools

- [Editor interface](https://github.com/qbic/cyb-engine/blob/master/engine/editor/editor.cpp): `engine/editor/editor.cpp`
- [Terrain tools](https://github.com/qbic/cyb-engine/blob/master/engine/editor/terrain_generator.cpp): `engine/editor/terrain_generator.cpp`
- [Heightmap tools](https://github.com/qbic/cyb-engine/blob/master/engine/editor/heightmap.cpp): `engine/editor/heightmap.cpp`
- [Undo history](https://github.com/qbic/cyb-engine/blob/master/engine/editor/undo_manager.cpp): `engine/editor/undo_manager.cpp`

### Engine runtime

- [Input handling](https://github.com/qbic/cyb-engine/blob/master/engine/input/input.cpp): `engine/input/input.cpp`
- [Scene and ECS](https://github.com/qbic/cyb-engine/blob/master/engine/systems/scene.cpp): `engine/systems/scene.cpp`
- [Resource loading](https://github.com/qbic/cyb-engine/blob/master/engine/systems/resource_manager.cpp): `engine/systems/resource_manager.cpp`
- [Event system](https://github.com/qbic/cyb-engine/blob/master/engine/systems/event_system.h): `engine/systems/event_system.h`
- [Job system](https://github.com/qbic/cyb-engine/blob/master/engine/systems/job_system.cpp): `engine/systems/job_system.cpp`
- [Runtime profiler](https://github.com/qbic/cyb-engine/blob/master/engine/systems/profiler.cpp): `engine/systems/profiler.cpp`
- [Model import](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/model_import_gltf.cpp): `engine/graphics/model_import_gltf.cpp`
- [Noise generation](https://github.com/qbic/cyb-engine/blob/master/engine/core/noise.cpp): `engine/core/noise.cpp`
- [Core services](https://github.com/qbic/cyb-engine/blob/master/engine/core/filesystem.cpp): `engine/core/filesystem.cpp`

### Platform graphics

- [Renderer](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/renderer.cpp): `engine/graphics/renderer.cpp`
- [Graphics device API](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/device.h): `engine/graphics/device.h`
- [Vulkan backend](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/device_vulkan.cpp): `engine/graphics/device_vulkan.cpp`
- [Display](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/display.cpp): `engine/graphics/display.cpp`
- [Windows client window](https://github.com/qbic/cyb-engine/blob/master/engine/graphics/window_win32.cpp): `engine/graphics/window_win32.cpp`

## Connections

- Game logic → Application loop: uses HLI
- Game logic → Input handling: uses input
- Application loop → Renderer: drives rendering
- Application loop → Editor interface: integrates editor
- 3D render path → Renderer: uses renderer
- Renderer → Scene and ECS: uses scene (evidence: `engine/graphics/renderer.cpp`)
- Renderer → Event system: uses events (evidence: `engine/graphics/renderer.cpp`)
- Renderer → Runtime profiler: uses profiling (evidence: `engine/graphics/renderer.cpp`)
- Renderer → Resource loading: uses resources
- Renderer → Graphics device API: uses device API
- Graphics device API → Core services: uses core types (evidence: `engine/graphics/device.h`)
- Graphics device API → Display: uses display types (evidence: `engine/graphics/device.h`)
- Vulkan backend → Graphics device API: implements API
- Input handling → Core services: uses core types
- Scene and ECS → Renderer: uses renderer types
- Scene and ECS → Core services: uses serialization
- Resource loading → Graphics device API: creates GPU assets (evidence: `engine/systems/resource_manager.cpp`)
- Undo history → Scene and ECS: uses scene
- Windows entry → Windows client window: uses window API (evidence: `game/main_windows.cpp`)
- Application loop → Windows client window: owns window
- Application loop → Graphics device API: owns device
