# will99919/the-hyrule-castle architecture

> Architecture diagram of the GitHub repository will99919/the-hyrule-castle, 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/will99919/the-hyrule-castle
- Repository: https://github.com/will99919/the-hyrule-castle

## Overview

This is a small TypeScript Zelda-themed RPG. The sampled game entry point creates a randomized player, runs up to ten turn-based fights, and reads attack or heal choices from the terminal; ordinary enemies appear before a final boss. Character growth and saving exist as separate modules, but the sampled game does not wire them into that workflow. Resource files for classes, races, spells, and traps are present, though their runtime use is not established by the sampled code.

Main entry points: [`mods/hyrule_castle.ts`](https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts) (Game runner), [`mods/save.ts`](https://github.com/will99919/the-hyrule-castle/blob/main/mods/save.ts) (Save module), [`base_game/hyrule_castle.ts`](https://github.com/will99919/the-hyrule-castle/blob/main/base_game/hyrule_castle.ts) (Base game entry), [`ressources/players.json`](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/players.json) (Player roster)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game flow"]
  node_game["Game runner<br/>[hyrule_castle.ts]"]
  node_character["Character setup<br/>[hyrule_castle.ts]"]
  node_combat["Combat loop<br/>[hyrule_castle.ts]"]
  node_basegame["Base game entry<br/>[hyrule_castle.ts]"]
end

subgraph group_data["Game data"]
  node_players["Player roster<br/>[players.json]"]
  node_enemies["Enemy roster<br/>[enemies.json]"]
  node_bosses["Boss roster<br/>[bosses.json]"]
  node_classes["Class data<br/>[classes.json]"]
  node_races["Race data<br/>[races.json]"]
  node_spells["Spell data<br/>[spells.json]"]
  node_traps["Trap data<br/>[traps.json]"]
end

subgraph group_extensions["Extensions"]
  node_experience["Experience system"]
  node_save["Save module<br/>[save.ts]"]
end

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

node_player -->|"starts"| node_game
node_game -->|"creates player"| node_character
node_character -->|"selects from"| node_players
node_game -->|"runs fights"| node_combat
node_game -->|"selects enemies"| node_enemies
node_game -->|"selects final boss"| node_bosses
node_combat -->|"prompts actions"| node_terminal
node_terminal -->|"returns choice"| node_combat
node_save -->|"imports"| node_basegame

click node_game "https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts"
click node_character "https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts"
click node_combat "https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts"
click node_players "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/players.json"
click node_enemies "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/enemies.json"
click node_bosses "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/bosses.json"
click node_classes "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/classes.json"
click node_races "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/races.json"
click node_spells "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/spells.json"
click node_traps "https://github.com/will99919/the-hyrule-castle/blob/main/ressources/traps.json"
click node_experience "https://github.com/will99919/the-hyrule-castle/blob/main/mods/experience_system.ts"
click node_save "https://github.com/will99919/the-hyrule-castle/blob/main/mods/save.ts"
click node_basegame "https://github.com/will99919/the-hyrule-castle/blob/main/base_game/hyrule_castle.ts"

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_game,node_character,node_combat,node_basegame toneBlue
class node_players,node_enemies,node_bosses,node_classes,node_races,node_spells,node_traps toneAmber
class node_experience,node_save toneMint
class node_player,node_terminal toneIndigo
```

## Components

### Game flow

- [Game runner](https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts): `mods/hyrule_castle.ts`
- [Character setup](https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts): `mods/hyrule_castle.ts`
- [Combat loop](https://github.com/will99919/the-hyrule-castle/blob/main/mods/hyrule_castle.ts): `mods/hyrule_castle.ts`
- [Base game entry](https://github.com/will99919/the-hyrule-castle/blob/main/base_game/hyrule_castle.ts): `base_game/hyrule_castle.ts`

### Game data

- [Player roster](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/players.json): `ressources/players.json`
- [Enemy roster](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/enemies.json): `ressources/enemies.json`
- [Boss roster](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/bosses.json): `ressources/bosses.json`
- [Class data](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/classes.json): `ressources/classes.json`
- [Race data](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/races.json): `ressources/races.json`
- [Spell data](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/spells.json): `ressources/spells.json`
- [Trap data](https://github.com/will99919/the-hyrule-castle/blob/main/ressources/traps.json): `ressources/traps.json`

### Extensions

- [Experience system](https://github.com/will99919/the-hyrule-castle/blob/main/mods/experience_system.ts): `mods/experience_system.ts`
- [Save module](https://github.com/will99919/the-hyrule-castle/blob/main/mods/save.ts): `mods/save.ts`

### Other components

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

## Connections

- Player → Game runner: starts
- Game runner → Character setup: creates player
- Character setup → Player roster: selects from
- Game runner → Combat loop: runs fights
- Game runner → Enemy roster: selects enemies
- Game runner → Boss roster: selects final boss
- Combat loop → Terminal input: prompts actions
- Terminal input → Combat loop: returns choice
- Save module → Base game entry: imports
