# zakker111/roguelike_whit_world architecture

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

- Interactive diagram: https://gitdiagram.com/zakker111/roguelike_whit_world
- Repository: https://github.com/zakker111/roguelike_whit_world

## Overview

This is a browser-based, data-driven roguelike. The player enters through the game runtime, explores a seeded procedural overworld, and can enter towns, dungeons, encounters, or the local region map; gameplay includes NPC interactions, combat, shops, quests, and followers. Groups distinguish runtime orchestration and presentation from the world, encounter, and town domains, plus shared gameplay systems. The README documents the major capabilities; edges between unsampled subsystems are omitted where their specific callers were not shown.

Main entry points: [`game/core/world_runtime.js`](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/world_runtime.js) (World runtime), [`game/ai/town_runtime.js`](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_runtime.js) (Town NPC runtime), [`game/core/engine/game_loop.js`](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/engine/game_loop.js) (Game engine), [`game/src/main.js`](https://github.com/zakker111/roguelike_whit_world/blob/main/game/src/main.js) (Game entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and UI"]
  node_entry["Game entry<br/>[main.js]"]
  node_engine["Game engine<br/>[game_loop.js]"]
  node_ui["Rendering and UI<br/>[ui.js]"]
end

subgraph group_world["World and locations"]
  node_worldgen["Overworld generation<br/>[world.js]"]
  node_worldruntime["World runtime<br/>[world_runtime.js]"]
  node_dungeon["Dungeon gameplay<br/>[runtime.js]"]
  node_encounter["Overworld encounters<br/>[runtime.js]"]
  node_region["Region map"]
end

subgraph group_town["Town simulation"]
  node_town_generation["Town generation<br/>[town_gen.js]"]
  node_town_ai["Town NPC runtime<br/>[town_runtime.js]"]
  node_town_movement["NPC movement<br/>[town_movement.js]"]
  node_town_pathing["Pathfinding<br/>[pathfinding.js]"]
  node_inn["Inn upstairs"]
end

subgraph group_systems["Gameplay systems"]
  node_combat["Turn-based combat<br/>[combat.js]"]
  node_followers["Follower runtime"]
  node_shops["Shop service<br/>[shop_service.js]"]
  node_quests["Quest board<br/>[quest_service.js]"]
  node_persistence[("Game state persistence<br/>[persistence.js]")]
end

node_player(("Player"))

node_player -->|"starts game"| node_entry
node_entry -.->|"starts runtime"| node_engine
node_player -.->|"provides input"| node_engine
node_engine -.->|"renders state"| node_ui
node_worldgen -.->|"supplies world"| node_worldruntime
node_worldruntime -.->|"enters dungeon"| node_dungeon
node_worldruntime -.->|"starts encounter"| node_encounter
node_worldruntime -->|"opens region"| node_region
node_town_generation -.->|"creates town"| node_town_ai
node_town_ai -->|"moves NPCs"| node_town_movement
node_town_ai -->|"routes upstairs"| node_inn
node_town_movement -.->|"uses paths"| node_town_pathing
node_player -->|"fights"| node_combat
node_player -->|"hires followers"| node_followers
node_player -.->|"trades"| node_shops
node_player -->|"takes quests"| node_quests
node_region -->|"syncs followers"| node_followers
node_player -.->|"saves progress"| node_persistence

click node_entry "https://github.com/zakker111/roguelike_whit_world/blob/main/game/src/main.js"
click node_engine "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/engine/game_loop.js"
click node_ui "https://github.com/zakker111/roguelike_whit_world/blob/main/game/ui/ui.js"
click node_worldgen "https://github.com/zakker111/roguelike_whit_world/blob/main/game/world/world.js"
click node_worldruntime "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/world_runtime.js"
click node_dungeon "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/dungeon/runtime.js"
click node_encounter "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/encounter/runtime.js"
click node_region "https://github.com/zakker111/roguelike_whit_world/blob/main/game/region_map/region_map_runtime.js"
click node_town_generation "https://github.com/zakker111/roguelike_whit_world/blob/main/game/worldgen/town_gen.js"
click node_town_ai "https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_runtime.js"
click node_town_movement "https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_movement.js"
click node_town_pathing "https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/pathfinding.js"
click node_inn "https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_inn_upstairs.js"
click node_combat "https://github.com/zakker111/roguelike_whit_world/blob/main/game/combat/combat.js"
click node_followers "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/followers_runtime.js"
click node_shops "https://github.com/zakker111/roguelike_whit_world/blob/main/game/services/shop_service.js"
click node_quests "https://github.com/zakker111/roguelike_whit_world/blob/main/game/services/quest_service.js"
click node_persistence "https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/state/persistence.js"

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_engine,node_ui toneBlue
class node_worldgen,node_worldruntime,node_dungeon,node_encounter,node_region toneAmber
class node_town_generation,node_town_ai,node_town_movement,node_town_pathing,node_inn toneMint
class node_combat,node_followers,node_shops,node_quests,node_persistence toneRose
class node_player toneIndigo
```

## Components

### Runtime and UI

- [Game entry](https://github.com/zakker111/roguelike_whit_world/blob/main/game/src/main.js): `game/src/main.js`
- [Game engine](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/engine/game_loop.js): `game/core/engine/game_loop.js`
- [Rendering and UI](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ui/ui.js): `game/ui/ui.js`

### World and locations

- [Overworld generation](https://github.com/zakker111/roguelike_whit_world/blob/main/game/world/world.js): `game/world/world.js`
- [World runtime](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/world_runtime.js): `game/core/world_runtime.js`
- [Dungeon gameplay](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/dungeon/runtime.js): `game/core/dungeon/runtime.js`
- [Overworld encounters](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/encounter/runtime.js): `game/core/encounter/runtime.js`
- [Region map](https://github.com/zakker111/roguelike_whit_world/blob/main/game/region_map/region_map_runtime.js): `game/region_map/region_map_runtime.js`

### Town simulation

- [Town generation](https://github.com/zakker111/roguelike_whit_world/blob/main/game/worldgen/town_gen.js): `game/worldgen/town_gen.js`
- [Town NPC runtime](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_runtime.js): `game/ai/town_runtime.js`
- [NPC movement](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_movement.js): `game/ai/town_movement.js`
- [Pathfinding](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/pathfinding.js): `game/ai/pathfinding.js`
- [Inn upstairs](https://github.com/zakker111/roguelike_whit_world/blob/main/game/ai/town_inn_upstairs.js): `game/ai/town_inn_upstairs.js`

### Gameplay systems

- [Turn-based combat](https://github.com/zakker111/roguelike_whit_world/blob/main/game/combat/combat.js): `game/combat/combat.js`
- [Follower runtime](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/followers_runtime.js): `game/core/followers_runtime.js`
- [Shop service](https://github.com/zakker111/roguelike_whit_world/blob/main/game/services/shop_service.js): `game/services/shop_service.js`
- [Quest board](https://github.com/zakker111/roguelike_whit_world/blob/main/game/services/quest_service.js): `game/services/quest_service.js`
- [Game state persistence](https://github.com/zakker111/roguelike_whit_world/blob/main/game/core/state/persistence.js): `game/core/state/persistence.js`

### Other components

- **Player**

## Connections

- Player → Game entry: starts game
- Game entry → Game engine: starts runtime
- Player → Game engine: provides input
- Game engine → Rendering and UI: renders state
- Overworld generation → World runtime: supplies world
- World runtime → Dungeon gameplay: enters dungeon
- World runtime → Overworld encounters: starts encounter
- World runtime → Region map: opens region (evidence: `game/region_map/region_map_runtime.js`)
- Town generation → Town NPC runtime: creates town
- Town NPC runtime → NPC movement: moves NPCs (evidence: `game/ai/town_runtime.js`)
- Town NPC runtime → Inn upstairs: routes upstairs (evidence: `game/ai/town_runtime.js`)
- NPC movement → Pathfinding: uses paths (evidence: `game/ai/town_movement.js`)
- Player → Turn-based combat: fights
- Player → Follower runtime: hires followers
- Player → Shop service: trades
- Player → Quest board: takes quests (evidence: `game/services/quest_service.js`)
- Region map → Follower runtime: syncs followers (evidence: `game/region_map/region_map_runtime.js`)
- Player → Game state persistence: saves progress
