# hurwan0629/kdt-final-3-game-subject architecture

> Architecture diagram of the GitHub repository hurwan0629/kdt-final-3-game-subject, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hurwan0629/kdt-final-3-game-subject
- Repository: https://github.com/hurwan0629/kdt-final-3-game-subject

## Overview

Space Skirmish is a Python/Pygame top-down space shooter with a headless reinforcement-learning environment. The player workflow runs from input and menu handling through frame-based game rules, combat, map interactions, and progression, then renders the updated state. The separate RL workflow advances the same game core and returns observations and rewards. README documents additional map, evolution, weapon, and minimap capabilities; unsampled internals are represented only where documented or indexed, so some links are omitted.

Main entry points: [`env.py`](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py) (Tank environment), [`main.py`](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/main.py) (Game application), [`game_core.py`](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/game_core.py) (Game rules), [`renderer.py`](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/renderer.py) (Game renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game simulation"]
  node_application["Game application<br/>[main.py]"]
  node_gamecore["Game rules<br/>[game_core.py]"]
  node_configuration["Game configuration<br/>[config.py]"]
end

subgraph group_world["World and progression"]
  node_terrain["Map and terrain<br/>[terrain.py]"]
  node_mapfiles["Built-in maps"]
  node_progression["Stats and ship evolution<br/>[progression.py]"]
end

subgraph group_presentation["Player interface"]
  node_menus["Menus and controls<br/>[menus.py]"]
  node_renderer["Game renderer<br/>[renderer.py]"]
  node_spriteassets["Sprite asset handling<br/>[sprite_assets.py]"]
  node_assetfiles["Game art assets"]
end

subgraph group_learning["RL environment"]
  node_tankenv["Tank environment<br/>[env.py]"]
  node_observations["Observation builder<br/>[env.py]"]
  node_reward["Reward calculation<br/>[env.py]"]
end

node_player(("Player"))
node_agent(("RL agent"))

node_player -->|"provides input"| node_application
node_application -->|"updates game"| node_gamecore
node_application -->|"handles menus"| node_menus
node_application -->|"draws state"| node_renderer
node_application -->|"configures"| node_configuration
node_gamecore -->|"reads settings"| node_configuration
node_gamecore -->|"uses terrain"| node_terrain
node_gamecore -->|"uses ship definitions"| node_progression
node_terrain -->|"loads maps"| node_mapfiles
node_renderer -->|"renders terrain"| node_terrain
node_renderer -->|"uses ship definitions"| node_progression
node_renderer -->|"requests sprites"| node_spriteassets
node_spriteassets -->|"resolves resources"| node_configuration
node_spriteassets -->|"reads barrel overrides"| node_progression
node_spriteassets -->|"loads images"| node_assetfiles
node_agent -->|"steps environment"| node_tankenv
node_tankenv -->|"advances game"| node_gamecore
node_tankenv -->|"builds observations"| node_observations
node_tankenv -->|"computes reward"| node_reward
node_tankenv -->|"uses settings"| node_configuration
node_observations -->|"encodes terrain"| node_terrain
node_tankenv -.->|"renders optionally"| node_renderer

click node_application "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/main.py"
click node_gamecore "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/game_core.py"
click node_configuration "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/config.py"
click node_terrain "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/terrain.py"
click node_mapfiles "https://github.com/hurwan0629/kdt-final-3-game-subject/tree/main/maps"
click node_progression "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/progression.py"
click node_menus "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/menus.py"
click node_renderer "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/renderer.py"
click node_spriteassets "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/sprite_assets.py"
click node_assetfiles "https://github.com/hurwan0629/kdt-final-3-game-subject/tree/main/assets"
click node_tankenv "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py"
click node_observations "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py"
click node_reward "https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.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_application,node_gamecore,node_configuration toneBlue
class node_terrain,node_mapfiles,node_progression toneAmber
class node_menus,node_renderer,node_spriteassets,node_assetfiles toneMint
class node_tankenv,node_observations,node_reward toneRose
class node_player,node_agent toneIndigo
```

## Components

### Game simulation

- [Game application](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/main.py): `main.py`
- [Game rules](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/game_core.py): `game_core.py`
- [Game configuration](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/config.py): `config.py`

### World and progression

- [Map and terrain](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/terrain.py): `terrain.py`
- [Built-in maps](https://github.com/hurwan0629/kdt-final-3-game-subject/tree/main/maps): `maps`
- [Stats and ship evolution](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/progression.py): `progression.py`

### Player interface

- [Menus and controls](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/menus.py): `menus.py`
- [Game renderer](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/renderer.py): `renderer.py`
- [Sprite asset handling](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/sprite_assets.py): `sprite_assets.py`
- [Game art assets](https://github.com/hurwan0629/kdt-final-3-game-subject/tree/main/assets): `assets`

### RL environment

- [Tank environment](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py): `env.py`
- [Observation builder](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py): `env.py`
- [Reward calculation](https://github.com/hurwan0629/kdt-final-3-game-subject/blob/main/env.py): `env.py`

### Other components

- **Player**
- **RL agent**

## Connections

- Player → Game application: provides input (evidence: `README.md`)
- Game application → Game rules: updates game (evidence: `main.py`)
- Game application → Menus and controls: handles menus (evidence: `main.py`)
- Game application → Game renderer: draws state (evidence: `main.py`)
- Game application → Game configuration: configures (evidence: `main.py`)
- Game rules → Game configuration: reads settings (evidence: `game_core.py`)
- Game rules → Map and terrain: uses terrain (evidence: `game_core.py`)
- Game rules → Stats and ship evolution: uses ship definitions (evidence: `game_core.py`)
- Map and terrain → Built-in maps: loads maps (evidence: `README.md`)
- Game renderer → Map and terrain: renders terrain (evidence: `renderer.py`)
- Game renderer → Stats and ship evolution: uses ship definitions (evidence: `renderer.py`)
- Game renderer → Sprite asset handling: requests sprites (evidence: `renderer.py`)
- Sprite asset handling → Game configuration: resolves resources (evidence: `sprite_assets.py`)
- Sprite asset handling → Stats and ship evolution: reads barrel overrides (evidence: `sprite_assets.py`)
- Sprite asset handling → Game art assets: loads images (evidence: `sprite_assets.py`)
- RL agent → Tank environment: steps environment (evidence: `README.md`)
- Tank environment → Game rules: advances game (evidence: `env.py`)
- Tank environment → Observation builder: builds observations (evidence: `env.py`)
- Tank environment → Reward calculation: computes reward (evidence: `env.py`)
- Tank environment → Game configuration: uses settings (evidence: `env.py`)
- Observation builder → Map and terrain: encodes terrain (evidence: `env.py`)
- Tank environment → Game renderer: renders optionally (evidence: `env.py`)
