# tomtommao/wartale-2d-web architecture

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

- Interactive diagram: https://gitdiagram.com/tomtommao/wartale-2d-web
- Repository: https://github.com/tomtommao/wartale-2d-web

## Overview

Ironbound Chronicles is a browser-based tactical mercenary RPG. The main loop runs from a player using the interface to travel and explore, through encounters and tactical battles, then applies rewards and progression to the company before saving state in browser storage. Supporting branches cover professions, camp upkeep, crafting, knowledge, and equipment upgrades. The graph follows visible imports and calls; README-described capabilities are included where implementation detail was not sampled, without asserting unshown links.

Main entry points: [`src/main.ts`](https://github.com/tomtommao/wartale-2d-web/blob/main/src/main.ts) (UI Orchestration), [`src/game.ts`](https://github.com/tomtommao/wartale-2d-web/blob/main/src/game.ts) (Phaser Game), [`src/locations.ts`](https://github.com/tomtommao/wartale-2d-web/blob/main/src/locations.ts) (Locations and Rewards), [`src/systems.ts`](https://github.com/tomtommao/wartale-2d-web/blob/main/src/systems.ts) (Company Systems)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Player Interface"]
  node_main["UI Orchestration<br/>[main.ts]"]
  node_ui["UI Helpers<br/>[ui.ts]"]
end

subgraph group_world["World Exploration"]
  node_worldmap["Terrain and Paths<br/>[worldMap.ts]"]
  node_locations["Locations and Rewards<br/>[locations.ts]"]
  node_worldart["World Art<br/>[worldArt.ts]"]
end

subgraph group_battle["Tactical Combat"]
  node_grid["Battle Grid<br/>[battleGrid.ts]"]
  node_skills["Battle Skills<br/>[battleSkills.ts]"]
  node_sprites["Animated Actors<br/>[animatedSprites.ts]"]
end

subgraph group_company["Company Progression"]
  node_systems["Company Systems<br/>[systems.ts]"]
  node_resources["Resource Costs<br/>[resources.ts]"]
  node_forging["Forge and Upgrades<br/>[forging.ts]"]
end

subgraph group_runtime["Game Runtime"]
  node_game["Phaser Game<br/>[game.ts]"]
  node_state[("Game State<br/>[store.ts]")]
  node_domain["Gameplay Rules<br/>[domain.ts]"]
  node_data["Game Content<br/>[data.ts]"]
  node_types["Domain Types<br/>[types.ts]"]
  node_pixelart["Pixel Art<br/>[pixelArt.ts]"]
  node_gameart["Scene and Item Art<br/>[gameArt.ts]"]
end

node_player(("Player"))

node_player -->|"uses"| node_main
node_main -->|"starts"| node_game
node_main -->|"loads and saves"| node_state
node_main -->|"renders with"| node_ui
node_game -->|"reads and saves"| node_state
node_game -->|"applies rules"| node_domain
node_domain -->|"uses content"| node_data
node_state -->|"serializes through"| node_domain
node_game -->|"enters and clears"| node_locations
node_game -->|"uses paths"| node_worldmap
node_worldmap -->|"uses grid helpers"| node_grid
node_locations -->|"maps sites"| node_worldmap
node_locations -->|"awards progression"| node_systems
node_game -->|"awards travel XP"| node_systems
node_game -.->|"resolves movement"| node_grid
node_game -->|"uses combat skills"| node_skills
node_game -->|"animates actors"| node_sprites
node_worldart -->|"draws terrain"| node_worldmap
node_game -->|"renders scenes"| node_pixelart
node_main -->|"renders art"| node_gameart
node_systems -->|"checks and spends"| node_resources
node_forging -->|"checks proximity"| node_locations
node_forging -->|"uses professions"| node_systems
node_forging -->|"checks and spends"| node_resources
node_main -->|"manages camp"| node_systems
node_main -.->|"opens workshop"| node_forging
node_main -.->|"offers exploration"| node_locations
node_main -.->|"shows overworld"| node_worldart
node_main -.->|"uses domain types"| node_types

click node_main "https://github.com/tomtommao/wartale-2d-web/blob/main/src/main.ts"
click node_ui "https://github.com/tomtommao/wartale-2d-web/blob/main/src/ui.ts"
click node_game "https://github.com/tomtommao/wartale-2d-web/blob/main/src/game.ts"
click node_state "https://github.com/tomtommao/wartale-2d-web/blob/main/src/store.ts"
click node_domain "https://github.com/tomtommao/wartale-2d-web/blob/main/src/domain.ts"
click node_data "https://github.com/tomtommao/wartale-2d-web/blob/main/src/data.ts"
click node_types "https://github.com/tomtommao/wartale-2d-web/blob/main/src/types.ts"
click node_worldmap "https://github.com/tomtommao/wartale-2d-web/blob/main/src/worldMap.ts"
click node_locations "https://github.com/tomtommao/wartale-2d-web/blob/main/src/locations.ts"
click node_worldart "https://github.com/tomtommao/wartale-2d-web/blob/main/src/worldArt.ts"
click node_grid "https://github.com/tomtommao/wartale-2d-web/blob/main/src/battleGrid.ts"
click node_skills "https://github.com/tomtommao/wartale-2d-web/blob/main/src/battleSkills.ts"
click node_sprites "https://github.com/tomtommao/wartale-2d-web/blob/main/src/animatedSprites.ts"
click node_pixelart "https://github.com/tomtommao/wartale-2d-web/blob/main/src/pixelArt.ts"
click node_gameart "https://github.com/tomtommao/wartale-2d-web/blob/main/src/gameArt.ts"
click node_systems "https://github.com/tomtommao/wartale-2d-web/blob/main/src/systems.ts"
click node_resources "https://github.com/tomtommao/wartale-2d-web/blob/main/src/resources.ts"
click node_forging "https://github.com/tomtommao/wartale-2d-web/blob/main/src/forging.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_main,node_ui toneBlue
class node_worldmap,node_locations,node_worldart toneAmber
class node_grid,node_skills,node_sprites toneMint
class node_systems,node_resources,node_forging toneRose
class node_game,node_state,node_domain,node_data,node_types,node_pixelart,node_gameart,node_player toneIndigo
```

## Components

### Player Interface

- [UI Orchestration](https://github.com/tomtommao/wartale-2d-web/blob/main/src/main.ts): `src/main.ts`
- [UI Helpers](https://github.com/tomtommao/wartale-2d-web/blob/main/src/ui.ts): `src/ui.ts`

### World Exploration

- [Terrain and Paths](https://github.com/tomtommao/wartale-2d-web/blob/main/src/worldMap.ts): `src/worldMap.ts`
- [Locations and Rewards](https://github.com/tomtommao/wartale-2d-web/blob/main/src/locations.ts): `src/locations.ts`
- [World Art](https://github.com/tomtommao/wartale-2d-web/blob/main/src/worldArt.ts): `src/worldArt.ts`

### Tactical Combat

- [Battle Grid](https://github.com/tomtommao/wartale-2d-web/blob/main/src/battleGrid.ts): `src/battleGrid.ts`
- [Battle Skills](https://github.com/tomtommao/wartale-2d-web/blob/main/src/battleSkills.ts): `src/battleSkills.ts`
- [Animated Actors](https://github.com/tomtommao/wartale-2d-web/blob/main/src/animatedSprites.ts): `src/animatedSprites.ts`

### Company Progression

- [Company Systems](https://github.com/tomtommao/wartale-2d-web/blob/main/src/systems.ts): `src/systems.ts`
- [Resource Costs](https://github.com/tomtommao/wartale-2d-web/blob/main/src/resources.ts): `src/resources.ts`
- [Forge and Upgrades](https://github.com/tomtommao/wartale-2d-web/blob/main/src/forging.ts): `src/forging.ts`

### Game Runtime

- [Phaser Game](https://github.com/tomtommao/wartale-2d-web/blob/main/src/game.ts): `src/game.ts`
- [Game State](https://github.com/tomtommao/wartale-2d-web/blob/main/src/store.ts): `src/store.ts`
- [Gameplay Rules](https://github.com/tomtommao/wartale-2d-web/blob/main/src/domain.ts): `src/domain.ts`
- [Game Content](https://github.com/tomtommao/wartale-2d-web/blob/main/src/data.ts): `src/data.ts`
- [Domain Types](https://github.com/tomtommao/wartale-2d-web/blob/main/src/types.ts): `src/types.ts`
- [Pixel Art](https://github.com/tomtommao/wartale-2d-web/blob/main/src/pixelArt.ts): `src/pixelArt.ts`
- [Scene and Item Art](https://github.com/tomtommao/wartale-2d-web/blob/main/src/gameArt.ts): `src/gameArt.ts`

### Other components

- **Player**

## Connections

- Player → UI Orchestration: uses (evidence: `README.md`)
- UI Orchestration → Phaser Game: starts (evidence: `src/main.ts`)
- UI Orchestration → Game State: loads and saves (evidence: `src/main.ts`)
- UI Orchestration → UI Helpers: renders with (evidence: `src/main.ts`)
- Phaser Game → Game State: reads and saves (evidence: `src/game.ts`)
- Phaser Game → Gameplay Rules: applies rules (evidence: `src/game.ts`)
- Gameplay Rules → Game Content: uses content (evidence: `src/domain.ts`)
- Game State → Gameplay Rules: serializes through (evidence: `src/store.ts`)
- Phaser Game → Locations and Rewards: enters and clears (evidence: `src/game.ts`)
- Phaser Game → Terrain and Paths: uses paths (evidence: `src/game.ts`)
- Terrain and Paths → Battle Grid: uses grid helpers (evidence: `src/worldMap.ts`)
- Locations and Rewards → Terrain and Paths: maps sites (evidence: `src/locations.ts`)
- Locations and Rewards → Company Systems: awards progression (evidence: `src/locations.ts`)
- Phaser Game → Company Systems: awards travel XP (evidence: `src/game.ts`)
- Phaser Game → Battle Grid: resolves movement (evidence: `src/game.ts`)
- Phaser Game → Battle Skills: uses combat skills (evidence: `src/game.ts`)
- Phaser Game → Animated Actors: animates actors (evidence: `src/game.ts`)
- World Art → Terrain and Paths: draws terrain (evidence: `src/worldArt.ts`)
- Phaser Game → Pixel Art: renders scenes (evidence: `src/game.ts`)
- UI Orchestration → Scene and Item Art: renders art (evidence: `src/main.ts`)
- Company Systems → Resource Costs: checks and spends (evidence: `src/systems.ts`)
- Forge and Upgrades → Locations and Rewards: checks proximity (evidence: `src/forging.ts`)
- Forge and Upgrades → Company Systems: uses professions (evidence: `src/forging.ts`)
- Forge and Upgrades → Resource Costs: checks and spends (evidence: `src/forging.ts`)
- UI Orchestration → Company Systems: manages camp (evidence: `src/main.ts`)
- UI Orchestration → Forge and Upgrades: opens workshop (evidence: `README.md`)
- UI Orchestration → Locations and Rewards: offers exploration (evidence: `README.md`)
- UI Orchestration → World Art: shows overworld (evidence: `README.md`)
- UI Orchestration → Domain Types: uses domain types (evidence: `src/main.ts`)
