# dvssray/i2p2-final-project architecture

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

- Interactive diagram: https://gitdiagram.com/dvssray/i2p2-final-project
- Repository: https://github.com/dvssray/i2p2-final-project

## Overview

This tree contains a C++ Allegro tower-defense game split into client and server copies, with gameplay scenes, towers, enemies, projectiles, effects, and a networking layer. The intended player workflow is to enter the game, select a stage, defend it, and reach a win/loss or score flow. However, the shown client main() only configures logging and obtains the engine singleton; it does not start the game, so that workflow is architectural intent rather than a verified live entry path. Edges below are limited to indexed references and explicit engine excerpts; some scene details remain unsampled.

Main entry points: [`2025_I2P2_ final_project_client/Scene/PlayScene.cpp`](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Scene/PlayScene.cpp) (Play scene), [`2025_I2P2_ final_project_client/Enemy/Enemy.cpp`](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Enemy/Enemy.cpp) (Enemy types), [`2025_I2P2_ final_project_client/Engine/GameEngine.cpp`](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/GameEngine.cpp) (Game engine), [`2025_I2P2_ final_project_client/Engine/Group.cpp`](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/Group.cpp) (Scene groups)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Game runtime"]
  node_client_main["Client entry<br/>[main.cpp]"]
  node_scene_flow["Menu and results"]
end

subgraph group_gameplay["Tower defense"]
  node_play_scene["Play scene<br/>[PlayScene.cpp]"]
  node_turrets["Turrets<br/>[Turret.cpp]"]
  node_enemies["Enemy types<br/>[Enemy.cpp]"]
  node_bullets["Projectiles<br/>[Bullet.cpp]"]
  node_effects["Effects"]
end

subgraph group_engine["Game framework"]
  node_scene_groups["Scene groups<br/>[Group.cpp]"]
  node_scene_base["Scene base<br/>[IScene.cpp]"]
  node_objects["Game objects<br/>[IObject.cpp]"]
  node_game_engine["Game engine<br/>[GameEngine.cpp]"]
  node_resources["Assets and audio<br/>[Resources.cpp]"]
end

subgraph group_network["Network play"]
  node_client_net["Game client<br/>[Client.cpp]"]
  node_remote_scene["Remote play"]
  node_render_sender["Render sender<br/>[RenderSender.cpp]"]
  node_server_engine["Server engine<br/>[GameEngine.cpp]"]
end

node_player(("Player"))

node_player -.->|"starts"| node_client_main
node_client_main -->|"obtains instance"| node_game_engine
node_game_engine -.->|"switches scenes"| node_scene_flow
node_game_engine -->|"dispatches input"| node_scene_base
node_scene_base -->|"inherits"| node_scene_groups
node_scene_groups -->|"updates and draws"| node_objects
node_play_scene -->|"creates enemy types"| node_enemies
node_play_scene -->|"creates turrets"| node_turrets
node_enemies -->|"tracks projectiles"| node_bullets
node_enemies -->|"tracks locked towers"| node_turrets
node_enemies -->|"uses effects"| node_effects
node_play_scene -.->|"holds gameplay groups"| node_scene_groups
node_play_scene -->|"loads assets"| node_resources
node_play_scene -.->|"offers remote mode"| node_remote_scene
node_remote_scene -.->|"uses client connection"| node_client_net
node_server_engine -->|"starts sender"| node_render_sender
node_server_engine -->|"sends frames"| node_render_sender

click node_client_main "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/main.cpp"
click node_scene_flow "https://github.com/dvssray/i2p2-final-project/tree/main/2025_I2P2_%20final_project_client/Scene"
click node_play_scene "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Scene/PlayScene.cpp"
click node_turrets "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Turret/Turret.cpp"
click node_enemies "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Enemy/Enemy.cpp"
click node_bullets "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Bullet/Bullet.cpp"
click node_effects "https://github.com/dvssray/i2p2-final-project/tree/main/2025_I2P2_%20final_project_client/UI/Animation"
click node_scene_groups "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/Group.cpp"
click node_scene_base "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/IScene.cpp"
click node_objects "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/IObject.cpp"
click node_game_engine "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/GameEngine.cpp"
click node_resources "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/Resources.cpp"
click node_client_net "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Connect/Client.cpp"
click node_remote_scene "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Scene/RemotePlayScene.cpp"
click node_render_sender "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_server/Connect/RenderSender.cpp"
click node_server_engine "https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_server/Engine/GameEngine.cpp"

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_client_main,node_scene_flow toneBlue
class node_play_scene,node_turrets,node_enemies,node_bullets,node_effects toneAmber
class node_scene_groups,node_scene_base,node_objects,node_game_engine,node_resources toneMint
class node_client_net,node_remote_scene,node_render_sender,node_server_engine toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Client entry](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/main.cpp): `2025_I2P2_ final_project_client/main.cpp`
- [Menu and results](https://github.com/dvssray/i2p2-final-project/tree/main/2025_I2P2_%20final_project_client/Scene): `2025_I2P2_ final_project_client/Scene`

### Tower defense

- [Play scene](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Scene/PlayScene.cpp): `2025_I2P2_ final_project_client/Scene/PlayScene.cpp`
- [Turrets](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Turret/Turret.cpp): `2025_I2P2_ final_project_client/Turret/Turret.cpp`
- [Enemy types](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Enemy/Enemy.cpp): `2025_I2P2_ final_project_client/Enemy/Enemy.cpp`
- [Projectiles](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Bullet/Bullet.cpp): `2025_I2P2_ final_project_client/Bullet/Bullet.cpp`
- [Effects](https://github.com/dvssray/i2p2-final-project/tree/main/2025_I2P2_%20final_project_client/UI/Animation): `2025_I2P2_ final_project_client/UI/Animation`

### Game framework

- [Scene groups](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/Group.cpp): `2025_I2P2_ final_project_client/Engine/Group.cpp`
- [Scene base](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/IScene.cpp): `2025_I2P2_ final_project_client/Engine/IScene.cpp`
- [Game objects](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/IObject.cpp): `2025_I2P2_ final_project_client/Engine/IObject.cpp`
- [Game engine](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/GameEngine.cpp): `2025_I2P2_ final_project_client/Engine/GameEngine.cpp`
- [Assets and audio](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Engine/Resources.cpp): `2025_I2P2_ final_project_client/Engine/Resources.cpp`

### Network play

- [Game client](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Connect/Client.cpp): `2025_I2P2_ final_project_client/Connect/Client.cpp`
- [Remote play](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_client/Scene/RemotePlayScene.cpp): `2025_I2P2_ final_project_client/Scene/RemotePlayScene.cpp`
- [Render sender](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_server/Connect/RenderSender.cpp): `2025_I2P2_ final_project_server/Connect/RenderSender.cpp`
- [Server engine](https://github.com/dvssray/i2p2-final-project/blob/main/2025_I2P2_%20final_project_server/Engine/GameEngine.cpp): `2025_I2P2_ final_project_server/Engine/GameEngine.cpp`

### Other components

- **Player**

## Connections

- Player → Client entry: starts
- Client entry → Game engine: obtains instance (evidence: `2025_I2P2_ final_project_client/main.cpp`)
- Game engine → Menu and results: switches scenes
- Game engine → Scene base: dispatches input (evidence: `2025_I2P2_ final_project_client/Engine/GameEngine.cpp`)
- Scene base → Scene groups: inherits
- Scene groups → Game objects: updates and draws
- Play scene → Enemy types: creates enemy types (evidence: `2025_I2P2_ final_project_client/Scene/PlayScene.cpp`)
- Play scene → Turrets: creates turrets (evidence: `2025_I2P2_ final_project_client/Scene/PlayScene.cpp`)
- Enemy types → Projectiles: tracks projectiles (evidence: `2025_I2P2_ final_project_client/Enemy/Enemy.cpp`)
- Enemy types → Turrets: tracks locked towers (evidence: `2025_I2P2_ final_project_client/Enemy/Enemy.cpp`)
- Enemy types → Effects: uses effects (evidence: `2025_I2P2_ final_project_client/Enemy/Enemy.cpp`)
- Play scene → Scene groups: holds gameplay groups
- Play scene → Assets and audio: loads assets (evidence: `2025_I2P2_ final_project_client/Scene/PlayScene.cpp`)
- Play scene → Remote play: offers remote mode
- Remote play → Game client: uses client connection
- Server engine → Render sender: starts sender (evidence: `2025_I2P2_ final_project_server/Engine/GameEngine.cpp`)
- Server engine → Render sender: sends frames (evidence: `2025_I2P2_ final_project_server/Engine/GameEngine.cpp`)
