# emmyakine/maze-of-the-hollow architecture

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

- Interactive diagram: https://gitdiagram.com/emmyakine/maze-of-the-hollow
- Repository: https://github.com/emmyakine/maze-of-the-hollow

## Overview

1. This is a Unity 2D top-down maze runner, built around two playable scenes: `Main_Menu` and `Game_Scene`. The project is content-heavy in `Assets/` and code-driven through `Assets/Scripts/`, with Unity prefabs, scene assets, audio, and URP rendering settings providing the runtime structure.

2. The core game loop lives in the `Game_Scene`: generate a maze, spawn the player and interactables, navigate the maze, collect keys/lives, avoid or be chased by the ghost, and reach the exit door. `GameManager`, `LevelLoader`, and `MainMenuManager` likely coordinate scene transitions, restart/win/lose flow, and difficulty/menu state.

3. Procedural maze generation is a central subsystem. `MazeGenerator`, `Grid`, `Cell`, and `ListExtensions` suggest a grid-based recursive backtracking maze builder that carves pathways, then feeds the rest of the game with valid navigation/layout data. This is the primary source of world structure rather than a hand-authored level.

4. The maze layout is turned into physical game objects through prefab-based spawning. The repository contains prefabs for horizontal/vertical walls, doors, keys, lives, respawn points, buttons, and the ghost. Spawner scripts such as `KeysSpawner`, `LivesSpawner`, `RespawnPointSpawner`, `GhostSpawner`, and `QuadrantSpawner` distribute these objects into the generated maze.

5. Player control is separated from navigation logic. `PlayerMovement` handles movement, while `CameraFollow` keeps the top-down camera locked to the player. Input is wired through Unity’s Input System via `Assets/Input System/PlayerInputActions.inputactions` and the generated `PlayerInputActions.cs` / `GameInputs.cs` layer.

6. Enemy behavior is split into chase control and path computation. `EnemyAI`, `EnemyPathFindingMovement`, and `PathFinding` indicate the ghost uses maze-aware pathfinding rather than simple pursuit. This makes the ghost a system consumer of the generated grid, not just a physics-follow enemy. `Ghost.prefab` is the runtime enemy instance.

7. Collectibles and fail/survival mechanics are explicit gameplay subsystems. `Keys` and `Lives` represent pickup objects, with their spawners controlling placement. `EndDoorScript` likely gates progression until key requirements are met, while `RespawnPoint` supports player recovery or checkpoint-style returns after failure.

8. UI is a separate layer from gameplay logic. `UIManager`, `HorizontalSelector`, `UIButtonGlow`, and `UIButtonSFX` indicate menu/game HUD controls, visual feedback, and audio-reactive button behavior. The UI content in `UI Rough Uploads` suggests the project has custom menu widgets for difficulty and settings.

9. Audio is fully authored as game content and centrally managed. `AudioManager` works with `MasterAudioMixer.mixer`, a default volume profile, and many SFX clips for button clicks, key pickup, ghost catch, pause, lose/win, and save/respawn events. This implies event-driven sound playback tied to gameplay and UI transitions.

10. The project uses Unity’s Universal Render Pipeline and scene-local volume profiles. `UniversalRP.asset`, `Renderer2D.asset`, `Global Volume Profile.asset` in both scenes, and the TextMesh Pro package indicate the visual stack is 2D URP with post-processing and styled UI text. Rendering is configured at the project level rather than in code.

11. `Assets/Prefabs/` is the main integration boundary between code and content. Most gameplay systems appear to instantiate or reference prefabs rather than build objects procedurally from scratch, which keeps maze generation, enemy spawning, and pickups decoupled from scene authoring.

12. The repository’s architectural shape is therefore: scene bootstrap and menu flow on one side; procedural maze generation and spawning in the middle; player/enemy/collectible gameplay systems on top of that; and UI/audio/rendering as cross-cutting presentation layers. For an architecture diagram, the key dependency arrows are from generated grid/maze state into spawners and pathfinding, and from gameplay events back into UI, audio, and scene transition managers.

Main entry points: [`Assets/Scripts/GameManager.cs`](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/GameManager.cs) (GameManager), [`Assets/Prefabs`](https://github.com/emmyakine/maze-of-the-hollow/tree/main/Assets/Prefabs) (Prefabs), [`Assets/Scenes/Game_Scene.unity`](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scenes/Game_Scene.unity) (Game Scene), [`Assets/Scripts/MazeGenerator.cs`](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/MazeGenerator.cs) (Maze Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenes["Scenes"]
  node_main_menu_scene["Main Menu<br/>scene<br/>[Main_Menu.unity]"]
  node_game_scene["Game Scene<br/>[Game_Scene.unity]"]
end

subgraph group_core["Core Gameplay"]
  node_game_manager["GameManager<br/>flow<br/>[GameManager.cs]"]
  node_level_loader["LevelLoader<br/>scene flow<br/>[LevelLoader.cs]"]
  node_menu_manager["Menu Manager<br/>menu flow<br/>[MainMenuManager.cs]"]
  node_maze_generator["Maze Generator<br/>procedural gen<br/>[MazeGenerator.cs]"]
  node_grid["Grid<br/>maze data<br/>[Grid.cs]"]
  node_cell["Cell<br/>[Cell.cs]"]
  node_path_finding["Path Finding<br/>navigation<br/>[PathFinding.cs]"]
  node_player_movement["Player Movement<br/>player control<br/>[PlayerMovement.cs]"]
  node_enemy_ai["Enemy AI<br/>chase control<br/>[EnemyAI.cs]"]
  node_enemy_path_movement["Enemy Move"]
  node_keys_spawner["Keys Spawner<br/>[KeysSpawner.cs]"]
  node_lives_spawner["Lives Spawner<br/>[LivesSpawner.cs]"]
  node_respawn_spawner["Respawn Spawner"]
  node_ghost_spawner["Ghost Spawner<br/>[GhostSpawner.cs]"]
  node_quadrant_spawner["Quadrant Spawner<br/>layout spawn<br/>[QuadrantSpawner.cs]"]
end

subgraph group_content["Content"]
  node_prefabs[("Prefabs<br/>content boundary")]
  node_ghost_prefab["Ghost<br/>enemy prefab<br/>[Ghost.prefab]"]
end

subgraph group_presentation["Presentation"]
  node_hud_manager["UI Manager<br/>[UIManager.cs]"]
  node_audio_manager["Audio Manager<br/>[AudioManager.cs]"]
  node_camera_follow["Camera Follow<br/>[CameraFollow.cs]"]
  node_settings_manager["Settings<br/>[SettingsManager.cs]"]
  node_input_actions["Input Actions<br/>input system"]
end

node_main_menu_scene -->|"hosts"| node_menu_manager
node_main_menu_scene -->|"menu UI"| node_hud_manager
node_game_scene -->|"hosts"| node_game_manager
node_game_scene -->|"boots"| node_maze_generator
node_game_scene -->|"contains"| node_camera_follow
node_game_manager -->|"controls"| node_level_loader
node_menu_manager -->|"starts game"| node_level_loader
node_maze_generator -->|"builds"| node_grid
node_grid -->|"contains"| node_cell
node_maze_generator -->|"feeds"| node_quadrant_spawner
node_grid -->|"routes"| node_path_finding
node_player_movement -->|"reads"| node_input_actions
node_player_movement -->|"drives"| node_camera_follow
node_enemy_ai -->|"uses"| node_enemy_path_movement
node_enemy_path_movement -->|"queries"| node_path_finding
node_ghost_spawner -->|"instantiates"| node_ghost_prefab
node_ghost_spawner -->|"attaches"| node_enemy_ai
node_keys_spawner -->|"uses"| node_prefabs
node_lives_spawner -->|"uses"| node_prefabs
node_respawn_spawner -->|"uses"| node_prefabs
node_quadrant_spawner -->|"uses"| node_prefabs
node_hud_manager -->|"triggers"| node_audio_manager
node_game_manager -->|"updates"| node_hud_manager
node_game_manager -->|"signals"| node_audio_manager
node_settings_manager -->|"configures"| node_audio_manager

click node_main_menu_scene "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scenes/Main_Menu.unity"
click node_game_scene "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scenes/Game_Scene.unity"
click node_game_manager "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/GameManager.cs"
click node_level_loader "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/LevelLoader.cs"
click node_menu_manager "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/MainMenuManager.cs"
click node_maze_generator "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/MazeGenerator.cs"
click node_grid "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/Grid.cs"
click node_cell "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/Cell.cs"
click node_path_finding "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/PathFinding.cs"
click node_player_movement "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/PlayerMovement.cs"
click node_enemy_ai "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/EnemyAI.cs"
click node_enemy_path_movement "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/EnemyPathFindingMovement.cs"
click node_keys_spawner "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/KeysSpawner.cs"
click node_lives_spawner "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/LivesSpawner.cs"
click node_respawn_spawner "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/RespawnPointSpawner.cs"
click node_ghost_spawner "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/GhostSpawner.cs"
click node_quadrant_spawner "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/QuadrantSpawner.cs"
click node_hud_manager "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/UI Manager/UIManager.cs"
click node_audio_manager "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/AudioManager.cs"
click node_camera_follow "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/CameraFollow.cs"
click node_settings_manager "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/SettingsManager.cs"
click node_prefabs "https://github.com/emmyakine/maze-of-the-hollow/tree/main/Assets/Prefabs"
click node_ghost_prefab "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Ghost [Enemy]/Ghost.prefab"
click node_input_actions "https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Input System/PlayerInputActions.inputactions"

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_menu_scene,node_game_scene toneBlue
class node_game_manager,node_level_loader,node_menu_manager,node_maze_generator,node_grid,node_cell,node_path_finding,node_player_movement,node_enemy_ai,node_enemy_path_movement,node_keys_spawner,node_lives_spawner,node_respawn_spawner,node_ghost_spawner,node_quadrant_spawner toneAmber
class node_prefabs,node_ghost_prefab toneMint
class node_hud_manager,node_audio_manager,node_camera_follow,node_settings_manager,node_input_actions toneRose
```

## Components

### Scenes

Playable scenes and scene-specific bootstrap content

- [Main Menu](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scenes/Main_Menu.unity): scene · Menu scene and its local volume setup · `Assets/Scenes/Main_Menu.unity`
- [Game Scene](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scenes/Game_Scene.unity): scene · Primary gameplay scene and its local volume setup · `Assets/Scenes/Game_Scene.unity`

### Core Gameplay

Game flow, maze generation, movement, and enemy logic

- [GameManager](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/GameManager.cs): flow · Central gameplay state and run lifecycle · `Assets/Scripts/GameManager.cs`
- [LevelLoader](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/LevelLoader.cs): scene flow · Scene transitions and level loading · `Assets/Scripts/LevelLoader.cs`
- [Menu Manager](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/MainMenuManager.cs): menu flow · Main menu state and start/options flow · `Assets/Scripts/MainMenuManager.cs`
- [Maze Generator](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/MazeGenerator.cs): procedural gen · Builds maze layout from grid data · `Assets/Scripts/MazeGenerator.cs`
- [Grid](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/Grid.cs): maze data · Maze cell layout and navigation structure · `Assets/Scripts/Grid.cs`
- [Cell](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/Cell.cs): maze cell · Single maze cell representation · `Assets/Scripts/Cell.cs`
- [Path Finding](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/PathFinding.cs): navigation · Maze-aware route computation for enemy movement · `Assets/Scripts/PathFinding.cs`
- [Player Movement](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/PlayerMovement.cs): player control · Player locomotion in the maze · `Assets/Scripts/PlayerMovement.cs`
- [Enemy AI](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/EnemyAI.cs): chase control · Ghost behavior and chase orchestration · `Assets/Scripts/EnemyAI.cs`
- [Enemy Move](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/EnemyPathFindingMovement.cs): enemy movement · Moves the ghost along computed paths · `Assets/Scripts/EnemyPathFindingMovement.cs`
- [Keys Spawner](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/KeysSpawner.cs): spawner · Places key pickups in the maze · `Assets/Scripts/KeysSpawner.cs`
- [Lives Spawner](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/LivesSpawner.cs): spawner · Places life pickups in the maze · `Assets/Scripts/LivesSpawner.cs`
- [Respawn Spawner](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/RespawnPointSpawner.cs): spawner · Places respawn or checkpoint points · `Assets/Scripts/RespawnPointSpawner.cs`
- [Ghost Spawner](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/GhostSpawner.cs): spawner · Creates the runtime ghost enemy · `Assets/Scripts/GhostSpawner.cs`
- [Quadrant Spawner](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/QuadrantSpawner.cs): layout spawn · Distributes maze content by region · `Assets/Scripts/QuadrantSpawner.cs`

### Content

Prefabs and authored runtime assets

- [Prefabs](https://github.com/emmyakine/maze-of-the-hollow/tree/main/Assets/Prefabs): content boundary · Runtime objects instantiated by gameplay systems · `Assets/Prefabs`
- [Ghost](https://github.com/emmyakine/maze-of-the-hollow/blob/HEAD/Assets/Ghost%20%5BEnemy%5D/Ghost.prefab): enemy prefab · Runtime ghost enemy instance · `Assets/Ghost [Enemy]/Ghost.prefab`

### Presentation

UI, audio, and rendering configuration

- [UI Manager](https://github.com/emmyakine/maze-of-the-hollow/blob/HEAD/Assets/UI%20Manager/UIManager.cs): ui · HUD and menu UI coordination · `Assets/UI Manager/UIManager.cs`
- [Audio Manager](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/AudioManager.cs): audio · Central SFX and music playback · `Assets/Scripts/AudioManager.cs`
- [Camera Follow](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/CameraFollow.cs): camera · Top-down camera tracking · `Assets/Scripts/CameraFollow.cs`
- [Settings](https://github.com/emmyakine/maze-of-the-hollow/blob/main/Assets/Scripts/SettingsManager.cs): settings · Runtime settings and preferences · `Assets/Scripts/SettingsManager.cs`
- [Input Actions](https://github.com/emmyakine/maze-of-the-hollow/blob/HEAD/Assets/Input%20System/PlayerInputActions.inputactions): input system · Unity Input System bindings and generated layer · `Assets/Input System/PlayerInputActions.inputactions`

## Connections

- Main Menu → Menu Manager: hosts · Menu scene runs menu flow
- Main Menu → UI Manager: menu UI · Scene contains menu widgets
- Game Scene → GameManager: hosts · Gameplay scene is driven by game state
- Game Scene → Maze Generator: boots · Scene initializes maze creation
- Game Scene → Camera Follow: contains · Scene camera tracks the player
- GameManager → LevelLoader: controls · Starts restarts and scene changes
- Menu Manager → LevelLoader: starts game · Menu launches gameplay scene
- Maze Generator → Grid: builds · Generates maze structure on a grid
- Grid → Cell: contains · Grid is composed of cells
- Maze Generator → Quadrant Spawner: feeds · Generated layout informs regional spawning
- Grid → Path Finding: routes · Enemy pathfinding consumes maze graph
- Player Movement → Input Actions: reads · Movement uses Input System bindings
- Player Movement → Camera Follow: drives · Player position updates the camera
- Enemy AI → Enemy Move: uses · AI delegates movement execution
- Enemy Move → Path Finding: queries · Movement follows computed maze paths
- Ghost Spawner → Ghost: instantiates · Spawner creates the ghost prefab
- Ghost Spawner → Enemy AI: attaches · Spawned ghost runs AI
- Keys Spawner → Prefabs: uses · Spawns key pickup prefabs
- Lives Spawner → Prefabs: uses · Spawns life pickup prefabs
- Respawn Spawner → Prefabs: uses · Places respawn point prefabs
- Quadrant Spawner → Prefabs: uses · Places maze props and interactables
- UI Manager → Audio Manager: triggers · UI actions play button feedback
- GameManager → UI Manager: updates · Win lose pause and progress state
- GameManager → Audio Manager: signals · Gameplay events trigger audio cues
- Settings → Audio Manager: configures · Settings affect volume and preferences
