# jirajiran/theddos_game architecture

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

- Interactive diagram: https://gitdiagram.com/jirajiran/theddos_game
- Repository: https://github.com/jirajiran/theddos_game

## Overview

This repository is a browser-based real-time combat game with an integrated map editor. The main player workflow enters through the application shell, loads a play map and session, then accepts input while the simulation updates combat and world state and the view renders the result. The graph preserves the documented editor, data-driven definitions, AI, inventory, vehicles, audio, and interface branches. Source excerpts are partial; links between unsampled subsystems are omitted unless the SOURCE INDEX or excerpts establish them.

Main entry points: [`js/sim.js`](https://github.com/jirajiran/theddos_game/blob/main/js/sim.js) (Simulation loop), [`js/app.js`](https://github.com/jirajiran/theddos_game/blob/main/js/app.js) (Application shell), [`js/world/applyEditorMap.js`](https://github.com/jirajiran/theddos_game/blob/main/js/world/applyEditorMap.js) (Apply editor map), [`js/sim/fire.js`](https://github.com/jirajiran/theddos_game/blob/main/js/sim/fire.js) (Projectile combat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and sessions"]
  node_app["Application shell<br/>[app.js]"]
  node_entry["Browser entry<br/>[main.js]"]
  node_session["Session loading"]
  node_play["Play session<br/>[playSession.js]"]
  node_input["Player input<br/>[input.js]"]
end

subgraph group_world["World and editor"]
  node_editor["Map editor<br/>[main.js]"]
  node_mapdoc["Map documents<br/>[mapDoc.js]"]
  node_mapview["Map view<br/>[mapView.js]"]
  node_applymap["Apply editor map<br/>[applyEditorMap.js]"]
  node_worldstate["World state<br/>[world.js]"]
  node_occupancy[("Occupancy grid<br/>[occupancy.js]")]
  node_pools[("Entity pools<br/>[pools.js]")]
end

subgraph group_simulation["Simulation and combat"]
  node_inventory["Inventory<br/>[inventory.js]"]
  node_sim["Simulation loop<br/>[sim.js]"]
  node_unit["Unit behavior<br/>[unit.js]"]
  node_fire["Projectile combat<br/>[fire.js]"]
  node_vehicle["Vehicle state<br/>[vehicle.js]"]
  node_combat["Combat mechanics"]
end

subgraph group_content["Definitions and AI"]
  node_definitions[("Definition registry<br/>[registry.js]")]
  node_gamepack["Game pack<br/>[gamePack.js]"]
  node_config["Shared config<br/>[config.js]"]
  node_ai["AI behavior"]
  node_sense[("Sense index<br/>[senseIndex.js]")]
  node_blackboard[("AI blackboard<br/>[blackboard.js]")]
  node_localgroup["Local group steering"]
end

subgraph group_presentation["UI and presentation"]
  node_ui["Game interface"]
  node_render["Rendering<br/>[render.js]"]
  node_unitvisual["Unit visuals<br/>[unitVisual.js]"]
  node_audio["Audio<br/>[sfx.js]"]
end

node_player(("Player"))
node_web["Asset requests"]

node_entry -->|"starts"| node_app
node_app -->|"loads session"| node_session
node_app -->|"creates input"| node_input
node_app -->|"creates play"| node_play
node_player -->|"provides input"| node_input
node_input -.->|"drives actions"| node_sim
node_play -->|"runs match"| node_sim
node_play -->|"uses inventory"| node_inventory
node_editor -->|"edits maps"| node_mapdoc
node_editor -->|"updates view"| node_mapview
node_editor -->|"starts test play"| node_session
node_session -.->|"loads map"| node_applymap
node_applymap -.->|"builds world"| node_worldstate
node_applymap -->|"sets occupancy"| node_occupancy
node_applymap -->|"sets pools"| node_pools
node_sim -->|"updates units"| node_unit
node_sim -->|"updates combat"| node_fire
node_sim -->|"updates world"| node_worldstate
node_sim -->|"uses index"| node_sense
node_unit -->|"uses behavior"| node_ai
node_unit -->|"delegates steering"| node_localgroup
node_localgroup -->|"writes goals"| node_blackboard
node_localgroup -->|"checks hostility"| node_sense
node_fire -->|"deactivates shots"| node_pools
node_fire -->|"uses mechanics"| node_combat
node_fire -->|"plays effects"| node_audio
node_vehicle -->|"reads cells"| node_occupancy
node_vehicle -->|"delegates movement"| node_sim
node_config -->|"looks up data"| node_definitions
node_gamepack -->|"reads rules"| node_definitions
node_gamepack -->|"supplies teams"| node_sense
node_inventory -->|"resolves items"| node_config
node_inventory -->|"checks shields"| node_combat
node_ui -->|"uses visuals"| node_unitvisual
node_unitvisual -->|"reads equipment"| node_inventory
node_unitvisual -.->|"loads art"| node_web
node_audio -->|"fetches audio"| node_web
node_sim -.->|"renders state"| node_render

click node_app "https://github.com/jirajiran/theddos_game/blob/main/js/app.js"
click node_entry "https://github.com/jirajiran/theddos_game/blob/main/js/main.js"
click node_session "https://github.com/jirajiran/theddos_game/tree/main/js/session"
click node_play "https://github.com/jirajiran/theddos_game/blob/main/js/app/playSession.js"
click node_input "https://github.com/jirajiran/theddos_game/blob/main/js/player/input.js"
click node_inventory "https://github.com/jirajiran/theddos_game/blob/main/js/player/inventory.js"
click node_editor "https://github.com/jirajiran/theddos_game/blob/main/js/editor/main.js"
click node_mapdoc "https://github.com/jirajiran/theddos_game/blob/main/js/editor/mapDoc.js"
click node_mapview "https://github.com/jirajiran/theddos_game/blob/main/js/editor/mapView.js"
click node_applymap "https://github.com/jirajiran/theddos_game/blob/main/js/world/applyEditorMap.js"
click node_worldstate "https://github.com/jirajiran/theddos_game/blob/main/js/world/world.js"
click node_occupancy "https://github.com/jirajiran/theddos_game/blob/main/js/world/occupancy.js"
click node_pools "https://github.com/jirajiran/theddos_game/blob/main/js/world/pools.js"
click node_sim "https://github.com/jirajiran/theddos_game/blob/main/js/sim.js"
click node_unit "https://github.com/jirajiran/theddos_game/blob/main/js/sim/unit.js"
click node_fire "https://github.com/jirajiran/theddos_game/blob/main/js/sim/fire.js"
click node_vehicle "https://github.com/jirajiran/theddos_game/blob/main/js/sim/vehicle.js"
click node_combat "https://github.com/jirajiran/theddos_game/tree/main/js/combat"
click node_definitions "https://github.com/jirajiran/theddos_game/blob/main/js/defs/registry.js"
click node_gamepack "https://github.com/jirajiran/theddos_game/blob/main/js/defs/gamePack.js"
click node_config "https://github.com/jirajiran/theddos_game/blob/main/js/config.js"
click node_ai "https://github.com/jirajiran/theddos_game/tree/main/js/ai"
click node_sense "https://github.com/jirajiran/theddos_game/blob/main/js/ai/senseIndex.js"
click node_blackboard "https://github.com/jirajiran/theddos_game/blob/main/js/ai/blackboard.js"
click node_localgroup "https://github.com/jirajiran/theddos_game/blob/main/js/ai/local_group_manager.js"
click node_ui "https://github.com/jirajiran/theddos_game/tree/main/js/ui"
click node_render "https://github.com/jirajiran/theddos_game/blob/main/js/view/render.js"
click node_unitvisual "https://github.com/jirajiran/theddos_game/blob/main/js/view/unitVisual.js"
click node_audio "https://github.com/jirajiran/theddos_game/blob/main/js/audio/sfx.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_app,node_entry,node_session,node_play,node_input toneBlue
class node_editor,node_mapdoc,node_mapview,node_applymap,node_worldstate,node_occupancy,node_pools toneAmber
class node_inventory,node_sim,node_unit,node_fire,node_vehicle,node_combat,node_web toneMint
class node_definitions,node_gamepack,node_config,node_ai,node_sense,node_blackboard,node_localgroup toneRose
class node_ui,node_render,node_unitvisual,node_audio,node_player toneIndigo
```

## Components

### App and sessions

- [Application shell](https://github.com/jirajiran/theddos_game/blob/main/js/app.js): `js/app.js`
- [Browser entry](https://github.com/jirajiran/theddos_game/blob/main/js/main.js): `js/main.js`
- [Session loading](https://github.com/jirajiran/theddos_game/tree/main/js/session): `js/session`
- [Play session](https://github.com/jirajiran/theddos_game/blob/main/js/app/playSession.js): `js/app/playSession.js`
- [Player input](https://github.com/jirajiran/theddos_game/blob/main/js/player/input.js): `js/player/input.js`

### World and editor

- [Map editor](https://github.com/jirajiran/theddos_game/blob/main/js/editor/main.js): `js/editor/main.js`
- [Map documents](https://github.com/jirajiran/theddos_game/blob/main/js/editor/mapDoc.js): `js/editor/mapDoc.js`
- [Map view](https://github.com/jirajiran/theddos_game/blob/main/js/editor/mapView.js): `js/editor/mapView.js`
- [Apply editor map](https://github.com/jirajiran/theddos_game/blob/main/js/world/applyEditorMap.js): `js/world/applyEditorMap.js`
- [World state](https://github.com/jirajiran/theddos_game/blob/main/js/world/world.js): `js/world/world.js`
- [Occupancy grid](https://github.com/jirajiran/theddos_game/blob/main/js/world/occupancy.js): `js/world/occupancy.js`
- [Entity pools](https://github.com/jirajiran/theddos_game/blob/main/js/world/pools.js): `js/world/pools.js`

### Simulation and combat

- [Inventory](https://github.com/jirajiran/theddos_game/blob/main/js/player/inventory.js): `js/player/inventory.js`
- [Simulation loop](https://github.com/jirajiran/theddos_game/blob/main/js/sim.js): `js/sim.js`
- [Unit behavior](https://github.com/jirajiran/theddos_game/blob/main/js/sim/unit.js): `js/sim/unit.js`
- [Projectile combat](https://github.com/jirajiran/theddos_game/blob/main/js/sim/fire.js): `js/sim/fire.js`
- [Vehicle state](https://github.com/jirajiran/theddos_game/blob/main/js/sim/vehicle.js): `js/sim/vehicle.js`
- [Combat mechanics](https://github.com/jirajiran/theddos_game/tree/main/js/combat): `js/combat`

### Definitions and AI

- [Definition registry](https://github.com/jirajiran/theddos_game/blob/main/js/defs/registry.js): `js/defs/registry.js`
- [Game pack](https://github.com/jirajiran/theddos_game/blob/main/js/defs/gamePack.js): `js/defs/gamePack.js`
- [Shared config](https://github.com/jirajiran/theddos_game/blob/main/js/config.js): `js/config.js`
- [AI behavior](https://github.com/jirajiran/theddos_game/tree/main/js/ai): `js/ai`
- [Sense index](https://github.com/jirajiran/theddos_game/blob/main/js/ai/senseIndex.js): `js/ai/senseIndex.js`
- [AI blackboard](https://github.com/jirajiran/theddos_game/blob/main/js/ai/blackboard.js): `js/ai/blackboard.js`
- [Local group steering](https://github.com/jirajiran/theddos_game/blob/main/js/ai/local_group_manager.js): `js/ai/local_group_manager.js`

### UI and presentation

- [Game interface](https://github.com/jirajiran/theddos_game/tree/main/js/ui): `js/ui`
- [Rendering](https://github.com/jirajiran/theddos_game/blob/main/js/view/render.js): `js/view/render.js`
- [Unit visuals](https://github.com/jirajiran/theddos_game/blob/main/js/view/unitVisual.js): `js/view/unitVisual.js`
- [Audio](https://github.com/jirajiran/theddos_game/blob/main/js/audio/sfx.js): `js/audio/sfx.js`

### Other components

- **Player**
- **Asset requests**

## Connections

- Browser entry → Application shell: starts (evidence: `js/main.js`)
- Application shell → Session loading: loads session (evidence: `js/app.js`)
- Application shell → Player input: creates input (evidence: `js/app.js`)
- Application shell → Play session: creates play (evidence: `js/app.js`)
- Player → Player input: provides input
- Player input → Simulation loop: drives actions
- Play session → Simulation loop: runs match (evidence: `js/app/playSession.js`)
- Play session → Inventory: uses inventory (evidence: `js/app/playSession.js`)
- Map editor → Map documents: edits maps (evidence: `js/editor/main.js`)
- Map editor → Map view: updates view (evidence: `js/editor/main.js`)
- Map editor → Session loading: starts test play (evidence: `js/editor/main.js`)
- Session loading → Apply editor map: loads map
- Apply editor map → World state: builds world (evidence: `js/world/applyEditorMap.js`)
- Apply editor map → Occupancy grid: sets occupancy (evidence: `js/world/applyEditorMap.js`)
- Apply editor map → Entity pools: sets pools (evidence: `js/world/applyEditorMap.js`)
- Simulation loop → Unit behavior: updates units (evidence: `js/sim.js`)
- Simulation loop → Projectile combat: updates combat (evidence: `js/sim.js`)
- Simulation loop → World state: updates world (evidence: `js/sim.js`)
- Simulation loop → Sense index: uses index (evidence: `js/sim.js`)
- Unit behavior → AI behavior: uses behavior (evidence: `js/sim/unit.js`)
- Unit behavior → Local group steering: delegates steering (evidence: `js/sim/unit.js`)
- Local group steering → AI blackboard: writes goals (evidence: `js/ai/local_group_manager.js`)
- Local group steering → Sense index: checks hostility (evidence: `js/ai/local_group_manager.js`)
- Projectile combat → Entity pools: deactivates shots (evidence: `js/sim/fire.js`)
- Projectile combat → Combat mechanics: uses mechanics (evidence: `js/sim/fire.js`)
- Projectile combat → Audio: plays effects (evidence: `js/sim/fire.js`)
- Vehicle state → Occupancy grid: reads cells (evidence: `js/sim/vehicle.js`)
- Vehicle state → Simulation loop: delegates movement (evidence: `js/sim/vehicle.js`)
- Shared config → Definition registry: looks up data (evidence: `js/config.js`)
- Game pack → Definition registry: reads rules (evidence: `js/defs/gamePack.js`)
- Game pack → Sense index: supplies teams (evidence: `js/ai/senseIndex.js`)
- Inventory → Shared config: resolves items (evidence: `js/player/inventory.js`)
- Inventory → Combat mechanics: checks shields (evidence: `js/player/inventory.js`)
- Game interface → Unit visuals: uses visuals (evidence: `js/ui/play/panels.js`)
- Unit visuals → Inventory: reads equipment (evidence: `js/view/unitVisual.js`)
- Unit visuals → Asset requests: loads art
- Audio → Asset requests: fetches audio (evidence: `js/audio/sfx.js`)
- Simulation loop → Rendering: renders state
