# quilfort/gameoff-2024 architecture

> Architecture diagram of the GitHub repository quilfort/gameoff-2024, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quilfort/gameoff-2024
- Repository: https://github.com/quilfort/gameoff-2024

## Overview

##### Project type and purpose
- This is a Godot-based game project (“The 500 Numbers Throne”), written in GDScript. It’s a single‐player/turn‐based tournament game with guessing battles, power‐ups, and secret strategies. The project structure follows Godot conventions: Scenes (UI and gameplay), Scripts (game logic and Singletons), Assets (graphics, fonts), and a Godot project file.

##### File structure
- Top‐level:
- project.godot – main Godot project descriptor
- Assets/ – all art assets (backgrounds, characters, fonts)
- Scenes/ – .tscn scene files (Menu, Battle, UI overlays)
- Scripts/ – GDScript logic, subdivided into Menu, Singleton, and per‐scene scripts
- UI/ – .tres resources for Buttons, Dialogs, Input fields
- “Singleton” folder contains global managers (battle_data, game_data, player_data, strategy_data, computer_data) registered in Godot as AutoLoad.
- No external services: everything runs inside the Godot engine.

##### README for additional insights
- Confirms GDScript and Godot engine.
- Gameplay flow: Main Menu → Tutorial → Before Battle → Battle → After Battle → Tournament → Credits.
- Planned features (power‐ups, strategies) hint at components to add.

a. Main components:
1. Godot Engine Core (SceneTree & main loop)
2. Scenes Layer
– Menu Scenes (main menu, settings, restart)
– Gameplay Scenes (before_battle, battle, after_battle, tournament, tutorial, character_dialog, credits)
– UI Overlay Scene (ui.tscn)
3. Script Layer
– Scene Controllers (e.g., menu_background.gd, battle.gd, ui.gd)
– Singletons (AutoLoad scripts providing shared state: game_data, player_data, computer_data, battle_data, strategy_data)
4. Assets Layer
– Sprites (Characters, Backgrounds)
– Fonts
b. Relationships & interactions:
– At startup, Godot loads project.godot and initializes Singletons → then loads main menu Scene.
– Scene Controllers connect to Singletons to read/write game state.
– UI Scene emits signals (button_pressed, guess_submitted) to controllers.
– Controllers update Singletons, trigger SceneTree.change_scene() to navigate.
– Assets are fetched by Scenes at load‐time.
c. Architectural patterns/design principles:
– MVC‐like separation:
- Model = Singletons (global state)
- View = Scenes & Assets
- Controller = Scripts attached to Scenes
– Event‐driven via Godot signals for UI interactions.
– AutoLoad Singletons for shared data rather than passing state manually.
d. Key technologies/frameworks:
– Godot Engine 4.x (assumed)
– GDScript for application logic
– Godot’s SceneTree for scene management
– Godot signals for event dispatch
– .tscn (scenes) and .tres (resources) file formats

##### Capturing essential architectural elements
- AutoLoad Singleton as its own component.
- That Scenes reference Scripts and Assets.
- Game flow from menu to tournament.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define core
    EngineCore["Godot Engine Core\n(project.godot)"]:::core
    click EngineCore "https://github.com/quilfort/gameoff-2024/blob/main/project.godot"

    %% Singletons
    subgraph "AutoLoad Singletons"
        direction TB
        battleData["Battle Data"]:::singleton
        gameData["Game Data"]:::singleton
        playerData["Player Data"]:::singleton
        computerData["Computer Data"]:::singleton
        strategyData["Strategy Data"]:::singleton
    end
    click battleData "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Singleton/battle_data.gd"
    click gameData "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Singleton/game_data.gd"
    click playerData "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Singleton/player_data.gd"
    click computerData "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Singleton/computer_data.gd"
    click strategyData "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Singleton/strategy_data.gd"

    EngineCore -->|"init AutoLoad"| battleData
    EngineCore --> gameData
    EngineCore --> playerData
    EngineCore --> computerData
    EngineCore --> strategyData

    %% Scenes
    subgraph "Scenes" 
        direction TB
        subgraph "Menu Scenes"
            direction TB
            mainMenu["Main Menu Scene"]:::scene
            menuBg["Menu Background Scene"]:::scene
            restartMenu["Restart Menu Scene"]:::scene
            settingsScene["Settings Scene"]:::scene
        end
        subgraph "Gameplay Scenes"
            direction TB
            beforeBattle["Before Battle Scene"]:::scene
            battleScene["Battle Scene"]:::scene
            afterBattle["After Battle Scene"]:::scene
            tournamentScene["Tournament Scene"]:::scene
            tutorialStory["Tutorial Story Scene"]:::scene
            characterDialog["Character Dialog Scene"]:::scene
            creditsScene["Credits Scene"]:::scene
        end
        uiScene["UI Overlay Scene"]:::scene
    end

    click mainMenu "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/Menu/main.tscn"
    click menuBg "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/Menu/menu_background.tscn"
    click restartMenu "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/Menu/restart_menu.tscn"
    click settingsScene "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/Menu/settings.tscn"
    click beforeBattle "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/before_battle.tscn"
    click battleScene "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/battle.tscn"
    click afterBattle "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/after_battle.tscn"
    click tournamentScene "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/tournament.tscn"
    click tutorialStory "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/tutorial_story.tscn"
    click characterDialog "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/character_dialog.tscn"
    click creditsScene "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/credits.tscn"
    click uiScene "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scenes/ui.tscn"

    %% Scripts (Controllers)
    subgraph "Scene Controllers (Scripts)"
        direction TB
        mainMenuCtrl["Main Menu Controller"]:::script
        menuBgCtrl["Menu Background Controller"]:::script
        restartMenuCtrl["Restart Menu Controller"]:::script
        settingsCtrl["Settings Controller"]:::script
        beforeBattleCtrl["Before Battle Controller"]:::script
        battleCtrl["Battle Controller"]:::script
        afterBattleCtrl["After Battle Controller"]:::script
        tournamentBracket["Tournament Bracket Logic"]:::script
        tournamentSchema["Tournament Schema Logic"]:::script
        tutorialStoryCtrl["Tutorial Story Controller"]:::script
        characterDialogCtrl["Character Dialog Controller"]:::script
        creditsCtrl["Credits Controller"]:::script
        uiCtrl["UI Controller"]:::script
    end

    click mainMenuCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/main_menu.gd"
    click menuBgCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/Menu/menu_background.gd"
    click restartMenuCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/restart_menu.gd"
    click settingsCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/settings.gd"
    click beforeBattleCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/before_battle.gd"
    click battleCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/battle.gd"
    click afterBattleCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/after_battle.gd"
    click tournamentBracket "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/tournament_bracket.gd"
    click tournamentSchema "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/tournament_schema.gd"
    click tutorialStoryCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/tutorial_story.gd"
    click characterDialogCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/character_dialog.gd"
    click creditsCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/credits.gd"
    click uiCtrl "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/Scripts/ui.gd"

    %% Assets Layer
    subgraph "Assets"
        direction TB
        charSprites["Character Sprites"]:::asset
        bgArt["Background Art"]:::asset
        fonts["Fonts"]:::asset
        buttonRes["Button Resource"]:::asset
        dialogBoxRes["Dialog Box Resource"]:::asset
        guessInputRes["Guess Input Resource"]:::asset
        menuTextRes["Menu Text Panel Resource"]:::asset
    end

    click charSprites "https://github.com/quilfort/gameoff-2024/tree/main/game-off-2024/Assets/Characters"
    click bgArt "https://github.com/quilfort/gameoff-2024/tree/main/game-off-2024/Assets/Background"
    click fonts "https://github.com/quilfort/gameoff-2024/tree/main/game-off-2024/Assets/Fonts"
    click buttonRes "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/UI/Buttons/button_basic.tres"
    click dialogBoxRes "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/UI/CharacterDialog/dialog_box.tres"
    click guessInputRes "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/UI/GuessInput/guess_input.tres"
    click menuTextRes "https://github.com/quilfort/gameoff-2024/blob/main/game-off-2024/UI/Menu/text_panel.tres"

    %% Initialization Flow
    EngineCore -->|"load Main Menu"| mainMenu

    %% Scene to Controller bindings
    mainMenu -->|"attached script"| mainMenuCtrl
    menuBg -->|"attached script"| menuBgCtrl
    restartMenu -->|"attached script"| restartMenuCtrl
    settingsScene -->|"attached script"| settingsCtrl
    beforeBattle -->|"attached script"| beforeBattleCtrl
    battleScene -->|"attached script"| battleCtrl
    afterBattleScene -->|"attached script"| afterBattleCtrl
    tournamentScene -->|"attached script"| tournamentBracket
    tournamentScene -->|"attached script"| tournamentSchema
    tutorialStory -->|"attached script"| tutorialStoryCtrl
    characterDialog -->|"attached script"| characterDialogCtrl
    creditsScene -->|"attached script"| creditsCtrl
    uiScene -->|"attached script"| uiCtrl

    %% Controllers to Singletons
    mainMenuCtrl -->|"write/read"| gameData
    beforeBattleCtrl -->|"init battle"| battleData
    battleCtrl -->|"update"| playerData
    battleCtrl -->|"update"| computerData
    tournamentBracket -->|"read/write"| gameData
    tournamentSchema -->|"read/write"| strategyData

    %% UI interactions
    uiScene -->|"emit_signal('button_pressed')"| uiCtrl
    uiCtrl -->|"dispatch"| mainMenuCtrl
    uiCtrl -->|"dispatch"| battleCtrl

    %% Game flow transitions
    mainMenuCtrl -->|"start_game()"| beforeBattle
    beforeBattleCtrl -->|"go_to_battle()"| battleScene
    battleCtrl -->|"finish_battle()"| afterBattleScene
    afterBattleCtrl -->|"next_round()"| tournamentScene
    tournamentSchema -->|"on_tournament_end()"| creditsScene

    %% Scenes load assets
    mainMenu -->|"load assets"| charSprites
    mainMenu --> bgArt
    mainMenu --> fonts
    beforeBattle --> charSprites
    battleScene --> charSprites
    uiScene --> buttonRes
    uiScene --> dialogBoxRes
    uiScene --> guessInputRes
    uiScene --> menuTextRes

    %% Styles
    classDef core fill:#D3D3D3
    classDef scene fill:#ADD8E6
    classDef script fill:#90EE90
    classDef singleton fill:#FFA500
    classDef asset fill:#FFFF00
```
