# daniel-goldacker/the-office-game architecture

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

- Interactive diagram: https://gitdiagram.com/daniel-goldacker/the-office-game
- Repository: https://github.com/daniel-goldacker/the-office-game

## Overview

The repository is a Pygame office-themed action game. The player enters through a title screen and character-name prompt, then plays through enemy waves: movement, attacks and abilities interact with enemies, while coffee restores health and a barista replenishes cups. The main module coordinates the game loop, simulation, audio and HUD; core modules provide entities, world setup and rendering helpers. Source excerpts show these boundaries, but not every call site, so uncertain relationships are omitted.

Main entry points: [`src/main.py`](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py) (Game loop), [`src/core/world.py`](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py) (World and waves), [`src/core/entities.py`](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py) (Entity movement), [`src/core/config.py`](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/config.py) (Game configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Game interface"]
  node_screens["Start and end screens<br/>[screens.py]"]
  node_hud["Gameplay HUD<br/>[main.py]"]
end

subgraph group_runtime["Game runtime"]
  node_main_loop["Game loop<br/>[main.py]"]
  node_simulation["Gameplay simulation<br/>[main.py]"]
  node_audio["Sound playback<br/>[main.py]"]
  node_config["Game configuration<br/>[config.py]"]
  node_utils["Geometry helpers<br/>[utils.py]"]
end

subgraph group_domain["Game domain"]
  node_world_setup["World and waves<br/>[world.py]"]
  node_coffee["Coffee stations<br/>[world.py]"]
  node_barista["Barista refill<br/>[main.py]"]
  node_player_entity["Player entity<br/>[entities.py]"]
  node_enemy_ai["Enemy behavior<br/>[entities.py]"]
  node_npc_entity["NPC behavior<br/>[entities.py]"]
  node_entity_base["Entity movement<br/>[entities.py]"]
end

subgraph group_presentation["World presentation"]
  node_world_art["Office and minimap<br/>[world.py]"]
  node_sprites["Character sprites<br/>[sprites.py]"]
  node_sound_assets["Sound assets"]
end

node_player(("Player"))

node_player -->|"starts and names"| node_screens
node_player -->|"provides input"| node_main_loop
node_main_loop -->|"shows screens"| node_screens
node_main_loop -->|"updates gameplay"| node_simulation
node_main_loop -->|"renders HUD"| node_hud
node_main_loop -->|"loads and adjusts"| node_audio
node_main_loop -->|"uses world logic"| node_world_setup
node_simulation -->|"updates player"| node_player_entity
node_simulation -->|"updates enemies"| node_enemy_ai
node_simulation -->|"refills cups"| node_barista
node_simulation -->|"checks healing"| node_coffee
node_world_setup -->|"generates sprites"| node_sprites
node_world_setup -->|"creates entities"| node_entity_base
node_world_setup -->|"provides world helpers"| node_world_art
node_world_setup -->|"places stations"| node_coffee
node_player_entity -->|"inherits movement"| node_entity_base
node_enemy_ai -->|"inherits movement"| node_entity_base
node_npc_entity -->|"inherits movement"| node_entity_base
node_entity_base -->|"uses clamp"| node_utils
node_enemy_ai -->|"measures distance"| node_utils
node_world_setup -->|"reads settings"| node_config
node_entity_base -->|"reads settings"| node_config
node_main_loop -->|"reads settings"| node_config
node_audio -->|"plays sounds"| node_sound_assets

click node_main_loop "https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py"
click node_simulation "https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py"
click node_audio "https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py"
click node_screens "https://github.com/daniel-goldacker/the-office-game/blob/main/src/ui/screens.py"
click node_hud "https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py"
click node_world_setup "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py"
click node_coffee "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py"
click node_barista "https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py"
click node_player_entity "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py"
click node_enemy_ai "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py"
click node_npc_entity "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py"
click node_entity_base "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py"
click node_world_art "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py"
click node_sprites "https://github.com/daniel-goldacker/the-office-game/blob/main/src/render/sprites.py"
click node_config "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/config.py"
click node_utils "https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/utils.py"
click node_sound_assets "https://github.com/daniel-goldacker/the-office-game/tree/main/src/assets/sounds"

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_screens,node_hud toneBlue
class node_main_loop,node_simulation,node_audio,node_config,node_utils toneAmber
class node_world_setup,node_coffee,node_barista,node_player_entity,node_enemy_ai,node_npc_entity,node_entity_base toneMint
class node_world_art,node_sprites,node_sound_assets toneRose
class node_player toneIndigo
```

## Components

### Game interface

- [Start and end screens](https://github.com/daniel-goldacker/the-office-game/blob/main/src/ui/screens.py): `src/ui/screens.py`
- [Gameplay HUD](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py): `src/main.py`

### Game runtime

- [Game loop](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py): `src/main.py`
- [Gameplay simulation](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py): `src/main.py`
- [Sound playback](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py): `src/main.py`
- [Game configuration](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/config.py): `src/core/config.py`
- [Geometry helpers](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/utils.py): `src/core/utils.py`

### Game domain

- [World and waves](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py): `src/core/world.py`
- [Coffee stations](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py): `src/core/world.py`
- [Barista refill](https://github.com/daniel-goldacker/the-office-game/blob/main/src/main.py): `src/main.py`
- [Player entity](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py): `src/core/entities.py`
- [Enemy behavior](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py): `src/core/entities.py`
- [NPC behavior](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py): `src/core/entities.py`
- [Entity movement](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/entities.py): `src/core/entities.py`

### World presentation

- [Office and minimap](https://github.com/daniel-goldacker/the-office-game/blob/main/src/core/world.py): `src/core/world.py`
- [Character sprites](https://github.com/daniel-goldacker/the-office-game/blob/main/src/render/sprites.py): `src/render/sprites.py`
- [Sound assets](https://github.com/daniel-goldacker/the-office-game/tree/main/src/assets/sounds): `src/assets/sounds`

### Other components

- **Player**

## Connections

- Player → Start and end screens: starts and names (evidence: `src/ui/screens.py`)
- Player → Game loop: provides input (evidence: `src/main.py`)
- Game loop → Start and end screens: shows screens (evidence: `src/main.py`)
- Game loop → Gameplay simulation: updates gameplay (evidence: `src/main.py`)
- Game loop → Gameplay HUD: renders HUD (evidence: `src/main.py`)
- Game loop → Sound playback: loads and adjusts (evidence: `src/main.py`)
- Game loop → World and waves: uses world logic (evidence: `src/main.py`)
- Gameplay simulation → Player entity: updates player (evidence: `src/main.py`)
- Gameplay simulation → Enemy behavior: updates enemies (evidence: `src/main.py`)
- Gameplay simulation → Barista refill: refills cups (evidence: `src/main.py`)
- Gameplay simulation → Coffee stations: checks healing (evidence: `src/main.py`)
- World and waves → Character sprites: generates sprites (evidence: `src/core/world.py`)
- World and waves → Entity movement: creates entities (evidence: `src/core/world.py`)
- World and waves → Office and minimap: provides world helpers (evidence: `src/core/world.py`)
- World and waves → Coffee stations: places stations (evidence: `src/core/world.py`)
- Player entity → Entity movement: inherits movement (evidence: `src/core/entities.py`)
- Enemy behavior → Entity movement: inherits movement (evidence: `src/core/entities.py`)
- NPC behavior → Entity movement: inherits movement (evidence: `src/core/entities.py`)
- Entity movement → Geometry helpers: uses clamp (evidence: `src/core/entities.py`)
- Enemy behavior → Geometry helpers: measures distance (evidence: `src/core/entities.py`)
- World and waves → Game configuration: reads settings (evidence: `src/core/world.py`)
- Entity movement → Game configuration: reads settings (evidence: `src/core/entities.py`)
- Game loop → Game configuration: reads settings (evidence: `src/main.py`)
- Sound playback → Sound assets: plays sounds (evidence: `src/main.py`)
