# ulfben/kotte architecture

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

- Interactive diagram: https://gitdiagram.com/ulfben/kotte
- Repository: https://github.com/ulfben/kotte

## Overview

This is a C++ Bomberman-style game built on the Kotte foundations. The player-facing runtime starts in `main`, creates an `Application`, and runs frames that collect input, update gameplay, resolve timed bomb/blast events, apply world mutations, and render. The sampled code supports the central entity, spatial-query, and presentation responsibilities; the README is still an assignment template, so controls, objectives, extensions, and validation claims are undocumented. Some subsystem links are omitted where excerpts do not show the call.

Main entry points: [`kotte/src/application.cpp`](https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp) (Frame orchestration), [`kotte/src/entity_store.cpp`](https://github.com/ulfben/kotte/blob/master/kotte/src/entity_store.cpp) (Entity store), [`kotte/src/main.cpp`](https://github.com/ulfben/kotte/blob/master/kotte/src/main.cpp) (Game entry), [`kotte/src/spatial_grid.cpp`](https://github.com/ulfben/kotte/blob/master/kotte/src/spatial_grid.cpp) (Spatial index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_entry["Game entry<br/>[main.cpp]"]
  node_app["Frame orchestration<br/>[application.cpp]"]
  node_bombs["Bomb and blast rules<br/>[application.cpp]"]
  node_enemies["Enemy movement<br/>[application.cpp]"]
end

subgraph group_world["World and entities"]
  node_map["Tile map generation<br/>[tile_map.cpp]"]
  node_entities["Entity model<br/>[entity.hpp]"]
  node_store[("Entity store<br/>[entity_store.cpp]")]
  node_handles["Entity handles<br/>[entity_handle.hpp]"]
  node_spatial["Spatial index<br/>[spatial_grid.cpp]"]
  node_random["Seeded randomness<br/>[random.hpp]"]
end

subgraph group_present["Presentation and platform"]
  node_camera["Camera transform<br/>[camera.cpp]"]
  node_renderer["Render command queue<br/>[renderer.cpp]"]
  node_window["Window and frame<br/>[window.cpp]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_entry
node_entry -->|"runs"| node_app
node_app -->|"owns frame loop"| node_window
node_app -->|"initializes world"| node_map
node_app -->|"creates entities"| node_store
node_app -->|"indexes entities"| node_spatial
node_app -->|"updates timed gameplay"| node_bombs
node_app -->|"updates enemies"| node_enemies
node_app -->|"uses camera"| node_camera
node_app -->|"submits and draws"| node_renderer
node_store -->|"stores values"| node_entities
node_store -->|"validates identity"| node_handles
node_spatial -->|"indexes references"| node_handles
node_app -->|"reads entity state"| node_entities
node_app -->|"chooses enemy heading"| node_random

click node_entry "https://github.com/ulfben/kotte/blob/master/kotte/src/main.cpp"
click node_app "https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp"
click node_bombs "https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp"
click node_enemies "https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp"
click node_map "https://github.com/ulfben/kotte/blob/master/kotte/src/tile_map.cpp"
click node_entities "https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/entity.hpp"
click node_store "https://github.com/ulfben/kotte/blob/master/kotte/src/entity_store.cpp"
click node_handles "https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/entity_handle.hpp"
click node_spatial "https://github.com/ulfben/kotte/blob/master/kotte/src/spatial_grid.cpp"
click node_random "https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/random.hpp"
click node_camera "https://github.com/ulfben/kotte/blob/master/kotte/src/camera.cpp"
click node_renderer "https://github.com/ulfben/kotte/blob/master/kotte/src/renderer.cpp"
click node_window "https://github.com/ulfben/kotte/blob/master/kotte/src/window.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_entry,node_app,node_bombs,node_enemies toneBlue
class node_map,node_entities,node_store,node_handles,node_spatial,node_random toneAmber
class node_camera,node_renderer,node_window toneMint
class node_player toneIndigo
```

## Components

### Game runtime

- [Game entry](https://github.com/ulfben/kotte/blob/master/kotte/src/main.cpp): `kotte/src/main.cpp`
- [Frame orchestration](https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp): `kotte/src/application.cpp`
- [Bomb and blast rules](https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp): `kotte/src/application.cpp`
- [Enemy movement](https://github.com/ulfben/kotte/blob/master/kotte/src/application.cpp): `kotte/src/application.cpp`

### World and entities

- [Tile map generation](https://github.com/ulfben/kotte/blob/master/kotte/src/tile_map.cpp): `kotte/src/tile_map.cpp`
- [Entity model](https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/entity.hpp): `kotte/include/kotte/entity.hpp`
- [Entity store](https://github.com/ulfben/kotte/blob/master/kotte/src/entity_store.cpp): `kotte/src/entity_store.cpp`
- [Entity handles](https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/entity_handle.hpp): `kotte/include/kotte/entity_handle.hpp`
- [Spatial index](https://github.com/ulfben/kotte/blob/master/kotte/src/spatial_grid.cpp): `kotte/src/spatial_grid.cpp`
- [Seeded randomness](https://github.com/ulfben/kotte/blob/master/kotte/include/kotte/random.hpp): `kotte/include/kotte/random.hpp`

### Presentation and platform

- [Camera transform](https://github.com/ulfben/kotte/blob/master/kotte/src/camera.cpp): `kotte/src/camera.cpp`
- [Render command queue](https://github.com/ulfben/kotte/blob/master/kotte/src/renderer.cpp): `kotte/src/renderer.cpp`
- [Window and frame](https://github.com/ulfben/kotte/blob/master/kotte/src/window.cpp): `kotte/src/window.cpp`

### Other components

- **Player**

## Connections

- Player → Game entry: starts game (evidence: `kotte/src/main.cpp`)
- Game entry → Frame orchestration: runs (evidence: `kotte/src/main.cpp`)
- Frame orchestration → Window and frame: owns frame loop
- Frame orchestration → Tile map generation: initializes world
- Frame orchestration → Entity store: creates entities (evidence: `kotte/src/application.cpp`)
- Frame orchestration → Spatial index: indexes entities (evidence: `kotte/src/application.cpp`)
- Frame orchestration → Bomb and blast rules: updates timed gameplay (evidence: `kotte/src/application.cpp`)
- Frame orchestration → Enemy movement: updates enemies (evidence: `kotte/src/application.cpp`)
- Frame orchestration → Camera transform: uses camera
- Frame orchestration → Render command queue: submits and draws (evidence: `kotte/src/application.cpp`)
- Entity store → Entity model: stores values
- Entity store → Entity handles: validates identity
- Spatial index → Entity handles: indexes references
- Frame orchestration → Entity model: reads entity state (evidence: `kotte/src/application.cpp`)
- Frame orchestration → Seeded randomness: chooses enemy heading (evidence: `kotte/src/application.cpp`)
