# mentallyunstabledude/red-harbor architecture

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

- Interactive diagram: https://gitdiagram.com/mentallyunstabledude/red-harbor
- Repository: https://github.com/mentallyunstabledude/red-harbor

## Overview

Red Harbor is a Godot stealth roguelite built around surviving a procedurally dealt Harbor Row, collecting three intel caches, and extracting at the safehouse. The documented loop also includes guard patrol, detection, pursuit/search, takedowns, HUD feedback, restart, and wall-aware sight. The provided source sample covers only sprite generation, not the runtime scripts or scene wiring; those gameplay branches are therefore included as documented capabilities, with no speculative edges between their implementation nodes.

Main entry points: [`scripts/player.gd`](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/player.gd) (Player Character), [`scripts/guard.gd`](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/guard.gd) (Guard AI), [`scripts/game.gd`](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/game.gd) (Night Orchestrator), [`assets_src/gen_sprites.py`](https://github.com/mentallyunstabledude/red-harbor/blob/main/assets_src/gen_sprites.py) (Sprite Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_world["World Generation"]
  node_level_builder["Block Generator<br/>[level_builder.gd]"]
  node_main_scene["Harbor Row Scene<br/>[main.tscn]"]
end

subgraph group_stealth["Stealth Gameplay"]
  node_player["Player Character<br/>[player.gd]"]
  node_guard["Guard AI<br/>[guard.gd]"]
  node_player_scene["Player Scene<br/>[player.tscn]"]
  node_guard_scene["Guard Scene<br/>[guard.tscn]"]
end

subgraph group_mission["Mission Loop"]
  node_game["Night Orchestrator<br/>[game.gd]"]
  node_intel["Intel Pickups<br/>[intel_pickup.gd]"]
  node_exit["Extraction Door<br/>[exit_zone.gd]"]
  node_intel_scene["Intel Scene<br/>[intel_pickup.tscn]"]
  node_exit_scene["Exit Scene<br/>[exit_zone.tscn]"]
end

subgraph group_presentation["Player Interface"]
  node_hud["Stealth HUD<br/>[hud.gd]"]
  node_hud_scene["HUD Scene<br/>[hud.tscn]"]
  node_sprite_generator["Sprite Generator<br/>[gen_sprites.py]"]
end

node_godot_player(("Player"))

node_godot_player -->|"controls"| node_player
node_godot_player -->|"collects"| node_intel
node_godot_player -->|"interacts"| node_exit
node_godot_player -->|"evades"| node_guard
node_sprite_generator -->|"generates sprite sheets"| node_player_scene
node_sprite_generator -->|"generates sprite sheets"| node_guard_scene
node_game -->|"requests block plan"| node_level_builder
node_game -->|"plants cast"| node_main_scene
node_player -->|"detected by"| node_guard
node_guard -->|"captures on contact"| node_player
node_player -->|"updates condition"| node_hud
node_intel -->|"fills pip"| node_hud
node_exit -->|"extracts on request"| node_player

click node_player "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/player.gd"
click node_guard "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/guard.gd"
click node_level_builder "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/level_builder.gd"
click node_game "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/game.gd"
click node_intel "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/intel_pickup.gd"
click node_exit "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/exit_zone.gd"
click node_hud "https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/hud.gd"
click node_main_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/main.tscn"
click node_player_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/player.tscn"
click node_guard_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/guard.tscn"
click node_intel_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/intel_pickup.tscn"
click node_exit_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/exit_zone.tscn"
click node_hud_scene "https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/hud.tscn"
click node_sprite_generator "https://github.com/mentallyunstabledude/red-harbor/blob/main/assets_src/gen_sprites.py"

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_level_builder,node_main_scene toneBlue
class node_player,node_guard,node_player_scene,node_guard_scene toneAmber
class node_game,node_intel,node_exit,node_intel_scene,node_exit_scene toneMint
class node_hud,node_hud_scene,node_sprite_generator toneRose
class node_godot_player toneIndigo
```

## Components

### World Generation

- [Block Generator](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/level_builder.gd): `scripts/level_builder.gd`
- [Harbor Row Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/main.tscn): `scenes/main.tscn`

### Stealth Gameplay

- [Player Character](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/player.gd): `scripts/player.gd`
- [Guard AI](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/guard.gd): `scripts/guard.gd`
- [Player Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/player.tscn): `scenes/player.tscn`
- [Guard Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/guard.tscn): `scenes/guard.tscn`

### Mission Loop

- [Night Orchestrator](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/game.gd): `scripts/game.gd`
- [Intel Pickups](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/intel_pickup.gd): `scripts/intel_pickup.gd`
- [Extraction Door](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/exit_zone.gd): `scripts/exit_zone.gd`
- [Intel Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/intel_pickup.tscn): `scenes/intel_pickup.tscn`
- [Exit Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/exit_zone.tscn): `scenes/exit_zone.tscn`

### Player Interface

- [Stealth HUD](https://github.com/mentallyunstabledude/red-harbor/blob/main/scripts/hud.gd): `scripts/hud.gd`
- [HUD Scene](https://github.com/mentallyunstabledude/red-harbor/blob/main/scenes/hud.tscn): `scenes/hud.tscn`
- [Sprite Generator](https://github.com/mentallyunstabledude/red-harbor/blob/main/assets_src/gen_sprites.py): `assets_src/gen_sprites.py`

### Other components

- **Player**

## Connections

- Player → Player Character: controls (evidence: `README.md`)
- Player → Intel Pickups: collects (evidence: `README.md`)
- Player → Extraction Door: interacts (evidence: `README.md`)
- Player → Guard AI: evades (evidence: `README.md`)
- Sprite Generator → Player Scene: generates sprite sheets (evidence: `assets_src/gen_sprites.py`)
- Sprite Generator → Guard Scene: generates sprite sheets (evidence: `assets_src/gen_sprites.py`)
- Night Orchestrator → Block Generator: requests block plan (evidence: `README.md`)
- Night Orchestrator → Harbor Row Scene: plants cast (evidence: `README.md`)
- Player Character → Guard AI: detected by (evidence: `README.md`)
- Guard AI → Player Character: captures on contact (evidence: `README.md`)
- Player Character → Stealth HUD: updates condition (evidence: `README.md`)
- Intel Pickups → Stealth HUD: fills pip (evidence: `README.md`)
- Extraction Door → Player Character: extracts on request (evidence: `README.md`)
