# martinsuii/another-dungeon-game architecture

> Architecture diagram of the GitHub repository martinsuii/another-dungeon-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/martinsuii/another-dungeon-game
- Repository: https://github.com/martinsuii/another-dungeon-game

## Overview

Another Dungeon Game is a vanilla JavaScript browser dungeon crawler. The main loop is player input, exploration and combat across generated floors, then a run result that can update local records or be submitted to the leaderboard. Markets, bosses, secrets, achievements, settings, and touch controls are documented capabilities; the sampled implementation is mostly one large game.js file, so its internal responsibilities share that path. Relationships for unsampled features rely on README statements rather than inspected implementation.

Main entry points: [`game.js`](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js) (Game Runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Play Runtime"]
  node_game["Game Runtime<br/>[game.js]"]
end

subgraph group_world["Dungeon Gameplay"]
  node_floor["Floor Generation<br/>[game.js]"]
  node_navigation["Movement and Pathfinding<br/>[game.js]"]
  node_combat["Combat and Enemies<br/>[game.js]"]
  node_bosses["Boss Encounters<br/>[game.js]"]
  node_market["Market and Vendors<br/>[game.js]"]
  node_secrets["Secrets and Quests<br/>[game.js]"]
end

subgraph group_progress["Player Progress"]
  node_economy["Run Economy<br/>[game.js]"]
  node_records[("Best Run Records<br/>[game.js]")]
  node_achievements["Achievements<br/>[game.js]"]
  node_settings[("Settings and Language<br/>[game.js]")]
end

subgraph group_services["Interface and Services"]
  node_controls["Keyboard and Touch<br/>[game.js]"]
  node_renderer["Canvas and Interface<br/>[game.js]"]
  node_leaderboard["Leaderboard<br/>[game.js]"]
end

node_player(("Player"))
node_supabase[("Supabase")]

node_player -->|"provides input"| node_controls
node_controls -->|"controls play"| node_game
node_game -->|"generates floors"| node_floor
node_game -->|"moves and validates"| node_navigation
node_game -->|"runs encounters"| node_combat
node_game -->|"starts boss fights"| node_bosses
node_game -->|"opens market floors"| node_market
node_game -->|"runs secret quests"| node_secrets
node_game -->|"updates run resources"| node_economy
node_game -->|"saves browser records"| node_records
node_game -->|"awards goals"| node_achievements
node_game -->|"loads and saves preferences"| node_settings
node_game -->|"draws game interface"| node_renderer
node_game -->|"reads and submits scores"| node_leaderboard
node_leaderboard -->|"validates submissions"| node_supabase

click node_controls "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_game "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_floor "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_navigation "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_combat "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_bosses "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_market "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_secrets "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_economy "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_records "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_achievements "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_settings "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_renderer "https://github.com/martinsuii/another-dungeon-game/blob/main/game.js"
click node_leaderboard "https://github.com/martinsuii/another-dungeon-game/blob/main/game.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_game toneBlue
class node_floor,node_navigation,node_combat,node_bosses,node_market,node_secrets,node_supabase toneAmber
class node_economy,node_records,node_achievements,node_settings toneMint
class node_controls,node_renderer,node_leaderboard toneRose
class node_player toneIndigo
```

## Components

### Play Runtime

- [Game Runtime](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`

### Dungeon Gameplay

- [Floor Generation](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Movement and Pathfinding](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Combat and Enemies](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Boss Encounters](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Market and Vendors](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Secrets and Quests](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`

### Player Progress

- [Run Economy](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Best Run Records](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Achievements](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Settings and Language](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`

### Interface and Services

- [Keyboard and Touch](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Canvas and Interface](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`
- [Leaderboard](https://github.com/martinsuii/another-dungeon-game/blob/main/game.js): `game.js`

### Other components

- **Player**
- **Supabase**

## Connections

- Player → Keyboard and Touch: provides input (evidence: `README.md`)
- Keyboard and Touch → Game Runtime: controls play (evidence: `README.md`)
- Game Runtime → Floor Generation: generates floors (evidence: `README.md`)
- Game Runtime → Movement and Pathfinding: moves and validates (evidence: `game.js`)
- Game Runtime → Combat and Enemies: runs encounters (evidence: `README.md`)
- Game Runtime → Boss Encounters: starts boss fights (evidence: `README.md`)
- Game Runtime → Market and Vendors: opens market floors (evidence: `README.md`)
- Game Runtime → Secrets and Quests: runs secret quests (evidence: `game.js`)
- Game Runtime → Run Economy: updates run resources (evidence: `README.md`)
- Game Runtime → Best Run Records: saves browser records (evidence: `README.md`)
- Game Runtime → Achievements: awards goals (evidence: `README.md`)
- Game Runtime → Settings and Language: loads and saves preferences (evidence: `README.md`)
- Game Runtime → Canvas and Interface: draws game interface (evidence: `README.md`)
- Game Runtime → Leaderboard: reads and submits scores (evidence: `README.md`)
- Leaderboard → Supabase: validates submissions (evidence: `README.md`)
