# redstoneteddy/the-last-assembly architecture

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

- Interactive diagram: https://gitdiagram.com/redstoneteddy/the-last-assembly
- Repository: https://github.com/redstoneteddy/the-last-assembly

## Overview

The Last Assembly is a Pygame roguelite tower-defense game. A run starts with map and difficulty selection, moves through a shop/build phase, then spawns increasingly difficult enemy waves against the player’s defenses; earnings and unlocks support replay. The graph preserves the documented customization systems and the runtime state, rendering, and statistics layers. Some subsystem links are documented in the README or SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`main.py`](https://github.com/redstoneteddy/the-last-assembly/blob/main/main.py) (Game loop), [`shop/main.py`](https://github.com/redstoneteddy/the-last-assembly/blob/main/shop/main.py) (Shop phase), [`data_class.py`](https://github.com/redstoneteddy/the-last-assembly/blob/main/data_class.py) (Game state), [`mods/building.py`](https://github.com/redstoneteddy/the-last-assembly/blob/main/mods/building.py) (Mods)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run flow"]
  node_main["Game loop<br/>[main.py]"]
  node_menus["Menus<br/>[main_menu.py]"]
  node_mapselect["Map selection<br/>[map_selection.py]"]
  node_mapdata["Map and paths<br/>[map_info.py]"]
  node_shop["Shop phase<br/>[main.py]"]
  node_collection["Collection menu<br/>[collection.py]"]
end

subgraph group_combat["Battle systems"]
  node_waves["Wave generation<br/>[wave_gen.py]"]
  node_wavehandler["Wave control<br/>[wave_handler.py]"]
  node_enemies["Enemy movement<br/>[move.py]"]
  node_enemydata["Enemy state"]
  node_towers["Tower behavior<br/>[base.py]"]
  node_towerfire["Tower shooting<br/>[shooting.py]"]
end

subgraph group_custom["Shop and builds"]
  node_zones["Zones<br/>[building.py]"]
  node_specialists["Specialists<br/>[base.py]"]
  node_mods["Mods<br/>[building.py]"]
  node_events["Events<br/>[building.py]"]
  node_eventdata["Event definitions<br/>[info_data.py]"]
  node_moddata["Mod definitions<br/>[info_data.py]"]
end

subgraph group_support["State and presentation"]
  node_state["Game state<br/>[data_class.py]"]
  node_rendering["Battle rendering<br/>[towers.py]"]
  node_hud["HUD<br/>[hud.py]"]
  node_stats["Run statistics<br/>[statistic.py]"]
  node_audio["Sound effects<br/>[sfx.py]"]
end

node_player(("Player"))

node_player -->|"opens game"| node_menus
node_player -->|"chooses map"| node_mapselect
node_mapselect -->|"selects map"| node_mapdata
node_player -->|"buys items"| node_shop
node_shop -->|"offers towers"| node_towers
node_shop -->|"offers specialists"| node_specialists
node_shop -->|"offers mods"| node_mods
node_shop -->|"offers zones"| node_zones
node_shop -->|"offers events"| node_events
node_events -->|"loads definitions"| node_eventdata
node_mods -->|"loads definitions"| node_moddata
node_main -->|"initializes state"| node_state
node_main -->|"ticks waves"| node_wavehandler
node_wavehandler -->|"generates waves"| node_waves
node_main -->|"moves enemies"| node_enemies
node_enemies -->|"updates state"| node_enemydata
node_main -->|"runs placement"| node_zones
node_main -->|"runs placement"| node_mods
node_main -->|"runs placement"| node_events
node_towers -->|"delegates shooting"| node_towerfire
node_main -->|"draws towers"| node_rendering
node_main -->|"draws HUD"| node_hud
node_main -->|"updates statistics"| node_stats
node_main -->|"updates sound"| node_audio
node_player -->|"views unlocks"| node_collection
node_state -->|"holds enemy state"| node_enemydata
node_state -->|"owns run statistics"| node_stats
node_state -->|"owns sound system"| node_audio

click node_main "https://github.com/redstoneteddy/the-last-assembly/blob/main/main.py"
click node_menus "https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/main_menu.py"
click node_mapselect "https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/map_selection.py"
click node_mapdata "https://github.com/redstoneteddy/the-last-assembly/blob/main/map/map_info.py"
click node_shop "https://github.com/redstoneteddy/the-last-assembly/blob/main/shop/main.py"
click node_waves "https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/wave_gen.py"
click node_wavehandler "https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/wave_handler.py"
click node_enemies "https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/move.py"
click node_enemydata "https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/enemy_data_class.py"
click node_towers "https://github.com/redstoneteddy/the-last-assembly/blob/main/towers/base_tower/base.py"
click node_towerfire "https://github.com/redstoneteddy/the-last-assembly/blob/main/towers/base_tower/shooting.py"
click node_zones "https://github.com/redstoneteddy/the-last-assembly/blob/main/zones/building.py"
click node_specialists "https://github.com/redstoneteddy/the-last-assembly/blob/main/specialists/base/base.py"
click node_mods "https://github.com/redstoneteddy/the-last-assembly/blob/main/mods/building.py"
click node_events "https://github.com/redstoneteddy/the-last-assembly/blob/main/events/building.py"
click node_eventdata "https://github.com/redstoneteddy/the-last-assembly/blob/main/events/info_data.py"
click node_moddata "https://github.com/redstoneteddy/the-last-assembly/blob/main/mods/info_data.py"
click node_state "https://github.com/redstoneteddy/the-last-assembly/blob/main/data_class.py"
click node_rendering "https://github.com/redstoneteddy/the-last-assembly/blob/main/renderer/towers.py"
click node_hud "https://github.com/redstoneteddy/the-last-assembly/blob/main/renderer/hud.py"
click node_stats "https://github.com/redstoneteddy/the-last-assembly/blob/main/statistic/statistic.py"
click node_audio "https://github.com/redstoneteddy/the-last-assembly/blob/main/sound/sfx.py"
click node_collection "https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/collection.py"

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_menus,node_mapselect,node_mapdata,node_shop,node_collection toneBlue
class node_waves,node_wavehandler,node_enemies,node_enemydata,node_towers,node_towerfire toneAmber
class node_zones,node_specialists,node_mods,node_events,node_eventdata,node_moddata toneMint
class node_state,node_rendering,node_hud,node_stats,node_audio toneRose
class node_player toneIndigo
```

## Components

### Run flow

- [Game loop](https://github.com/redstoneteddy/the-last-assembly/blob/main/main.py): `main.py`
- [Menus](https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/main_menu.py): `menu/main_menu.py`
- [Map selection](https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/map_selection.py): `menu/map_selection.py`
- [Map and paths](https://github.com/redstoneteddy/the-last-assembly/blob/main/map/map_info.py): `map/map_info.py`
- [Shop phase](https://github.com/redstoneteddy/the-last-assembly/blob/main/shop/main.py): `shop/main.py`
- [Collection menu](https://github.com/redstoneteddy/the-last-assembly/blob/main/menu/collection.py): `menu/collection.py`

### Battle systems

- [Wave generation](https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/wave_gen.py): `enemy/wave_gen.py`
- [Wave control](https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/wave_handler.py): `enemy/wave_handler.py`
- [Enemy movement](https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/move.py): `enemy/move.py`
- [Enemy state](https://github.com/redstoneteddy/the-last-assembly/blob/main/enemy/enemy_data_class.py): `enemy/enemy_data_class.py`
- [Tower behavior](https://github.com/redstoneteddy/the-last-assembly/blob/main/towers/base_tower/base.py): `towers/base_tower/base.py`
- [Tower shooting](https://github.com/redstoneteddy/the-last-assembly/blob/main/towers/base_tower/shooting.py): `towers/base_tower/shooting.py`

### Shop and builds

- [Zones](https://github.com/redstoneteddy/the-last-assembly/blob/main/zones/building.py): `zones/building.py`
- [Specialists](https://github.com/redstoneteddy/the-last-assembly/blob/main/specialists/base/base.py): `specialists/base/base.py`
- [Mods](https://github.com/redstoneteddy/the-last-assembly/blob/main/mods/building.py): `mods/building.py`
- [Events](https://github.com/redstoneteddy/the-last-assembly/blob/main/events/building.py): `events/building.py`
- [Event definitions](https://github.com/redstoneteddy/the-last-assembly/blob/main/events/info_data.py): `events/info_data.py`
- [Mod definitions](https://github.com/redstoneteddy/the-last-assembly/blob/main/mods/info_data.py): `mods/info_data.py`

### State and presentation

- [Game state](https://github.com/redstoneteddy/the-last-assembly/blob/main/data_class.py): `data_class.py`
- [Battle rendering](https://github.com/redstoneteddy/the-last-assembly/blob/main/renderer/towers.py): `renderer/towers.py`
- [HUD](https://github.com/redstoneteddy/the-last-assembly/blob/main/renderer/hud.py): `renderer/hud.py`
- [Run statistics](https://github.com/redstoneteddy/the-last-assembly/blob/main/statistic/statistic.py): `statistic/statistic.py`
- [Sound effects](https://github.com/redstoneteddy/the-last-assembly/blob/main/sound/sfx.py): `sound/sfx.py`

### Other components

- **Player**

## Connections

- Player → Menus: opens game (evidence: `readme.md`)
- Player → Map selection: chooses map (evidence: `readme.md`)
- Map selection → Map and paths: selects map (evidence: `readme.md`)
- Player → Shop phase: buys items (evidence: `readme.md`)
- Shop phase → Tower behavior: offers towers (evidence: `shop/main.py`)
- Shop phase → Specialists: offers specialists (evidence: `shop/main.py`)
- Shop phase → Mods: offers mods (evidence: `shop/main.py`)
- Shop phase → Zones: offers zones (evidence: `shop/main.py`)
- Shop phase → Events: offers events (evidence: `shop/main.py`)
- Events → Event definitions: loads definitions (evidence: `events/building.py`)
- Mods → Mod definitions: loads definitions (evidence: `mods/building.py`)
- Game loop → Game state: initializes state (evidence: `main.py`)
- Game loop → Wave control: ticks waves (evidence: `main.py`)
- Wave control → Wave generation: generates waves (evidence: `enemy/wave_handler.py`)
- Game loop → Enemy movement: moves enemies (evidence: `main.py`)
- Enemy movement → Enemy state: updates state (evidence: `enemy/move.py`)
- Game loop → Zones: runs placement (evidence: `main.py`)
- Game loop → Mods: runs placement (evidence: `main.py`)
- Game loop → Events: runs placement (evidence: `main.py`)
- Tower behavior → Tower shooting: delegates shooting (evidence: `towers/base_tower/base.py`)
- Game loop → Battle rendering: draws towers (evidence: `main.py`)
- Game loop → HUD: draws HUD (evidence: `main.py`)
- Game loop → Run statistics: updates statistics (evidence: `main.py`)
- Game loop → Sound effects: updates sound (evidence: `main.py`)
- Player → Collection menu: views unlocks (evidence: `readme.md`)
- Game state → Enemy state: holds enemy state (evidence: `data_class.py`)
- Game state → Run statistics: owns run statistics (evidence: `data_class.py`)
- Game state → Sound effects: owns sound system (evidence: `data_class.py`)
