# somethingidk0601/g4n-game- architecture

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

- Interactive diagram: https://gitdiagram.com/somethingidk0601/g4n-game-
- Repository: https://github.com/somethingidk0601/g4n-game-

## Overview

##### Project type and purpose
- This is a 2D game built in the Godot Engine and exported for HTML5 (see index.html, index.wasm, index.pck).
- The README shows it’s a browser-playable game (“G4N-Game-”).
- It uses Godot’s scene-and-node system, with scripts (GDScript) attached to each scene or node.

##### File structure
- Top-level Godot project files:
- project.godot (project configuration)
- export_presets.cfg (export targets)
- index.html / index.js / index.wasm / index.pck (HTML5 export)
- Core directories:
- scene/ – high-level scenes (game.gd, game.tscn, player.tscn, boss.tscn, etc.)
- script/ – top-level scripts for those scenes (player.gd, boss.gd, etc.)
- Enemies/, Player/, Props/, UI Elements/, GeneralNodes/ – subdivided node-packs with their own .tscn and .gd files
- Globals/ – global manager scripts
- assets/ – external sprite and tilemap assets (kenney packs)
- Patterns & config:
- State machines under Enemies/Scripts/states and Player/Scripts
- HitBox/HurtBox common nodes under GeneralNodes
- Audio assets co-located with their nodes
- Export pipeline configured for WebAssembly

##### README
- Confirms browser deployment via GitHub Pages.
- No further architecture details, so derive structure from file tree.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Runtime Layer
    subgraph "Browser Host (HTML5)" 
        Browser["Browser Host (HTML5)"]:::runtime
    end
    subgraph "Godot Engine Runtime" 
        Engine["Godot Engine Runtime"]:::runtime
    end
    subgraph "Export Layer" 
        ExportConfig["Export Configuration"]:::runtime
    end
    Browser --> Engine
    Engine -->|"loads"| ExportConfig
    Engine -->|"initializes"| SceneManager

    %% Scene Manager
    SceneManager("Scene Manager"):::engine
    subgraph "Scene Manager Components"
        GameScene["game.tscn"]:::engine
        GameScript["game.gd"]:::engine
    end
    Engine --> SceneManager
    SceneManager --> GameScene
    SceneManager --> GameScript

    %% Modules
    subgraph "Game Modules"
        subgraph "Player Module" 
            PlayerScene["player.tscn"]:::game
            PlayerScript["player.gd"]:::game
            PStateMachine["player_state_machine.gd"]:::game
            subgraph "States"
                State["state.gd"]:::game
                Idle["state_idle.gd"]:::game
                Attack["state_attack.gd"]:::game
                Walk["state_walk.gd"]:::game
            end
            GunScene["Gun.tscn"]:::game
            BulletScene["Bullet.tscn"]:::game
            Bullet["bullet.gd"]:::game
            Gun["gun.gd"]:::game
            PIHost["PlayerInteractionHost.gd"]:::game
            Audio["SwordSwoosh.wav"]:::game
        end

        subgraph "Enemy Module"
            CreepScene["creep.tscn"]:::game
            CritterScene["critter.tscn"]:::game
            Creepscript["creep.gd"]:::game
            CritScript["critter.gd"]:::game
            EStateMachine["creep_state_machine.gd"]:::game
            subgraph "States"
                CState["creep_state.gd"]:::game
                CIdle["creep_state_idle.gd"]:::game
                CWander["creep_state_wander.gd"]:::game
                CStun["creep_state_stun.gd"]:::game
                CDestroy["creep_state_destroy.gd"]:::game
            end
        end

        subgraph "Props Module"
            BubbleScene["bubble.tscn"]:::game
            BubbleScript["bubble.gd"]:::game
        end

        subgraph "UI Module"
            Instr["Instruction Menu.tscn"]:::game
            InstrScript["instruction_menu.gd"]:::game
            Menu["Menu Scren Modified.tscn"]:::game
            MenuScript["menu_scren_modified.gd"]:::game
            Dead["dead.tscn"]:::game
            Pause["pause_wait_aminute_eushaissmellinghisfeet.tscn"]:::game
            PauseScr["pause_wait_aminute_eushaissmellinghisfeet.gd"]:::game
            Audio1["Opening 1.mp3"]:::game
            Audio2["SadMusic2018-12-29_-_Cold_Isolation_-_David_Fesliyan.mp3"]:::game
        end
    end

    %% Shared Utilities
    subgraph "Shared Utilities"
        Globals["global_player_manager.gd"]:::utility
        subgraph "GeneralNodes"
            HitBoxScene["hit_box.tscn"]:::utility
            HitBoxScript["hit_box.gd"]:::utility
            HurtBoxScene["hurt_box.tscn"]:::utility
            HurtBoxScript["hurt_box.gd"]:::utility
            BulletBoxScene["bullet_box.tscn"]:::utility
            BulletBoxScript["bullet_box.gd"]:::utility
        end
    end

    %% Asset Loader
    AssetLoader["Asset Loader"]:::asset
    Engine --> AssetLoader
    AssetLoader -->|"provides assets"| PlayerScene
    AssetLoader -->|"provides assets"| CreepScene
    AssetLoader -->|"provides assets"| CritterScene
    AssetLoader -->|"provides assets"| BubbleScene

    %% Interactions
    SceneManager --> PlayerScene
    SceneManager --> CreepScene
    SceneManager --> CritterScene
    SceneManager --> BubbleScene
    SceneManager --> Instr

    PlayerScene --> Globals
    CreepScene --> Globals
    PlayerScene --> HitBoxScene
    HitBoxScene --> HurtBoxScene

    %% Click Events
    click Browser "https://github.com/somethingidk0601/g4n-game-/blob/main/index.html"
    click Engine "https://github.com/somethingidk0601/g4n-game-/blob/main/index.wasm"
    click Engine "https://github.com/somethingidk0601/g4n-game-/blob/main/index.js"
    click Engine "https://github.com/somethingidk0601/g4n-game-/blob/main/index.audio.worklet.js"
    click ExportConfig "https://github.com/somethingidk0601/g4n-game-/blob/main/export_presets.cfg"
    click ExportConfig "https://github.com/somethingidk0601/g4n-game-/blob/main/index.pck"
    click GameScene "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/game.tscn"
    click GameScript "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/game.gd"
    click PlayerScene "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/player.tscn"
    click PlayerScript "https://github.com/somethingidk0601/g4n-game-/blob/main/script/player.gd"
    click CreepScene "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/critter.tscn"
    click CritterScene "https://github.com/somethingidk0601/g4n-game-/blob/main/script/critter.gd"
    click CreepScene "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/critter.tscn"
    click CritScript "https://github.com/somethingidk0601/g4n-game-/blob/main/script/critter.gd"
    click CritterScene "https://github.com/somethingidk0601/g4n-game-/blob/main/scene/ghost.tscn"
    click Bubbl eScene "Props/Bubble/bubble.tscn"
    click BubbleScript "https://github.com/somethingidk0601/g4n-game-/blob/main/Props/Bubble/bubble.gd"
    click Instr "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/Instruction Menu.tscn"
    click InstrScript "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/instruction_menu.gd"
    click Menu "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/Menu Scren Modified.tscn"
    click MenuScript "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/menu_scren_modified.gd"
    click Pause "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/pause_wait_aminute_eushaissmellinghisfeet.tscn"
    click PauseScr "https://github.com/somethingidk0601/g4n-game-/blob/main/UI Elements/pause_wait_aminute_eushaissmellinghisfeet.gd"
    click Globals "https://github.com/somethingidk0601/g4n-game-/blob/main/Globals/global_player_manager.gd"
    click HitBoxScene "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HitBox/hit_box.tscn"
    click HitBoxScript "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HitBox/hit_box.gd"
    click HurtBoxScene "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HurtBox/hurt_box.tscn"
    click HurtBoxScript "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HurtBox/hurt_box.gd"
    click BulletBoxScene "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HurtBox/bullet_box.tscn"
    click BulletBoxScript "https://github.com/somethingidk0601/g4n-game-/blob/main/GeneralNodes/HurtBox/bullet_box.gd"

    %% Styles
    classDef runtime fill:#cccccc,stroke:#333,stroke-width:1px
    classDef engine fill:#eeeeee,stroke:#666,stroke-width:1px
    classDef game fill:#add8e6,stroke:#000,stroke-width:1px
    classDef utility fill:#90ee90,stroke:#000,stroke-width:1px
    classDef asset fill:#ffff99,stroke:#000,stroke-width:1px
```
