# moepoi/frontier-of-hell architecture

> Architecture diagram of the GitHub repository moepoi/frontier-of-hell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moepoi/frontier-of-hell
- Repository: https://github.com/moepoi/frontier-of-hell

## Overview

##### Project Type and Purpose
- Frontier of Hell is a monolithic, real‐time tower defense game built using the Godot Engine.
- The README confirms it’s a stage‐based defense game where the player places and upgrades towers to stop waves of enemies.

##### File Structure Analysis
- Top‐level:
- project.godot + export_presets.cfg → Godot project configuration
- CI files (.gitlab‐ci.yml), LICENSE, .gitignore → repo tooling
- scenes/ → Godot .tscn scene files, organized by feature:
- base (root scene prototypes)
- bullets, enemies, towers, marker (game objects)
- stages (level scenes)
- ui (menus, overlays, themes)
- scripts/ → GDScript logic mirroring scenes, plus:
- scripts/global.gd (autoloaded singleton)
- scripts/data/data.gd (shared data structures)
- per‐stage folders (config.gd, game_manager.gd, summon.gd)
- UI controllers (main_menu.gd, game_stats.gd, etc.)
- themes/ → .tres theme files for consistent UI styling

##### README Insights
- Build artifacts target Windows, Linux, Android via export presets.

- UI → Global → Scene Manager → Stage Controller
- Stage Controller → Spawner → Enemy Scenes
- Player Input → Tower Controller → Tower Scenes → Bullet Controller
- Bullet → Enemy → Stage Controller → UI
- Blue = Godot Engine/Core services
- Green = Game logic controllers (scripts)
- Yellow = Assets/Resources
- Purple = UI & Themes
- Notes on where export_presets and CI integrate (e.g., outside the runtime, in build pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Input
    PlayerInput["Player Input"]:::external

    %% Core Services
    subgraph "Godot Engine Core"
        Engine["Godot Engine"]:::core
        ResourceLoader["Resource Loader / Asset Manager"]:::asset
        SceneManager["Scene Manager"]:::core
    end

    %% Global & Data
    GlobalSingleton["Global Singleton"]:::core
    DataConfig["Data Config (shared)"]:::core
    StageConfigs["Stage Configs"]:::core

    %% Game Logic Controllers
    subgraph "Game Logic Controllers"
        StageController["Stage Controller"]:::logic
        EnemySpawner["Enemy Spawner"]:::logic
        TowerController["Tower Controller"]:::logic
        BulletController["Bullet Controller"]:::logic
        EnemyLogic["Enemy Base Logic"]:::logic
    end

    %% Scenes
    subgraph "Scene Prototypes & Instances"
        BaseScene["Base Scene Prototype"]:::core
        StageScenes["Stage Scenes"]:::core
        EnemyScenes["Enemy Scenes"]:::core
        TowerScenes["Tower Scenes"]:::core
        BulletScenes["Bullet Scenes"]:::core
    end

    %% UI Layer
    subgraph "UI & Themes"
        UIManager["UI Manager"]:::ui
        UIScenes["UI Scenes"]:::ui
        UIThemes["UI Themes"]:::ui
    end

    %% Audio
    AudioManager["Audio Manager Resources"]:::asset

    %% Relationships
    PlayerInput -->|"input_event"| UIManager
    UIManager -->|"select_stage"| GlobalSingleton
    GlobalSingleton -->|"load_stage"| SceneManager
    SceneManager -->|"instantiates_stage"| StageScenes
    StageScenes -->|"init|read config"| StageController
    StageConfigs -->|"provides data"| StageController
    StageController -->|"spawn_wave"| EnemySpawner
    EnemySpawner -->|"instantiates_enemy"| EnemyScenes
    PlayerInput -->|"place_tower"| TowerController
    TowerController -->|"instantiate_tower"| TowerScenes
    TowerController -->|"detect_enemy"| EnemyLogic
    Tree -->|"fire|tower"| BulletController
    BulletController -->|"instantiate_bullet"| BulletScenes
    BulletScenes -->|"on_collision"| EnemyLogic
    EnemyLogic -->|"enemy_hit"| StageController
    StageController -->|"update_state"| UIManager
    StageController -->|"play_audio"| AudioManager
    StageController -->|"end_stage"| UIManager
    ResourceLoader -->|"loads assets"| SceneManager
    Engine --> ResourceLoader
    Engine --> SceneManager
    Engine --> BaseScene

    %% Click Events
    click Engine "https://github.com/moepoi/frontier-of-hell/blob/main/project.godot"
    click Engine "https://github.com/moepoi/frontier-of-hell/blob/main/export_presets.cfg"
    click ResourceLoader "https://github.com/moepoi/frontier-of-hell/tree/main/assets/"
    click SceneManager "https://github.com/moepoi/frontier-of-hell/tree/main/scenes/"
    click GlobalSingleton "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/global.gd"
    click DataConfig "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/data/data.gd"
    click StageConfigs "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/stages/1/config.gd"
    click StageController "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/stages/1/game_manager.gd"
    click EnemySpawner "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/stages/1/summon.gd"
    click TowerController "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/towers/tower.gd"
    click TowerController "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/towers/placement/placement.gd"
    click BulletController "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/bullets/bullet.gd"
    click EnemyLogic "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/enemies/enemy.gd"
    click BaseScene "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/base/base.tscn"
    click StageScenes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/stages/stage_1.tscn"
    click EnemyScenes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/enemies/cyclops.tscn"
    click TowerScenes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/towers/cannon_1.tscn"
    click BulletScenes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/bullets/bullet_1.tscn"
    click UIManager "https://github.com/moepoi/frontier-of-hell/blob/main/scripts/ui/main_menu.gd"
    click UIScenes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/ui/main_menu.tscn"
    click UIThemes "https://github.com/moepoi/frontier-of-hell/blob/main/scenes/ui/themes/leltres.tres"
    click AudioManager "https://github.com/moepoi/frontier-of-hell/tree/main/assets/audio/"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085
    classDef asset fill:#fff3cd,stroke:#856404,color:#856404
    classDef logic fill:#d4edda,stroke:#155724,color:#155724
    classDef ui fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
```
