# beghelli/comp4300-game-programming-course architecture

> Architecture diagram of the GitHub repository beghelli/comp4300-game-programming-course, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beghelli/comp4300-game-programming-course
- Repository: https://github.com/beghelli/comp4300-game-programming-course

## Overview

This repository contains successive COMP4300 game-development assignments; the sampled runtime centers on assignment 2, an SFML arcade game. Its workflow is configuration and window setup, player and enemy creation, per-frame input and gameplay systems, then rendering. Entity components hold game state, while the entity manager owns collections. The tree and excerpts do not establish assignment 1’s behavior, so it remains a separate, unconnected node. The README describes the course context and SFML requirement, not additional gameplay features.

Main entry points: [`assignment-2/src/Game.cpp`](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Game.cpp) (Game loop), [`assignment-2/src/Entity.h`](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Entity.h) (Entity and components), [`assignment-2/src/SEnemySpawner.cpp`](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SEnemySpawner.cpp) (Enemy spawning), [`assignment-2/src/EntityManager.cpp`](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/EntityManager.cpp) (Entity manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_player["Player setup<br/>[Game.cpp]"]
  node_loop["Game loop<br/>[Game.cpp]"]
  node_config["Game configuration<br/>[Config.cpp]"]
end

subgraph group_entities["Entity model"]
  node_manager["Entity manager<br/>[EntityManager.cpp]"]
  node_entity["Entity and components<br/>[Entity.h]"]
  node_vector["2D vector<br/>[Vec2.cpp]"]
  node_collision_component["Collision component<br/>[CCollision.h]"]
  node_life_component["Entity-life component<br/>[CEntityLife.h]"]
  node_mouse_component["Mouse-input component<br/>[CMouseInput.h]"]
  node_shape_component["Shape component<br/>[CShape.h]"]
  node_shield_component["Shield component<br/>[CShield.h]"]
  node_transform_component["Transform component<br/>[CTransform.h]"]
end

subgraph group_gameplay["Gameplay systems"]
  node_input["Keyboard input<br/>[SInput.cpp]"]
  node_enemy["Enemy spawning<br/>[SEnemySpawner.cpp]"]
  node_collision["Collision detection"]
  node_entity_life["Entity-life processing<br/>[SEntityLife.cpp]"]
  node_gun["Gun and bullets<br/>[SGun.cpp]"]
  node_movement["Movement<br/>[SMovement.cpp]"]
  node_shield["Shield processing<br/>[SShield.cpp]"]
  node_score["Score processing<br/>[SScore.cpp]"]
end

subgraph group_presentation["Presentation"]
  node_renderer["Rendering<br/>[SRenderer.cpp]"]
end

node_assignment1["Assignment 1 program<br/>[main.cpp]"]
node_sfml["SFML library"]

node_loop -->|"updates"| node_manager
node_loop -->|"recreates"| node_player
node_player -->|"adds player"| node_manager
node_player -->|"reads settings"| node_config
node_loop -->|"spawns"| node_enemy
node_loop -->|"processes input"| node_input
node_loop -->|"processes firing"| node_gun
node_loop -->|"processes shields"| node_shield
node_loop -->|"moves entities"| node_movement
node_loop -->|"detects collisions"| node_collision
node_loop -->|"updates life"| node_entity_life
node_loop -->|"updates score"| node_score
node_loop -->|"renders entities"| node_renderer
node_enemy -->|"adds enemies"| node_manager
node_enemy -->|"uses enemy settings"| node_config
node_entity -->|"holds component"| node_collision_component
node_entity -->|"holds component"| node_life_component
node_entity -->|"holds component"| node_mouse_component
node_entity -->|"holds component"| node_shape_component
node_entity -->|"holds component"| node_shield_component
node_entity -->|"holds component"| node_transform_component
node_transform_component -->|"uses"| node_vector
node_sfml -.->|"provides graphics"| node_player

click node_player "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Game.cpp"
click node_loop "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Game.cpp"
click node_config "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Config.cpp"
click node_manager "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/EntityManager.cpp"
click node_entity "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Entity.h"
click node_vector "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Vec2.cpp"
click node_input "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SInput.cpp"
click node_collision_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CCollision.h"
click node_life_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CEntityLife.h"
click node_mouse_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CMouseInput.h"
click node_shape_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CShape.h"
click node_shield_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CShield.h"
click node_transform_component "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CTransform.h"
click node_enemy "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SEnemySpawner.cpp"
click node_collision "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SCollisionDetector.cpp"
click node_entity_life "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SEntityLife.cpp"
click node_gun "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SGun.cpp"
click node_movement "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SMovement.cpp"
click node_shield "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SShield.cpp"
click node_score "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SScore.cpp"
click node_renderer "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SRenderer.cpp"
click node_assignment1 "https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-1/main.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_player,node_loop,node_config toneBlue
class node_manager,node_entity,node_vector,node_collision_component,node_life_component,node_mouse_component,node_shape_component,node_shield_component,node_transform_component toneAmber
class node_input,node_enemy,node_collision,node_entity_life,node_gun,node_movement,node_shield,node_score toneMint
class node_renderer toneRose
class node_assignment1 toneTeal
class node_sfml toneIndigo
```

## Components

### Game runtime

- [Player setup](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Game.cpp): `assignment-2/src/Game.cpp`
- [Game loop](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Game.cpp): `assignment-2/src/Game.cpp`
- [Game configuration](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Config.cpp): `assignment-2/src/Config.cpp`

### Entity model

- [Entity manager](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/EntityManager.cpp): `assignment-2/src/EntityManager.cpp`
- [Entity and components](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Entity.h): `assignment-2/src/Entity.h`
- [2D vector](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/Vec2.cpp): `assignment-2/src/Vec2.cpp`
- [Collision component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CCollision.h): `assignment-2/src/CCollision.h`
- [Entity-life component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CEntityLife.h): `assignment-2/src/CEntityLife.h`
- [Mouse-input component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CMouseInput.h): `assignment-2/src/CMouseInput.h`
- [Shape component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CShape.h): `assignment-2/src/CShape.h`
- [Shield component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CShield.h): `assignment-2/src/CShield.h`
- [Transform component](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/CTransform.h): `assignment-2/src/CTransform.h`

### Gameplay systems

- [Keyboard input](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SInput.cpp): `assignment-2/src/SInput.cpp`
- [Enemy spawning](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SEnemySpawner.cpp): `assignment-2/src/SEnemySpawner.cpp`
- [Collision detection](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SCollisionDetector.cpp): `assignment-2/src/SCollisionDetector.cpp`
- [Entity-life processing](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SEntityLife.cpp): `assignment-2/src/SEntityLife.cpp`
- [Gun and bullets](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SGun.cpp): `assignment-2/src/SGun.cpp`
- [Movement](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SMovement.cpp): `assignment-2/src/SMovement.cpp`
- [Shield processing](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SShield.cpp): `assignment-2/src/SShield.cpp`
- [Score processing](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SScore.cpp): `assignment-2/src/SScore.cpp`

### Presentation

- [Rendering](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-2/src/SRenderer.cpp): `assignment-2/src/SRenderer.cpp`

### Other components

- [Assignment 1 program](https://github.com/beghelli/comp4300-game-programming-course/blob/master/assignment-1/main.cpp): `assignment-1/main.cpp`
- **SFML library**

## Connections

- Game loop → Entity manager: updates (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Player setup: recreates (evidence: `assignment-2/src/Game.cpp`)
- Player setup → Entity manager: adds player (evidence: `assignment-2/src/Game.cpp`)
- Player setup → Game configuration: reads settings (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Enemy spawning: spawns (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Keyboard input: processes input (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Gun and bullets: processes firing (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Shield processing: processes shields (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Movement: moves entities (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Collision detection: detects collisions (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Entity-life processing: updates life (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Score processing: updates score (evidence: `assignment-2/src/Game.cpp`)
- Game loop → Rendering: renders entities (evidence: `assignment-2/src/Game.cpp`)
- Enemy spawning → Entity manager: adds enemies (evidence: `assignment-2/src/SEnemySpawner.cpp`)
- Enemy spawning → Game configuration: uses enemy settings (evidence: `assignment-2/src/SEnemySpawner.cpp`)
- Entity and components → Collision component: holds component (evidence: `assignment-2/src/Entity.h`)
- Entity and components → Entity-life component: holds component (evidence: `assignment-2/src/Entity.h`)
- Entity and components → Mouse-input component: holds component (evidence: `assignment-2/src/Entity.h`)
- Entity and components → Shape component: holds component (evidence: `assignment-2/src/Entity.h`)
- Entity and components → Shield component: holds component (evidence: `assignment-2/src/Entity.h`)
- Entity and components → Transform component: holds component (evidence: `assignment-2/src/Entity.h`)
- Transform component → 2D vector: uses (evidence: `assignment-2/src/CTransform.h`)
- SFML library → Player setup: provides graphics (evidence: `README.md`)
