# patelrudra0106-art/space-survivor architecture

> Architecture diagram of the GitHub repository patelrudra0106-art/space-survivor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patelrudra0106-art/space-survivor
- Repository: https://github.com/patelrudra0106-art/space-survivor

## Overview

Space Survivor is a Pygame roguelike shooter. The player enters through the menu, plays a combat run against spawned enemies and bosses, collects XP and power-ups, and uses HUD, controls, and overlays to manage progression and game state. The graph includes README-described features such as mobile controls, meta-progression, pooling, and game-feel effects; where their runtime wiring was not shown, relationships are left out or marked unverified.

Main entry points: [`main.py`](https://github.com/patelrudra0106-art/space-survivor/blob/main/main.py) (Game Runtime), [`src/entities/player.py`](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/player.py) (Player Entity), [`src/entities/BossEnemy.py`](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/BossEnemy.py) (Boss Enemy), [`src/entities/EnemySpawner.py`](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/EnemySpawner.py) (Enemy Spawner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameflow["Game Flow"]
  node_game["Game Runtime<br/>[main.py]"]
  node_game_state["Game State<br/>[game_state.py]"]
  node_utility["Game Utilities<br/>[game_utility.py]"]
end

subgraph group_combat["Combat"]
  node_player["Player Entity<br/>[player.py]"]
  node_enemy_spawner["Enemy Spawner<br/>[EnemySpawner.py]"]
  node_enemy["Enemy Types<br/>[Enemy.py]"]
  node_boss["Boss Enemy<br/>[BossEnemy.py]"]
  node_bullet["Projectile<br/>[Bullet.py]"]
  node_abilities["Player Abilities<br/>[ability_base.py]"]
end

subgraph group_progression["Progression"]
  node_xp_gem["XP Gems<br/>[xp_gem.py]"]
  node_level_up["Level-Up Choices<br/>[level_up_screen.py]"]
  node_power_manager["Power-Up Manager"]
  node_power_base["Power-Up Effects<br/>[power_up_base.py]"]
  node_shop["Upgrade Shop<br/>[shop.py]"]
  node_meta["Meta Progression"]
end

subgraph group_interface["Interface"]
  node_menu["Main Menu<br/>[menu.py]"]
  node_pause["Pause Overlay<br/>[pause.py]"]
  node_restart["Restart Overlay<br/>[restart.py]"]
  node_overlay_base["Overlay Base<br/>[base_overlay.py]"]
  node_hud["Game HUD<br/>[game_hud.py]"]
  node_health_bar["Health Bar<br/>[health_bar.py]"]
  node_touch_controls["Virtual Controls"]
  node_background["Parallax Background<br/>[parallax_bg.py]"]
end

subgraph group_systems["Game Systems"]
  node_audio["Audio Manager<br/>[audio_manager.py]"]
  node_events["Event Bus<br/>[event_bus.py]"]
  node_particles["Particle System<br/>[particle_system.py]"]
  node_screen_shake["Screen Shake<br/>[screen_shake.py]"]
  node_object_pool["Object Pool<br/>[object_pool.py]"]
  node_analytics["Gameplay Analytics<br/>[analytics.py]"]
  node_config["Game Configuration<br/>[config.py]"]
end

node_player_actor(("Player"))

node_player_actor -->|"starts run"| node_game
node_game -->|"runs menu"| node_menu
node_game -->|"opens pause"| node_pause
node_game -->|"runs restart"| node_restart
node_game -->|"updates gameplay"| node_player
node_game -->|"updates spawning"| node_enemy_spawner
node_game -->|"updates power-ups"| node_power_manager
node_game -->|"draws HUD"| node_hud
node_game -->|"draws background"| node_background
node_game -->|"reads controls"| node_touch_controls
node_game -->|"controls audio"| node_audio
node_game -->|"uses XP gems"| node_xp_gem
node_game -->|"uses boss enemy"| node_boss
node_game -->|"shows choices"| node_level_up
node_game -->|"uses effects"| node_particles
node_game -->|"reads settings"| node_config
node_game -->|"sets run state"| node_game_state
node_utility -->|"uses states"| node_game_state
node_utility -->|"checks boss status"| node_enemy_spawner
node_enemy_spawner -->|"spawns types"| node_enemy
node_enemy_spawner -->|"spawns boss"| node_boss
node_player -->|"fires"| node_bullet
node_player -->|"uses health display"| node_health_bar
node_player -->|"uses abilities"| node_abilities
node_boss -->|"inherits behavior"| node_enemy
node_boss -->|"fires projectiles"| node_bullet
node_power_manager -->|"creates effects"| node_power_base
node_level_up -->|"inherits overlay"| node_overlay_base
node_menu -->|"inherits overlay"| node_overlay_base
node_restart -->|"inherits overlay"| node_overlay_base
node_shop -->|"inherits overlay"| node_overlay_base
node_shop -->|"uses state"| node_game_state
node_hud -->|"reads boss status"| node_boss
node_enemy -->|"uses health display"| node_health_bar
node_audio -->|"resolves assets"| node_utility
node_audio -->|"reads volumes"| node_config
node_player -.->|"uses projectile pool"| node_object_pool
node_game -.->|"dispatches events"| node_events
node_game -.->|"triggers feedback"| node_screen_shake
node_player -.->|"feeds performance"| node_analytics
node_player -.->|"applies upgrades"| node_meta

click node_game "https://github.com/patelrudra0106-art/space-survivor/blob/main/main.py"
click node_game_state "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/game_state.py"
click node_utility "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/game_utility.py"
click node_menu "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/menu.py"
click node_pause "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/pause.py"
click node_restart "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/restart.py"
click node_overlay_base "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/base_overlay.py"
click node_hud "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/game_hud.py"
click node_health_bar "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/ui/health_bar.py"
click node_touch_controls "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/ui/virtual_controls.py"
click node_background "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/parallax_bg.py"
click node_player "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/player.py"
click node_enemy_spawner "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/EnemySpawner.py"
click node_enemy "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/Enemy.py"
click node_boss "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/BossEnemy.py"
click node_bullet "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/Bullet.py"
click node_xp_gem "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/xp_gem.py"
click node_level_up "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/level_up_screen.py"
click node_power_manager "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/powers/power_up_manager.py"
click node_power_base "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/powers/power_up_base.py"
click node_shop "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/shop.py"
click node_meta "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/meta_progression.py"
click node_abilities "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/abilities/ability_base.py"
click node_audio "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/audio/audio_manager.py"
click node_events "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/event_bus.py"
click node_particles "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/particle_system.py"
click node_screen_shake "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/screen_shake.py"
click node_object_pool "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/object_pool.py"
click node_analytics "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/analytics.py"
click node_config "https://github.com/patelrudra0106-art/space-survivor/blob/main/src/config/config.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_game,node_game_state,node_utility toneBlue
class node_player,node_enemy_spawner,node_enemy,node_boss,node_bullet,node_abilities toneAmber
class node_xp_gem,node_level_up,node_power_manager,node_power_base,node_shop,node_meta toneMint
class node_menu,node_pause,node_restart,node_overlay_base,node_hud,node_health_bar,node_touch_controls,node_background toneRose
class node_audio,node_events,node_particles,node_screen_shake,node_object_pool,node_analytics,node_config,node_player_actor toneIndigo
```

## Components

### Game Flow

- [Game Runtime](https://github.com/patelrudra0106-art/space-survivor/blob/main/main.py): `main.py`
- [Game State](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/game_state.py): `src/lib/game_state.py`
- [Game Utilities](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/game_utility.py): `src/lib/game_utility.py`

### Combat

- [Player Entity](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/player.py): `src/entities/player.py`
- [Enemy Spawner](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/EnemySpawner.py): `src/entities/EnemySpawner.py`
- [Enemy Types](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/Enemy.py): `src/entities/Enemy.py`
- [Boss Enemy](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/BossEnemy.py): `src/entities/BossEnemy.py`
- [Projectile](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/Bullet.py): `src/entities/Bullet.py`
- [Player Abilities](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/abilities/ability_base.py): `src/abilities/ability_base.py`

### Progression

- [XP Gems](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/entities/xp_gem.py): `src/entities/xp_gem.py`
- [Level-Up Choices](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/level_up_screen.py): `src/screens/level_up_screen.py`
- [Power-Up Manager](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/powers/power_up_manager.py): `src/powers/power_up_manager.py`
- [Power-Up Effects](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/powers/power_up_base.py): `src/powers/power_up_base.py`
- [Upgrade Shop](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/shop.py): `src/screens/shop.py`
- [Meta Progression](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/meta_progression.py): `src/lib/meta_progression.py`

### Interface

- [Main Menu](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/menu.py): `src/screens/menu.py`
- [Pause Overlay](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/pause.py): `src/screens/pause.py`
- [Restart Overlay](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/restart.py): `src/screens/restart.py`
- [Overlay Base](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/base_overlay.py): `src/screens/base_overlay.py`
- [Game HUD](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/game_hud.py): `src/screens/game_hud.py`
- [Health Bar](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/ui/health_bar.py): `src/screens/ui/health_bar.py`
- [Virtual Controls](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/ui/virtual_controls.py): `src/screens/ui/virtual_controls.py`
- [Parallax Background](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/screens/parallax_bg.py): `src/screens/parallax_bg.py`

### Game Systems

- [Audio Manager](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/audio/audio_manager.py): `src/audio/audio_manager.py`
- [Event Bus](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/event_bus.py): `src/lib/event_bus.py`
- [Particle System](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/particle_system.py): `src/lib/particle_system.py`
- [Screen Shake](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/screen_shake.py): `src/lib/screen_shake.py`
- [Object Pool](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/object_pool.py): `src/lib/object_pool.py`
- [Gameplay Analytics](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/lib/analytics.py): `src/lib/analytics.py`
- [Game Configuration](https://github.com/patelrudra0106-art/space-survivor/blob/main/src/config/config.py): `src/config/config.py`

### Other components

- **Player**

## Connections

- Player → Game Runtime: starts run (evidence: `README.md`)
- Game Runtime → Main Menu: runs menu (evidence: `main.py`)
- Game Runtime → Pause Overlay: opens pause (evidence: `main.py`)
- Game Runtime → Restart Overlay: runs restart (evidence: `main.py`)
- Game Runtime → Player Entity: updates gameplay (evidence: `main.py`)
- Game Runtime → Enemy Spawner: updates spawning (evidence: `main.py`)
- Game Runtime → Power-Up Manager: updates power-ups (evidence: `main.py`)
- Game Runtime → Game HUD: draws HUD (evidence: `main.py`)
- Game Runtime → Parallax Background: draws background (evidence: `main.py`)
- Game Runtime → Virtual Controls: reads controls (evidence: `main.py`)
- Game Runtime → Audio Manager: controls audio (evidence: `main.py`)
- Game Runtime → XP Gems: uses XP gems (evidence: `main.py`)
- Game Runtime → Boss Enemy: uses boss enemy (evidence: `main.py`)
- Game Runtime → Level-Up Choices: shows choices (evidence: `main.py`)
- Game Runtime → Particle System: uses effects (evidence: `main.py`)
- Game Runtime → Game Configuration: reads settings (evidence: `main.py`)
- Game Runtime → Game State: sets run state (evidence: `main.py`)
- Game Utilities → Game State: uses states (evidence: `src/lib/game_utility.py`)
- Game Utilities → Enemy Spawner: checks boss status (evidence: `src/lib/game_utility.py`)
- Enemy Spawner → Enemy Types: spawns types (evidence: `src/entities/EnemySpawner.py`)
- Enemy Spawner → Boss Enemy: spawns boss (evidence: `src/entities/EnemySpawner.py`)
- Player Entity → Projectile: fires (evidence: `src/entities/player.py`)
- Player Entity → Health Bar: uses health display (evidence: `src/entities/player.py`)
- Player Entity → Player Abilities: uses abilities (evidence: `src/entities/player.py`)
- Boss Enemy → Enemy Types: inherits behavior (evidence: `src/entities/BossEnemy.py`)
- Boss Enemy → Projectile: fires projectiles (evidence: `src/entities/BossEnemy.py`)
- Power-Up Manager → Power-Up Effects: creates effects (evidence: `src/powers/power_up_manager.py`)
- Level-Up Choices → Overlay Base: inherits overlay (evidence: `src/screens/level_up_screen.py`)
- Main Menu → Overlay Base: inherits overlay (evidence: `src/screens/menu.py`)
- Restart Overlay → Overlay Base: inherits overlay (evidence: `src/screens/restart.py`)
- Upgrade Shop → Overlay Base: inherits overlay (evidence: `src/screens/shop.py`)
- Upgrade Shop → Game State: uses state (evidence: `src/screens/shop.py`)
- Game HUD → Boss Enemy: reads boss status (evidence: `src/screens/game_hud.py`)
- Enemy Types → Health Bar: uses health display (evidence: `src/entities/Enemy.py`)
- Audio Manager → Game Utilities: resolves assets (evidence: `src/audio/audio_manager.py`)
- Audio Manager → Game Configuration: reads volumes (evidence: `src/audio/audio_manager.py`)
- Player Entity → Object Pool: uses projectile pool
- Game Runtime → Event Bus: dispatches events (evidence: `main.py`)
- Game Runtime → Screen Shake: triggers feedback (evidence: `main.py`)
- Player Entity → Gameplay Analytics: feeds performance
- Player Entity → Meta Progression: applies upgrades
