# empi-empi/python-game architecture

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

- Interactive diagram: https://gitdiagram.com/empi-empi/python-game
- Repository: https://github.com/empi-empi/python-game

## Overview

Daemon Monsters is a Pygame creature-collecting RPG. The player explores tiled maps, interacts with characters, encounters wild monsters or challenges trainers, fights turn-based battles, reviews the party, and can trigger evolutions. The sampled Game class is the runtime coordinator; entity movement, battle logic, rendering sprites, and shared game data provide supporting layers. README content is absent, and excerpts are partial, so links for unsampled subsystems are limited to what the tree and visible code support.

Main entry points: [`code/main.py`](https://github.com/empi-empi/python-game/blob/main/code/main.py) (Game coordinator), [`code/battle.py`](https://github.com/empi-empi/python-game/blob/main/code/battle.py) (Turn-based battle), [`code/support.py`](https://github.com/empi-empi/python-game/blob/main/code/support.py) (Asset import helpers), [`code/monster_index.py`](https://github.com/empi-empi/python-game/blob/main/code/monster_index.py) (Monster index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game["Game coordinator<br/>[main.py]"]
  node_support["Asset import helpers<br/>[support.py]"]
  node_settings["Game settings<br/>[settings.py]"]
end

subgraph group_world["World exploration"]
  node_entities["Player and characters<br/>[entities.py]"]
  node_maps["Tiled maps"]
  node_sprites["World and battle sprites<br/>[sprites.py]"]
  node_groups["Sprite groups<br/>[groups.py]"]
  node_dialog["Dialog system<br/>[dialog.py]"]
end

subgraph group_creatures["Monster systems"]
  node_battle["Turn-based battle<br/>[battle.py]"]
  node_monster["Monster model<br/>[monster.py]"]
  node_index["Monster index<br/>[monster_index.py]"]
  node_evolution["Evolution sequence<br/>[evolution.py]"]
  node_game_data["Game definitions<br/>[game_data.py]"]
end

subgraph group_assets["Game resources"]
  node_graphics["Visual assets"]
  node_audio["Sound assets"]
  node_tile_data["Map tilesets"]
end

node_player(("Player"))

node_player -->|"provides input"| node_game
node_game -->|"loads assets"| node_support
node_support -->|"imports images"| node_graphics
node_support -->|"imports sounds"| node_audio
node_game -->|"loads maps"| node_maps
node_maps -->|"references tiles"| node_tile_data
node_game -->|"creates actors"| node_entities
node_game -->|"creates sprites"| node_sprites
node_game -->|"updates and draws"| node_groups
node_entities -->|"requests dialog"| node_game
node_game -->|"creates dialog"| node_dialog
node_game -->|"starts battle"| node_battle
node_battle -->|"ends battle"| node_game
node_game -->|"opens index"| node_index
node_game -->|"starts evolution"| node_evolution
node_battle -->|"updates combat state"| node_monster
node_index -->|"reads party"| node_monster
node_monster -->|"uses species data"| node_game_data
node_battle -->|"uses attack data"| node_game_data
node_index -->|"reads species data"| node_game_data
node_game -->|"uses configuration"| node_settings

click node_game "https://github.com/empi-empi/python-game/blob/main/code/main.py"
click node_entities "https://github.com/empi-empi/python-game/blob/main/code/entities.py"
click node_maps "https://github.com/empi-empi/python-game/tree/main/data/maps"
click node_sprites "https://github.com/empi-empi/python-game/blob/main/code/sprites.py"
click node_groups "https://github.com/empi-empi/python-game/blob/main/code/groups.py"
click node_dialog "https://github.com/empi-empi/python-game/blob/main/code/dialog.py"
click node_battle "https://github.com/empi-empi/python-game/blob/main/code/battle.py"
click node_monster "https://github.com/empi-empi/python-game/blob/main/code/monster.py"
click node_index "https://github.com/empi-empi/python-game/blob/main/code/monster_index.py"
click node_evolution "https://github.com/empi-empi/python-game/blob/main/code/evolution.py"
click node_game_data "https://github.com/empi-empi/python-game/blob/main/code/game_data.py"
click node_support "https://github.com/empi-empi/python-game/blob/main/code/support.py"
click node_settings "https://github.com/empi-empi/python-game/blob/main/code/settings.py"
click node_graphics "https://github.com/empi-empi/python-game/tree/main/graphics"
click node_audio "https://github.com/empi-empi/python-game/tree/main/audio"
click node_tile_data "https://github.com/empi-empi/python-game/tree/main/data/tilesets"

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_support,node_settings toneBlue
class node_entities,node_maps,node_sprites,node_groups,node_dialog toneAmber
class node_battle,node_monster,node_index,node_evolution,node_game_data toneMint
class node_graphics,node_audio,node_tile_data toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game coordinator](https://github.com/empi-empi/python-game/blob/main/code/main.py): `code/main.py`
- [Asset import helpers](https://github.com/empi-empi/python-game/blob/main/code/support.py): `code/support.py`
- [Game settings](https://github.com/empi-empi/python-game/blob/main/code/settings.py): `code/settings.py`

### World exploration

- [Player and characters](https://github.com/empi-empi/python-game/blob/main/code/entities.py): `code/entities.py`
- [Tiled maps](https://github.com/empi-empi/python-game/tree/main/data/maps): `data/maps`
- [World and battle sprites](https://github.com/empi-empi/python-game/blob/main/code/sprites.py): `code/sprites.py`
- [Sprite groups](https://github.com/empi-empi/python-game/blob/main/code/groups.py): `code/groups.py`
- [Dialog system](https://github.com/empi-empi/python-game/blob/main/code/dialog.py): `code/dialog.py`

### Monster systems

- [Turn-based battle](https://github.com/empi-empi/python-game/blob/main/code/battle.py): `code/battle.py`
- [Monster model](https://github.com/empi-empi/python-game/blob/main/code/monster.py): `code/monster.py`
- [Monster index](https://github.com/empi-empi/python-game/blob/main/code/monster_index.py): `code/monster_index.py`
- [Evolution sequence](https://github.com/empi-empi/python-game/blob/main/code/evolution.py): `code/evolution.py`
- [Game definitions](https://github.com/empi-empi/python-game/blob/main/code/game_data.py): `code/game_data.py`

### Game resources

- [Visual assets](https://github.com/empi-empi/python-game/tree/main/graphics): `graphics`
- [Sound assets](https://github.com/empi-empi/python-game/tree/main/audio): `audio`
- [Map tilesets](https://github.com/empi-empi/python-game/tree/main/data/tilesets): `data/tilesets`

### Other components

- **Player**

## Connections

- Player → Game coordinator: provides input
- Game coordinator → Asset import helpers: loads assets
- Asset import helpers → Visual assets: imports images
- Asset import helpers → Sound assets: imports sounds
- Game coordinator → Tiled maps: loads maps
- Tiled maps → Map tilesets: references tiles
- Game coordinator → Player and characters: creates actors
- Game coordinator → World and battle sprites: creates sprites
- Game coordinator → Sprite groups: updates and draws
- Player and characters → Game coordinator: requests dialog
- Game coordinator → Dialog system: creates dialog
- Game coordinator → Turn-based battle: starts battle
- Turn-based battle → Game coordinator: ends battle
- Game coordinator → Monster index: opens index
- Game coordinator → Evolution sequence: starts evolution
- Turn-based battle → Monster model: updates combat state
- Monster index → Monster model: reads party
- Monster model → Game definitions: uses species data
- Turn-based battle → Game definitions: uses attack data
- Monster index → Game definitions: reads species data
- Game coordinator → Game settings: uses configuration
