# teytra/2.5d_shooter_game architecture

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

- Interactive diagram: https://gitdiagram.com/teytra/2.5d_shooter_game
- Repository: https://github.com/teytra/2.5d_shooter_game

## Overview

This is a single-file, real-time terminal FPS. The player enters through platform-specific raw keyboard handling; the game loop applies movement, firing, and reload actions, updates the encounter, then renders the view and HUD to the terminal. The gameplay stages include map-based movement and collision, bot pursuit and attacks, player combat and scoring, and win/loss state. Rendering combines DDA wall casting with depth-tested bot sprites. The README documents these capabilities, but the source excerpt omits parts of the loop and bot update code, so uncertain call wiring is not shown.

Main entry points: [`main.c`](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c) (Game entry and loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and input"]
  node_main["Game entry and loop<br/>[main.c]"]
  node_input["Raw input<br/>[main.c]"]
  node_controls["Action controls<br/>[main.c]"]
end

subgraph group_gameplay["Gameplay systems"]
  node_map["Map and collision<br/>[main.c]"]
  node_bot_ai["Bot AI<br/>[main.c]"]
  node_combat["Combat and reload<br/>[main.c]"]
  node_outcome["Win and loss<br/>[main.c]"]
end

subgraph group_presentation["Terminal presentation"]
  node_raycast["Wall raycasting<br/>[main.c]"]
  node_sprites["Bot sprites<br/>[main.c]"]
  node_hud["HUD and crosshair<br/>[main.c]"]
end

subgraph group_state["Game state"]
  node_game_state["Player and game state<br/>[main.c]"]
end

node_player(("Player"))
node_terminal["Terminal display"]

node_player -->|"presses keys"| node_input
node_main -->|"polls input"| node_input
node_input -->|"dispatches keys"| node_controls
node_controls -->|"updates actions"| node_game_state
node_controls -->|"checks movement"| node_map
node_controls -->|"fires or reloads"| node_combat
node_bot_ai -->|"checks line of sight"| node_map
node_bot_ai -->|"updates health"| node_game_state
node_combat -->|"updates ammo and score"| node_game_state
node_game_state -->|"determines result"| node_outcome
node_main -->|"updates bots"| node_bot_ai
node_main -->|"renders view"| node_raycast
node_raycast -->|"provides depth buffer"| node_sprites
node_main -->|"renders status"| node_hud
node_raycast -->|"draws scene"| node_terminal
node_sprites -->|"draws bots"| node_terminal
node_hud -->|"draws HUD"| node_terminal

click node_main "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_input "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_controls "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_game_state "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_map "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_bot_ai "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_combat "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_outcome "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_raycast "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_sprites "https://github.com/teytra/2.5d_shooter_game/blob/main/main.c"
click node_hud "https://github.com/teytra/2.5d_shooter_game/blob/main/main.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,node_input,node_controls toneBlue
class node_map,node_bot_ai,node_combat,node_outcome toneAmber
class node_raycast,node_sprites,node_hud toneMint
class node_game_state toneRose
class node_player,node_terminal toneIndigo
```

## Components

### Runtime and input

- [Game entry and loop](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Raw input](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Action controls](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`

### Gameplay systems

- [Map and collision](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Bot AI](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Combat and reload](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Win and loss](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`

### Terminal presentation

- [Wall raycasting](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [Bot sprites](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`
- [HUD and crosshair](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`

### Game state

- [Player and game state](https://github.com/teytra/2.5d_shooter_game/blob/main/main.c): `main.c`

### Other components

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

## Connections

- Player → Raw input: presses keys
- Game entry and loop → Raw input: polls input
- Raw input → Action controls: dispatches keys
- Action controls → Player and game state: updates actions
- Action controls → Map and collision: checks movement
- Action controls → Combat and reload: fires or reloads
- Bot AI → Map and collision: checks line of sight
- Bot AI → Player and game state: updates health
- Combat and reload → Player and game state: updates ammo and score
- Player and game state → Win and loss: determines result
- Game entry and loop → Bot AI: updates bots
- Game entry and loop → Wall raycasting: renders view
- Wall raycasting → Bot sprites: provides depth buffer
- Game entry and loop → HUD and crosshair: renders status
- Wall raycasting → Terminal display: draws scene
- Bot sprites → Terminal display: draws bots
- HUD and crosshair → Terminal display: draws HUD
