# turjocode/zombie-survival-game architecture

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

- Interactive diagram: https://gitdiagram.com/turjocode/zombie-survival-game
- Repository: https://github.com/turjocode/zombie-survival-game

## Overview

Zombie Survival is a real-time, tile-based Pygame game. The main loop builds a generated maze, accepts player movement and shooting, updates zombies that pursue the player with type-specific pathfinding, resolves damage and collisions, and renders health, kills, and survival time. The graph reflects calls visible in the sampled source; README-described capabilities are included where supported, without assuming unshown integrations.

Main entry points: [`main.py`](https://github.com/turjocode/zombie-survival-game/blob/main/main.py) (Game loop), [`zombies.py`](https://github.com/turjocode/zombie-survival-game/blob/main/zombies.py) (Zombie), [`player.py`](https://github.com/turjocode/zombie-survival-game/blob/main/player.py) (Player), [`map.py`](https://github.com/turjocode/zombie-survival-game/blob/main/map.py) (Generated map)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_main["Game loop<br/>[main.py]"]
  node_hud["HUD and rendering<br/>[main.py]"]
end

subgraph group_world["World and navigation"]
  node_map["Generated map<br/>[map.py]"]
  node_maze["Maze generation<br/>[map.py]"]
  node_pathfinding["Pathfinding algorithms<br/>[pathfinding.py]"]
end

subgraph group_actors["Combat actors"]
  node_player["Player<br/>[player.py]"]
  node_zombie["Zombie<br/>[zombies.py]"]
  node_bullet["Bullet<br/>[player.py]"]
end

subgraph group_shared["Shared game logic"]
  node_utils["Game constants and types<br/>[utils.py]"]
end

node_gamer(("Player input"))
node_pygame["Pygame CE"]

node_gamer -->|"sends input"| node_main
node_main -->|"creates"| node_map
node_main -->|"creates"| node_player
node_main -->|"spawns"| node_zombie
node_map -->|"generates maze"| node_maze
node_main -->|"moves and fires"| node_player
node_player -->|"checks walls"| node_map
node_main -->|"updates bullets"| node_player
node_player -->|"creates and updates"| node_bullet
node_bullet -->|"checks collision"| node_map
node_main -->|"updates"| node_zombie
node_zombie -->|"requests route"| node_pathfinding
node_zombie -->|"checks movement"| node_map
node_main -->|"checks bullet hits"| node_zombie
node_main -->|"renders game state"| node_hud
node_hud -->|"draws map"| node_map
node_hud -->|"draws player"| node_player
node_hud -->|"draws zombies"| node_zombie
node_zombie -->|"deals attack damage"| node_player
node_main -->|"records kills"| node_player
node_pathfinding -->|"uses tile costs"| node_utils
node_zombie -->|"uses distance and types"| node_utils
node_main -->|"uses display and input"| node_pygame
node_player -->|"uses geometry and drawing"| node_pygame
node_map -->|"draws tiles"| node_pygame
node_zombie -->|"draws actors"| node_pygame

click node_player "https://github.com/turjocode/zombie-survival-game/blob/main/player.py"
click node_zombie "https://github.com/turjocode/zombie-survival-game/blob/main/zombies.py"
click node_bullet "https://github.com/turjocode/zombie-survival-game/blob/main/player.py"
click node_map "https://github.com/turjocode/zombie-survival-game/blob/main/map.py"
click node_maze "https://github.com/turjocode/zombie-survival-game/blob/main/map.py"
click node_pathfinding "https://github.com/turjocode/zombie-survival-game/blob/main/pathfinding.py"
click node_main "https://github.com/turjocode/zombie-survival-game/blob/main/main.py"
click node_hud "https://github.com/turjocode/zombie-survival-game/blob/main/main.py"
click node_utils "https://github.com/turjocode/zombie-survival-game/blob/main/utils.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_main,node_hud toneBlue
class node_map,node_maze,node_pathfinding toneAmber
class node_player,node_zombie,node_bullet toneMint
class node_utils toneRose
class node_gamer,node_pygame toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/turjocode/zombie-survival-game/blob/main/main.py): `main.py`
- [HUD and rendering](https://github.com/turjocode/zombie-survival-game/blob/main/main.py): `main.py`

### World and navigation

- [Generated map](https://github.com/turjocode/zombie-survival-game/blob/main/map.py): `map.py`
- [Maze generation](https://github.com/turjocode/zombie-survival-game/blob/main/map.py): `map.py`
- [Pathfinding algorithms](https://github.com/turjocode/zombie-survival-game/blob/main/pathfinding.py): `pathfinding.py`

### Combat actors

- [Player](https://github.com/turjocode/zombie-survival-game/blob/main/player.py): `player.py`
- [Zombie](https://github.com/turjocode/zombie-survival-game/blob/main/zombies.py): `zombies.py`
- [Bullet](https://github.com/turjocode/zombie-survival-game/blob/main/player.py): `player.py`

### Shared game logic

- [Game constants and types](https://github.com/turjocode/zombie-survival-game/blob/main/utils.py): `utils.py`

### Other components

- **Player input**
- **Pygame CE**

## Connections

- Player input → Game loop: sends input
- Game loop → Generated map: creates
- Game loop → Player: creates
- Game loop → Zombie: spawns
- Generated map → Maze generation: generates maze
- Game loop → Player: moves and fires
- Player → Generated map: checks walls
- Game loop → Player: updates bullets
- Player → Bullet: creates and updates
- Bullet → Generated map: checks collision
- Game loop → Zombie: updates
- Zombie → Pathfinding algorithms: requests route
- Zombie → Generated map: checks movement
- Game loop → Zombie: checks bullet hits
- Game loop → HUD and rendering: renders game state
- HUD and rendering → Generated map: draws map
- HUD and rendering → Player: draws player
- HUD and rendering → Zombie: draws zombies
- Zombie → Player: deals attack damage
- Game loop → Player: records kills
- Pathfinding algorithms → Game constants and types: uses tile costs
- Zombie → Game constants and types: uses distance and types
- Game loop → Pygame CE: uses display and input
- Player → Pygame CE: uses geometry and drawing
- Generated map → Pygame CE: draws tiles
- Zombie → Pygame CE: draws actors
