# jonesy200/course_work architecture

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

- Interactive diagram: https://gitdiagram.com/jonesy200/course_work
- Repository: https://github.com/jonesy200/course_work

## Overview

This repository contains a Pygame tower-defence game: the player starts the game, which runs a real-time game loop, renders levels, and supports unit combat and building placement. The tree also shows multiple levels, enemy and friendly unit types, buildings, projectiles, pathfinding, collision handling, and UI components. The README is empty, and the game orchestrator and most feature implementations were not sampled, so the graph includes only clearly supported connections and treats several capabilities as subsystems rather than asserting their internal wiring.

Main entry points: [`tower_defence_game/game_files/levels`](https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/levels) (Level definitions), [`tower_defence_game/game_files/entities/units/unit.py`](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/entities/units/unit.py) (Unit movement and attacks), [`tower_defence_game/game_files/main.py`](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/main.py) (Pygame entry), [`tower_defence_game/game_files/world/level.py`](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/world/level.py) (Level rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_entry["Pygame entry<br/>[main.py]"]
  node_game["Game controller<br/>[game.py]"]
  node_camera["Camera<br/>[camera.py]"]
  node_settings["Game settings<br/>[settings.py]"]
end

subgraph group_world["World and navigation"]
  node_levels["Level definitions"]
  node_level_base["Level rendering<br/>[level.py]"]
  node_tilemap["Tilemap<br/>[tilemap.py]"]
  node_tilesets["Terrain tilesets"]
  node_collision["Collision grid<br/>[collision_grid.py]"]
  node_pathfinder["Pathfinder<br/>[pathfinder.py]"]
end

subgraph group_combat["Units and combat"]
  node_buildings["Defensive buildings"]
  node_units["Friendly and enemy units"]
  node_unit_runtime["Unit movement and attacks<br/>[unit.py]"]
  node_projectiles["Projectiles<br/>[projectile.py]"]
end

subgraph group_interface["Player interface"]
  node_ui["Menus and controls"]
end

node_player(("Player"))

node_player -->|"starts"| node_entry
node_entry -->|"creates and runs"| node_game
node_levels -->|"creates terrain tileset"| node_tilesets
node_levels -->|"initializes level"| node_level_base
node_level_base -->|"creates tilemap"| node_tilemap
node_unit_runtime -->|"requests path"| node_pathfinder
node_unit_runtime -->|"checks movement"| node_collision

click node_entry "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/main.py"
click node_game "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/game.py"
click node_levels "https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/levels"
click node_level_base "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/world/level.py"
click node_tilemap "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/tilemap.py"
click node_tilesets "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/world/tilesets/terrain_tilesets.py"
click node_collision "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/collision_grid.py"
click node_pathfinder "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/pathfinder.py"
click node_buildings "https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/entities/buildings"
click node_units "https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/entities/units"
click node_unit_runtime "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/entities/units/unit.py"
click node_projectiles "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/entities/projectiles/projectile.py"
click node_ui "https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/ui"
click node_camera "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/camera.py"
click node_settings "https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/utils/settings.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_entry,node_game,node_camera,node_settings toneBlue
class node_levels,node_level_base,node_tilemap,node_tilesets,node_collision,node_pathfinder toneAmber
class node_buildings,node_units,node_unit_runtime,node_projectiles toneMint
class node_ui toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Pygame entry](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/main.py): `tower_defence_game/game_files/main.py`
- [Game controller](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/game.py): `tower_defence_game/game_files/game.py`
- [Camera](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/camera.py): `tower_defence_game/game_files/systems/camera.py`
- [Game settings](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/utils/settings.py): `tower_defence_game/game_files/utils/settings.py`

### World and navigation

- [Level definitions](https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/levels): `tower_defence_game/game_files/levels`
- [Level rendering](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/world/level.py): `tower_defence_game/game_files/world/level.py`
- [Tilemap](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/tilemap.py): `tower_defence_game/game_files/systems/tilemap.py`
- [Terrain tilesets](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/world/tilesets/terrain_tilesets.py): `tower_defence_game/game_files/world/tilesets/terrain_tilesets.py`
- [Collision grid](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/collision_grid.py): `tower_defence_game/game_files/systems/collision_grid.py`
- [Pathfinder](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/systems/pathfinder.py): `tower_defence_game/game_files/systems/pathfinder.py`

### Units and combat

- [Defensive buildings](https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/entities/buildings): `tower_defence_game/game_files/entities/buildings`
- [Friendly and enemy units](https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/entities/units): `tower_defence_game/game_files/entities/units`
- [Unit movement and attacks](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/entities/units/unit.py): `tower_defence_game/game_files/entities/units/unit.py`
- [Projectiles](https://github.com/jonesy200/course_work/blob/master/tower_defence_game/game_files/entities/projectiles/projectile.py): `tower_defence_game/game_files/entities/projectiles/projectile.py`

### Player interface

- [Menus and controls](https://github.com/jonesy200/course_work/tree/master/tower_defence_game/game_files/ui): `tower_defence_game/game_files/ui`

### Other components

- **Player**

## Connections

- Player → Pygame entry: starts
- Pygame entry → Game controller: creates and runs
- Level definitions → Terrain tilesets: creates terrain tileset
- Level definitions → Level rendering: initializes level
- Level rendering → Tilemap: creates tilemap
- Unit movement and attacks → Pathfinder: requests path
- Unit movement and attacks → Collision grid: checks movement
