# bubu2001/antiworld architecture

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

- Interactive diagram: https://gitdiagram.com/bubu2001/antiworld
- Repository: https://github.com/bubu2001/antiworld

## Overview

AntiWorld is a C++20 3D tribal-development simulator. The runtime workflow starts at the application loop: camera/input and player control drive simulation while nearby world chunks are generated, equipped with physics and ECS entities, then rendered. The world branch includes terrain, climate, biome coloring and a separately generated world map; rendering also supports chunk LOD and culling. README documents tribal AI, but the tree lists no AI implementation source, so its internal flow is not shown. Several subsystem links reflect README documentation because their caller code was not sampled.

Main entry points: [`src/main.cpp`](https://github.com/bubu2001/antiworld/blob/main/src/main.cpp) (Runtime Loop), [`src/world/chunk_manager.cpp`](https://github.com/bubu2001/antiworld/blob/main/src/world/chunk_manager.cpp) (Chunk Streaming), [`src/ecs/world.cpp`](https://github.com/bubu2001/antiworld/blob/main/src/ecs/world.cpp) (ECS World), [`src/renderer/vulkan_base.cpp`](https://github.com/bubu2001/antiworld/blob/main/src/renderer/vulkan_base.cpp) (Vulkan Runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Runtime Loop<br/>[main.cpp]"]
  node_window["Window<br/>[window.cpp]"]
  node_input["Input<br/>[input.h]"]
  node_camera["Camera<br/>[camera.h]"]
  node_floating["Floating Origin"]
end

subgraph group_world["World Generation"]
  node_worldmap["World Map<br/>[world_map.cpp]"]
  node_chunks["Chunk Streaming<br/>[chunk_manager.cpp]"]
  node_terrain["Terrain Generator"]
  node_climate["Climate<br/>[climate.cpp]"]
  node_biomes["Biome Sampling<br/>[biome.cpp]"]
  node_pool["Worker Pool<br/>[thread_pool.cpp]"]
end

subgraph group_simulation["Simulation"]
  node_ecs["ECS World<br/>[world.cpp]"]
  node_systems["ECS Systems<br/>[systems.cpp]"]
  node_controller["Player Controller"]
  node_physics["Physics World<br/>[physics_world.cpp]"]
end

subgraph group_render["Rendering"]
  node_vulkan["Vulkan Runtime<br/>[vulkan_base.cpp]"]
  node_pipeline["Graphics Pipeline<br/>[pipeline.cpp]"]
  node_lod["Chunk LOD<br/>[lod_manager.cpp]"]
end

subgraph group_characters["Characters and AI"]
  node_character["Character Mesh<br/>[character_mesh.cpp]"]
  node_animation["Animation<br/>[animation.cpp]"]
  node_tribal_ai["Tribal AI"]
end

node_player(("Player"))

node_player -->|"uses"| node_window
node_player -->|"provides input"| node_input
node_main -->|"creates"| node_window
node_main -->|"initializes"| node_vulkan
node_main -->|"starts"| node_worldmap
node_main -->|"updates"| node_chunks
node_main -->|"runs"| node_ecs
node_input -->|"drives"| node_controller
node_camera -->|"provides direction"| node_controller
node_controller -->|"sets velocity"| node_physics
node_main -->|"steps"| node_physics
node_main -->|"updates"| node_camera
node_camera -->|"uses origin"| node_floating
node_chunks -->|"dispatches generation"| node_pool
node_chunks -->|"generates chunks"| node_terrain
node_terrain -->|"samples climate"| node_climate
node_terrain -->|"samples biomes"| node_biomes
node_chunks -->|"creates shapes"| node_physics
node_chunks -->|"creates entities"| node_ecs
node_chunks -->|"uploads meshes"| node_vulkan
node_ecs -->|"updates"| node_systems
node_ecs -->|"provides frame environment"| node_vulkan
node_vulkan -->|"draws with"| node_pipeline
node_chunks -->|"builds chunk levels"| node_lod
node_main -->|"spawns agents"| node_character
node_character -->|"uses"| node_animation

click node_main "https://github.com/bubu2001/antiworld/blob/main/src/main.cpp"
click node_window "https://github.com/bubu2001/antiworld/blob/main/src/core/window.cpp"
click node_input "https://github.com/bubu2001/antiworld/blob/main/src/core/input.h"
click node_camera "https://github.com/bubu2001/antiworld/blob/main/src/core/camera.h"
click node_floating "https://github.com/bubu2001/antiworld/blob/main/src/core/floating_origin.cpp"
click node_worldmap "https://github.com/bubu2001/antiworld/blob/main/src/world/world_map.cpp"
click node_chunks "https://github.com/bubu2001/antiworld/blob/main/src/world/chunk_manager.cpp"
click node_terrain "https://github.com/bubu2001/antiworld/blob/main/src/world/terrain_generator.cpp"
click node_climate "https://github.com/bubu2001/antiworld/blob/main/src/world/climate.cpp"
click node_biomes "https://github.com/bubu2001/antiworld/blob/main/src/world/biome.cpp"
click node_pool "https://github.com/bubu2001/antiworld/blob/main/src/world/thread_pool.cpp"
click node_ecs "https://github.com/bubu2001/antiworld/blob/main/src/ecs/world.cpp"
click node_systems "https://github.com/bubu2001/antiworld/blob/main/src/ecs/systems.cpp"
click node_controller "https://github.com/bubu2001/antiworld/blob/main/src/physics/player_controller.cpp"
click node_physics "https://github.com/bubu2001/antiworld/blob/main/src/physics/physics_world.cpp"
click node_vulkan "https://github.com/bubu2001/antiworld/blob/main/src/renderer/vulkan_base.cpp"
click node_pipeline "https://github.com/bubu2001/antiworld/blob/main/src/renderer/pipeline.cpp"
click node_lod "https://github.com/bubu2001/antiworld/blob/main/src/renderer/lod_manager.cpp"
click node_character "https://github.com/bubu2001/antiworld/blob/main/src/character/character_mesh.cpp"
click node_animation "https://github.com/bubu2001/antiworld/blob/main/src/character/animation.cpp"
click node_tribal_ai "https://github.com/bubu2001/antiworld/tree/main/src/ai"

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_window,node_input,node_camera,node_floating toneBlue
class node_worldmap,node_chunks,node_terrain,node_climate,node_biomes,node_pool toneAmber
class node_ecs,node_systems,node_controller,node_physics toneMint
class node_vulkan,node_pipeline,node_lod toneRose
class node_character,node_animation,node_tribal_ai,node_player toneIndigo
```

## Components

### Application

- [Runtime Loop](https://github.com/bubu2001/antiworld/blob/main/src/main.cpp): `src/main.cpp`
- [Window](https://github.com/bubu2001/antiworld/blob/main/src/core/window.cpp): `src/core/window.cpp`
- [Input](https://github.com/bubu2001/antiworld/blob/main/src/core/input.h): `src/core/input.h`
- [Camera](https://github.com/bubu2001/antiworld/blob/main/src/core/camera.h): `src/core/camera.h`
- [Floating Origin](https://github.com/bubu2001/antiworld/blob/main/src/core/floating_origin.cpp): `src/core/floating_origin.cpp`

### World Generation

- [World Map](https://github.com/bubu2001/antiworld/blob/main/src/world/world_map.cpp): `src/world/world_map.cpp`
- [Chunk Streaming](https://github.com/bubu2001/antiworld/blob/main/src/world/chunk_manager.cpp): `src/world/chunk_manager.cpp`
- [Terrain Generator](https://github.com/bubu2001/antiworld/blob/main/src/world/terrain_generator.cpp): `src/world/terrain_generator.cpp`
- [Climate](https://github.com/bubu2001/antiworld/blob/main/src/world/climate.cpp): `src/world/climate.cpp`
- [Biome Sampling](https://github.com/bubu2001/antiworld/blob/main/src/world/biome.cpp): `src/world/biome.cpp`
- [Worker Pool](https://github.com/bubu2001/antiworld/blob/main/src/world/thread_pool.cpp): `src/world/thread_pool.cpp`

### Simulation

- [ECS World](https://github.com/bubu2001/antiworld/blob/main/src/ecs/world.cpp): `src/ecs/world.cpp`
- [ECS Systems](https://github.com/bubu2001/antiworld/blob/main/src/ecs/systems.cpp): `src/ecs/systems.cpp`
- [Player Controller](https://github.com/bubu2001/antiworld/blob/main/src/physics/player_controller.cpp): `src/physics/player_controller.cpp`
- [Physics World](https://github.com/bubu2001/antiworld/blob/main/src/physics/physics_world.cpp): `src/physics/physics_world.cpp`

### Rendering

- [Vulkan Runtime](https://github.com/bubu2001/antiworld/blob/main/src/renderer/vulkan_base.cpp): `src/renderer/vulkan_base.cpp`
- [Graphics Pipeline](https://github.com/bubu2001/antiworld/blob/main/src/renderer/pipeline.cpp): `src/renderer/pipeline.cpp`
- [Chunk LOD](https://github.com/bubu2001/antiworld/blob/main/src/renderer/lod_manager.cpp): `src/renderer/lod_manager.cpp`

### Characters and AI

- [Character Mesh](https://github.com/bubu2001/antiworld/blob/main/src/character/character_mesh.cpp): `src/character/character_mesh.cpp`
- [Animation](https://github.com/bubu2001/antiworld/blob/main/src/character/animation.cpp): `src/character/animation.cpp`
- [Tribal AI](https://github.com/bubu2001/antiworld/tree/main/src/ai): `src/ai`

### Other components

- **Player**

## Connections

- Player → Window: uses
- Player → Input: provides input
- Runtime Loop → Window: creates
- Runtime Loop → Vulkan Runtime: initializes
- Runtime Loop → World Map: starts
- Runtime Loop → Chunk Streaming: updates
- Runtime Loop → ECS World: runs
- Input → Player Controller: drives
- Camera → Player Controller: provides direction
- Player Controller → Physics World: sets velocity
- Runtime Loop → Physics World: steps
- Runtime Loop → Camera: updates
- Camera → Floating Origin: uses origin
- Chunk Streaming → Worker Pool: dispatches generation
- Chunk Streaming → Terrain Generator: generates chunks
- Terrain Generator → Climate: samples climate
- Terrain Generator → Biome Sampling: samples biomes
- Chunk Streaming → Physics World: creates shapes
- Chunk Streaming → ECS World: creates entities
- Chunk Streaming → Vulkan Runtime: uploads meshes
- ECS World → ECS Systems: updates
- ECS World → Vulkan Runtime: provides frame environment
- Vulkan Runtime → Graphics Pipeline: draws with
- Chunk Streaming → Chunk LOD: builds chunk levels
- Runtime Loop → Character Mesh: spawns agents
- Character Mesh → Animation: uses
