# calvinlomax/adaptivearena architecture

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

- Interactive diagram: https://gitdiagram.com/calvinlomax/adaptivearena
- Repository: https://github.com/calvinlomax/adaptivearena

## Overview

Adaptive Arena is a browser-based first-person arena slasher. A player starts or loads a save slot, then enters the gameplay runtime, where maze exploration, melee combat, adaptive enemy behavior, and progression form the main play loop. The runtime also manages the shop and persistence, while procedural mob geometry feeds a WebGL renderer with a software fallback. The runtime excerpt is partial: its major capabilities are supported by the README, but internal calls between those subsystems are not shown, so those links are omitted.

Main entry points: [`src/game/runtime.js`](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js) (Gameplay runtime), [`src/main.js`](https://github.com/calvinlomax/adaptivearena/blob/main/src/main.js) (Start and load flow), [`src/storage/save-manager.js`](https://github.com/calvinlomax/adaptivearena/blob/main/src/storage/save-manager.js) (Save-slot management), [`index.html`](https://github.com/calvinlomax/adaptivearena/blob/main/index.html) (Game page and HUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Game entry"]
  node_page["Game page and HUD<br/>[index.html]"]
  node_boot["Start and load flow<br/>[main.js]"]
end

subgraph group_gameplay["Gameplay"]
  node_runtime["Gameplay runtime<br/>[runtime.js]"]
  node_maze["Maze and world<br/>[runtime.js]"]
  node_combat["Combat and raycasts<br/>[runtime.js]"]
  node_learning["Enemy learning<br/>[runtime.js]"]
  node_progression["Bosses and progression<br/>[runtime.js]"]
  node_shop["Shop and inventory<br/>[runtime.js]"]
  node_gameconfig["Game configuration<br/>[data.js]"]
end

subgraph group_presentation["Mob presentation"]
  node_geometry["Mob mesh generation<br/>[mob-geometry.js]"]
  node_renderer["Mob renderer<br/>[mob-renderer.js]"]
end

subgraph group_persistence["Persistence"]
  node_saveflow["Save-slot management<br/>[save-manager.js]"]
  node_browserstore[("Browser storage")]
end

node_player(("Player"))

node_player -->|"opens"| node_page
node_page -->|"starts flow"| node_boot
node_boot -->|"selects save"| node_saveflow
node_boot -->|"loads runtime"| node_runtime
node_runtime -->|"reads and updates"| node_saveflow
node_runtime -->|"uses configuration"| node_gameconfig
node_runtime -->|"builds meshes"| node_geometry
node_runtime -->|"renders mobs"| node_renderer
node_saveflow -->|"reads and writes"| node_browserstore

click node_page "https://github.com/calvinlomax/adaptivearena/blob/main/index.html"
click node_boot "https://github.com/calvinlomax/adaptivearena/blob/main/src/main.js"
click node_runtime "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_maze "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_combat "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_learning "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_progression "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_shop "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js"
click node_gameconfig "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/data.js"
click node_geometry "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/mob-geometry.js"
click node_renderer "https://github.com/calvinlomax/adaptivearena/blob/main/src/game/mob-renderer.js"
click node_saveflow "https://github.com/calvinlomax/adaptivearena/blob/main/src/storage/save-manager.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_page,node_boot toneBlue
class node_runtime,node_maze,node_combat,node_learning,node_progression,node_shop,node_gameconfig toneAmber
class node_geometry,node_renderer toneMint
class node_saveflow,node_browserstore toneRose
class node_player toneIndigo
```

## Components

### Game entry

- [Game page and HUD](https://github.com/calvinlomax/adaptivearena/blob/main/index.html): `index.html`
- [Start and load flow](https://github.com/calvinlomax/adaptivearena/blob/main/src/main.js): `src/main.js`

### Gameplay

- [Gameplay runtime](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Maze and world](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Combat and raycasts](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Enemy learning](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Bosses and progression](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Shop and inventory](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/runtime.js): `src/game/runtime.js`
- [Game configuration](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/data.js): `src/game/data.js`

### Mob presentation

- [Mob mesh generation](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/mob-geometry.js): `src/game/mob-geometry.js`
- [Mob renderer](https://github.com/calvinlomax/adaptivearena/blob/main/src/game/mob-renderer.js): `src/game/mob-renderer.js`

### Persistence

- [Save-slot management](https://github.com/calvinlomax/adaptivearena/blob/main/src/storage/save-manager.js): `src/storage/save-manager.js`
- **Browser storage**

### Other components

- **Player**

## Connections

- Player → Game page and HUD: opens (evidence: `README.md`)
- Game page and HUD → Start and load flow: starts flow (evidence: `README.md`)
- Start and load flow → Save-slot management: selects save (evidence: `src/main.js`)
- Start and load flow → Gameplay runtime: loads runtime (evidence: `src/main.js`)
- Gameplay runtime → Save-slot management: reads and updates (evidence: `src/game/runtime.js`)
- Gameplay runtime → Game configuration: uses configuration (evidence: `src/game/runtime.js`)
- Gameplay runtime → Mob mesh generation: builds meshes (evidence: `src/game/runtime.js`)
- Gameplay runtime → Mob renderer: renders mobs (evidence: `src/game/runtime.js`)
- Save-slot management → Browser storage: reads and writes (evidence: `src/storage/save-manager.js`)
