# bo-xd/wolfenstein3d-style-terminal architecture

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

- Interactive diagram: https://gitdiagram.com/bo-xd/wolfenstein3d-style-terminal
- Repository: https://github.com/bo-xd/wolfenstein3d-style-terminal

## Overview

Wolfenstein-style terminal shooter: the player starts from a validated ASCII map, then the ncurses game loop handles movement, shooting, pickups and enemy turns before rendering each frame or the victory screen. Raycasting, combat, enemy pathfinding, pickup handling and ECS-backed world state are distinct runtime stages. The README documents capabilities such as HUD, weapon animation and victory effects; source excerpts show the main dispatch and several implementations. Some module relationships are supported by the SOURCE INDEX rather than full source excerpts.

Main entry points: [`src/main.c`](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/main.c) (Game loop), [`src/map.c`](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/map.c) (Map loading), [`src/ecs.c`](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/ecs.c) (World state), [`src/combat.c`](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/combat.c) (Combat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_loop["Game loop"]
  node_main["Game loop<br/>[main.c]"]
end

subgraph group_world["World setup"]
  node_mapdata["Level map<br/>[map.txt]"]
  node_map["Map loading<br/>[map.c]"]
  node_ecs["World state<br/>[ecs.c]"]
  node_config["Game settings<br/>[game_config.h]"]
  node_types["Game types<br/>[game_types.h]"]
end

subgraph group_gameplay["Gameplay systems"]
  node_movement["Player movement<br/>[player.c]"]
  node_combat["Combat<br/>[combat.c]"]
  node_enemy["Enemy behavior<br/>[enemy.c]"]
  node_pickup["Pickups<br/>[pickup.c]"]
end

subgraph group_display["Rendering"]
  node_raycast["Raycasting<br/>[raycast.c]"]
  node_enemyview["Enemy rendering<br/>[enemy.c]"]
  node_pickupview["Pickup rendering<br/>[pickup.c]"]
  node_weapon["Weapon display<br/>[weapon.c]"]
end

node_player(("Player"))
node_terminal(("Terminal"))

node_player -->|"provides input"| node_main
node_main -->|"loads"| node_mapdata
node_main -->|"loads map"| node_map
node_map -->|"creates entities"| node_ecs
node_main -->|"dispatches movement"| node_movement
node_main -->|"dispatches firing"| node_combat
node_main -->|"updates pickups"| node_pickup
node_main -->|"updates enemies"| node_enemy
node_main -->|"casts view rays"| node_raycast
node_combat -->|"casts shot ray"| node_raycast
node_main -->|"renders enemies"| node_enemyview
node_main -->|"renders pickups"| node_pickupview
node_main -->|"draws weapon"| node_weapon
node_main -->|"renders frames"| node_terminal
node_enemy -->|"updates state"| node_ecs
node_combat -->|"updates state"| node_ecs
node_pickup -->|"updates state"| node_ecs
node_movement -->|"checks walls"| node_map
node_enemy -->|"checks routes"| node_map

click node_main "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/main.c"
click node_mapdata "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/assets/map.txt"
click node_map "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/map.c"
click node_ecs "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/ecs.c"
click node_config "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/game_config.h"
click node_types "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/game_types.h"
click node_movement "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/player.c"
click node_combat "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/combat.c"
click node_enemy "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/enemy.c"
click node_pickup "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/pickup.c"
click node_raycast "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/raycast.c"
click node_enemyview "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/enemy.c"
click node_pickupview "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/pickup.c"
click node_weapon "https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/weapon.c"

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 toneBlue
class node_mapdata,node_map,node_ecs,node_config,node_types toneAmber
class node_movement,node_combat,node_enemy,node_pickup toneMint
class node_raycast,node_enemyview,node_pickupview,node_weapon toneRose
class node_player,node_terminal toneIndigo
```

## Components

### Game loop

- [Game loop](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/main.c): `src/main.c`

### World setup

- [Level map](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/assets/map.txt): `src/assets/map.txt`
- [Map loading](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/map.c): `src/map.c`
- [World state](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/ecs.c): `src/ecs.c`
- [Game settings](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/game_config.h): `src/game_config.h`
- [Game types](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/game_types.h): `src/game_types.h`

### Gameplay systems

- [Player movement](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/player.c): `src/player.c`
- [Combat](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/combat.c): `src/combat.c`
- [Enemy behavior](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/enemy.c): `src/enemy.c`
- [Pickups](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/pickup.c): `src/pickup.c`

### Rendering

- [Raycasting](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/raycast.c): `src/raycast.c`
- [Enemy rendering](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/enemy.c): `src/enemy.c`
- [Pickup rendering](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/pickup.c): `src/pickup.c`
- [Weapon display](https://github.com/bo-xd/wolfenstein3d-style-terminal/blob/main/src/weapon.c): `src/weapon.c`

### Other components

- **Player**
- **Terminal**

## Connections

- Player → Game loop: provides input (evidence: `readme.md`)
- Game loop → Level map: loads (evidence: `src/main.c`)
- Game loop → Map loading: loads map (evidence: `src/main.c`)
- Map loading → World state: creates entities
- Game loop → Player movement: dispatches movement (evidence: `src/main.c`)
- Game loop → Combat: dispatches firing (evidence: `src/main.c`)
- Game loop → Pickups: updates pickups (evidence: `src/main.c`)
- Game loop → Enemy behavior: updates enemies (evidence: `src/main.c`)
- Game loop → Raycasting: casts view rays (evidence: `src/main.c`)
- Combat → Raycasting: casts shot ray (evidence: `src/combat.c`)
- Game loop → Enemy rendering: renders enemies (evidence: `src/main.c`)
- Game loop → Pickup rendering: renders pickups (evidence: `src/main.c`)
- Game loop → Weapon display: draws weapon (evidence: `src/main.c`)
- Game loop → Terminal: renders frames (evidence: `src/main.c`)
- Enemy behavior → World state: updates state (evidence: `src/enemy.c`)
- Combat → World state: updates state (evidence: `src/combat.c`)
- Pickups → World state: updates state
- Player movement → Map loading: checks walls
- Enemy behavior → Map loading: checks routes (evidence: `src/enemy.c`)
