# joch-21/dsp_projec architecture

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

- Interactive diagram: https://gitdiagram.com/joch-21/dsp_projec
- Repository: https://github.com/joch-21/dsp_projec

## Overview

Copperline is an SFML-based tower-defense/strategy game. A player acts through the real-time UI; the Game session coordinates map construction, technology unlocks, resource production, enemy waves and combat, with save/load and build undo supporting the session. The graph preserves those distinct domain stages and the collection structures that support map, wave, resource and command state. Evidence is limited to the supplied excerpts and SOURCE INDEX; some runtime call paths are therefore shown as unverified rather than asserted.

Main entry points: [`dsp_proj/Game.cpp`](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Game.cpp) (Game Session), [`dsp_proj/Map.cpp`](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Map.cpp) (Map and Tech), [`dsp_proj/SaveService.cpp`](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SaveService.cpp) (Save Service), [`dsp_proj/ResourceStore.cpp`](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/ResourceStore.cpp) (Resource Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Player Experience"]
  node_ui["Realtime UI<br/>[GameUI.cpp]"]
end

subgraph group_simulation["Game Simulation"]
  node_session["Game Session<br/>[Game.cpp]"]
  node_visitor["Building Visitors"]
  node_commands["Build Undo<br/>[CommandManager.cpp]"]
  node_save["Save Service<br/>[SaveService.cpp]"]
end

subgraph group_domain["Game Domain"]
  node_map["Map and Tech<br/>[Map.cpp]"]
  node_buildings["Buildings<br/>[Building.cpp]"]
  node_resources[("Resource Store<br/>[ResourceStore.cpp]")]
  node_waves["Wave Manager<br/>[WaveManager.cpp]"]
  node_spawn["Spawn Events<br/>[SpawnEvent.h]"]
  node_enemy["Enemy State<br/>[Enemy.h]"]
  node_savefile["Save File<br/>[savegame.txt]"]
end

subgraph group_structures["Data Structures"]
  node_list["Linked List<br/>[List.h]"]
  node_dnode["Doubly Linked Node<br/>[DoublyLinkedNode.h]"]
  node_diter["List Iterator"]
  node_btree["Binary Tree<br/>[BTree.h]"]
  node_queue["Queue<br/>[Queue.h]"]
  node_stack["Stack<br/>[Stack.h]"]
  node_snode["Singly Linked Node<br/>[SinglyLinkedNode.h]"]
end

node_player(("Player"))

node_player -->|"plays through"| node_ui
node_ui -.->|"requests actions"| node_session
node_session -.->|"manages map"| node_map
node_session -.->|"manages resources"| node_resources
node_session -.->|"manages waves"| node_waves
node_session -.->|"records builds"| node_commands
node_session -.->|"delegates saves"| node_save
node_session -.->|"runs production"| node_visitor
node_map -->|"stores buildings"| node_buildings
node_map -->|"spends unlock costs"| node_resources
node_map -->|"stores buildings in"| node_list
node_map -->|"models tech with"| node_btree
node_list -->|"links elements"| node_dnode
node_list -->|"iterates via"| node_diter
node_waves -->|"queues waves"| node_queue
node_waves -->|"creates events"| node_spawn
node_visitor -->|"visits types"| node_buildings
node_visitor -.->|"updates production"| node_resources
node_commands -->|"stores undo history"| node_stack
node_commands -->|"records build types"| node_buildings
node_save -->|"serializes map"| node_map
node_save -->|"serializes resources"| node_resources
node_save -->|"serializes wave state"| node_waves
node_save -.->|"reads and writes"| node_savefile
node_resources -->|"chains buckets with"| node_snode
node_ui -->|"renders buildings"| node_buildings
node_ui -.->|"tracks combat state"| node_enemy

click node_ui "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/GameUI.cpp"
click node_session "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Game.cpp"
click node_map "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Map.cpp"
click node_buildings "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Building.cpp"
click node_visitor "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/BuildingVisitor.cpp"
click node_resources "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/ResourceStore.cpp"
click node_waves "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/WaveManager.cpp"
click node_spawn "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SpawnEvent.h"
click node_enemy "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Enemy.h"
click node_commands "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/CommandManager.cpp"
click node_save "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SaveService.cpp"
click node_savefile "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/savegame.txt"
click node_list "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/List.h"
click node_dnode "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/DoublyLinkedNode.h"
click node_diter "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/DoublyLinkedNodeIterator.h"
click node_btree "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/BTree.h"
click node_queue "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Queue.h"
click node_stack "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Stack.h"
click node_snode "https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SinglyLinkedNode.h"

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_ui toneBlue
class node_session,node_visitor,node_commands,node_save toneAmber
class node_map,node_buildings,node_resources,node_waves,node_spawn,node_enemy,node_savefile toneMint
class node_list,node_dnode,node_diter,node_btree,node_queue,node_stack,node_snode toneRose
class node_player toneIndigo
```

## Components

### Player Experience

- [Realtime UI](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/GameUI.cpp): `dsp_proj/GameUI.cpp`

### Game Simulation

- [Game Session](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Game.cpp): `dsp_proj/Game.cpp`
- [Building Visitors](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/BuildingVisitor.cpp): `dsp_proj/BuildingVisitor.cpp`
- [Build Undo](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/CommandManager.cpp): `dsp_proj/CommandManager.cpp`
- [Save Service](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SaveService.cpp): `dsp_proj/SaveService.cpp`

### Game Domain

- [Map and Tech](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Map.cpp): `dsp_proj/Map.cpp`
- [Buildings](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Building.cpp): `dsp_proj/Building.cpp`
- [Resource Store](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/ResourceStore.cpp): `dsp_proj/ResourceStore.cpp`
- [Wave Manager](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/WaveManager.cpp): `dsp_proj/WaveManager.cpp`
- [Spawn Events](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SpawnEvent.h): `dsp_proj/SpawnEvent.h`
- [Enemy State](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Enemy.h): `dsp_proj/Enemy.h`
- [Save File](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/savegame.txt): `dsp_proj/savegame.txt`

### Data Structures

- [Linked List](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/List.h): `dsp_proj/List.h`
- [Doubly Linked Node](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/DoublyLinkedNode.h): `dsp_proj/DoublyLinkedNode.h`
- [List Iterator](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/DoublyLinkedNodeIterator.h): `dsp_proj/DoublyLinkedNodeIterator.h`
- [Binary Tree](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/BTree.h): `dsp_proj/BTree.h`
- [Queue](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Queue.h): `dsp_proj/Queue.h`
- [Stack](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/Stack.h): `dsp_proj/Stack.h`
- [Singly Linked Node](https://github.com/joch-21/dsp_projec/blob/main/dsp_proj/SinglyLinkedNode.h): `dsp_proj/SinglyLinkedNode.h`

### Other components

- **Player**

## Connections

- Player → Realtime UI: plays through
- Realtime UI → Game Session: requests actions
- Game Session → Map and Tech: manages map
- Game Session → Resource Store: manages resources
- Game Session → Wave Manager: manages waves
- Game Session → Build Undo: records builds
- Game Session → Save Service: delegates saves
- Game Session → Building Visitors: runs production
- Map and Tech → Buildings: stores buildings
- Map and Tech → Resource Store: spends unlock costs
- Map and Tech → Linked List: stores buildings in
- Map and Tech → Binary Tree: models tech with
- Linked List → Doubly Linked Node: links elements (evidence: `dsp_proj/List.h`)
- Linked List → List Iterator: iterates via (evidence: `dsp_proj/List.h`)
- Wave Manager → Queue: queues waves
- Wave Manager → Spawn Events: creates events (evidence: `dsp_proj/WaveManager.cpp`)
- Building Visitors → Buildings: visits types
- Building Visitors → Resource Store: updates production
- Build Undo → Stack: stores undo history
- Build Undo → Buildings: records build types
- Save Service → Map and Tech: serializes map
- Save Service → Resource Store: serializes resources
- Save Service → Wave Manager: serializes wave state
- Save Service → Save File: reads and writes
- Resource Store → Singly Linked Node: chains buckets with
- Realtime UI → Buildings: renders buildings (evidence: `dsp_proj/GameUI.cpp`)
- Realtime UI → Enemy State: tracks combat state
