# gamingxrelic/ratioactive architecture

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

- Interactive diagram: https://gitdiagram.com/gamingxrelic/ratioactive
- Repository: https://github.com/gamingxrelic/ratioactive

## Overview

1. This is a Godot 4 game project: a top-down shooter with a scene-driven architecture. The core runtime is the Godot engine; almost all gameplay behavior lives in GDScript attached to scenes or resources.

2. The project is split into a few major top-level domains: scenes, scripts, resources, components, and assets. Scenes define instanced game objects and screens; scripts provide behavior; resources hold data-driven weapon/bullet definitions; components encapsulate reusable gameplay modules; assets supply art, audio, shaders, and UI media.

3. The main composition root is the gameplay scene set under `scenes/Game.tscn`, backed by `scripts/Game.gd`. That scene is likely responsible for assembling the active level, player, UI, and any global game state transitions during play.

4. Global/shared state is centralized through autoload singletons in `scripts/autoload`: `World.gd`, `Menus.gd`, `PlayerGun.gd`, and `WeaponList.gd`. These are the cross-scene boundaries for world/game mode coordination, menu navigation, current player weapon state, and available weapon catalog access.

5. Player and enemy logic are separate entity subsystems. `scenes/entities/Player/Player.tscn` with `scripts/player/Player.gd` handles player movement and interaction; `scenes/entities/enemies/Enemy.tscn` with `scripts/entities/enemy/Enemy.gd` handles enemy behavior. Drops are also modeled as entities, including `Dropped_Weapon.tscn`, `Ammo_Drop.tscn`, and `Health_Drop.tscn`.

6. Combat is split into weapon, projectile, and hit-detection layers. `scripts/gun/Gun.gd`, `Bullet.gd`, and `Grenade.gd` drive firing and projectile behavior; `scenes/weapons/bullets/Standard_Bullet.tscn` and `Grenade.tscn` are the instanced projectile scenes. Weapon definitions are data-driven via `resources/weapon/*.tres` using `resources/weapon/Base_Weapon.gd`.

7. Reusable gameplay mechanics are factored into component scenes under `components/scenes` with matching scripts in `components/script`. The key components are health, hurtbox, attackbox, contact damage, buyable interaction, and text label support. This indicates a composition-over-inheritance style for many interactive objects.

8. The world/map layer is separate from entities. Levels live in `scenes/levels`, with a shared base in `scripts/levels/Level.gd` and level-specific logic such as `Kitchen_Ramp.gd`, `Spawn_Room_Outlet_EE.gd`, and `Transparent_When_Player_Enters.gd`. Map interaction objects like doors, random weapon pickups, wall guns, and enemy spawners sit under `scenes/map`.

9. Menu and HUD flows are isolated from gameplay. `scenes/menus` contains main menu, options, levels menu, and death screen scenes; `scenes/UI/Game_UI.tscn` and `scenes/UI/pause_menu.tscn` provide in-game HUD and pause overlay. Matching scripts in `scripts/menus` and `scripts/ui` keep UI logic separate from combat/world logic.

10. Audio, visual effects, and theming are content-heavy but still scene/resource oriented. Sound assets are grouped by context in `assets/audio` (menus, player, enemies, weapons, levels), while outlines and shader resources live in `assets/shaders`. This suggests most feedback effects are attached at the scene/resource level rather than handled globally.

11. The project uses data resources for balancing and content variation. Besides weapons, there are label resources like `resources/labels/Dropped_Weapons_Label.tres` and bullet resources like `resources/bullet/Standard_Bullet.tres`. This lets scenes reference tuned values and shared configurations without duplicating logic.

12. The architecture boundary is clear: scenes define runtime objects, scripts define behavior, resources define tunable content, and autoloads bridge state across scenes. For an architecture diagram, the main arrows are from global singletons into gameplay/UI scenes, from weapon/bullet resources into combat scenes, and from level/map scenes into entity and component instances.

Main entry points: [`top_down_shooter/scenes/Game.tscn`](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/Game.tscn) (Game), [`top_down_shooter/scenes/UI/Game_UI.tscn`](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/UI/Game_UI.tscn) (Game UI), [`top_down_shooter/scenes/entities/enemies/Enemy.tscn`](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/enemies/Enemy.tscn) (Enemy), [`top_down_shooter/components/scenes/Health_Component.tscn`](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/components/scenes/Health_Component.tscn) (Combat comps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_scenes["Scenes"]
  node_node_game_scene["Game<br/>composition root<br/>[Game.tscn]"]
  node_node_player_scene["Player<br/>entity scene<br/>[Player.tscn]"]
  node_node_enemy_scene["Enemy<br/>entity scene<br/>[Enemy.tscn]"]
  node_node_drop_scene["Drops<br/>loot scenes"]
  node_node_level_scene["Levels<br/>level scenes<br/>[Level_Kitchen.tscn]"]
  node_node_map_scene["Map objects<br/>map scenes<br/>[Door.tscn]"]
  node_node_ui_scene["Game UI<br/>hud scene<br/>[Game_UI.tscn]"]
  node_node_menu_scene["Menus<br/>menu scenes<br/>[Main_Menu.tscn]"]
  node_node_weapon_scene["Weapons<br/>combat scenes"]
end

subgraph group_group_scripts["Scripts"]
  node_node_game_script["Game logic<br/>scene controller<br/>[Game.gd]"]
  node_node_autoloads["Autoloads<br/>global state<br/>[World.gd]"]
  node_node_player_script["Player logic<br/>entity logic<br/>[Player.gd]"]
  node_node_enemy_script["Enemy logic<br/>entity logic<br/>[Enemy.gd]"]
  node_node_gun_script["Gun logic<br/>combat logic<br/>[Gun.gd]"]
  node_node_level_script["Level logic<br/>[Level.gd]"]
  node_node_ui_script["UI logic<br/>[Game_UI.gd]"]
  node_node_menu_script["Menu logic<br/>[Main_Menu.gd]"]
end

subgraph group_group_resources["Resources"]
  node_node_weapon_data["Weapon data<br/>weapon resources<br/>[Base_Weapon.gd]"]
  node_node_bullet_data["Bullet data<br/>projectile resources<br/>[Bullet_Res.gd]"]
  node_node_label_data["Label data<br/>ui resources"]
end

subgraph group_group_components["Components"]
  node_node_combat_components["Combat comps<br/>reusable modules"]
end

subgraph group_group_assets["Assets"]
  node_node_audio_assets["Audio<br/>sound assets"]
  node_node_shader_assets["Shaders<br/>visual effects<br/>[outline.gdshader]"]
end

node_node_game_scene -->|"instantiates"| node_node_player_scene
node_node_game_scene -->|"spawns"| node_node_enemy_scene
node_node_game_scene -->|"contains"| node_node_drop_scene
node_node_game_scene -->|"loads"| node_node_level_scene
node_node_game_scene -->|"hosts"| node_node_ui_scene
node_node_game_script -->|"drives"| node_node_game_scene
node_node_autoloads -->|"coordinates"| node_node_game_scene
node_node_autoloads -->|"navigates"| node_node_menu_scene
node_node_player_script -->|"controls"| node_node_player_scene
node_node_enemy_script -->|"controls"| node_node_enemy_scene
node_node_gun_script -->|"controls"| node_node_weapon_scene
node_node_weapon_data -->|"configures"| node_node_gun_script
node_node_bullet_data -->|"configures"| node_node_weapon_scene
node_node_level_script -->|"controls"| node_node_level_scene
node_node_level_scene -->|"contains"| node_node_map_scene
node_node_combat_components -->|"composes"| node_node_player_scene
node_node_combat_components -->|"composes"| node_node_enemy_scene
node_node_combat_components -->|"composes"| node_node_drop_scene
node_node_ui_script -->|"controls"| node_node_ui_scene
node_node_menu_script -->|"controls"| node_node_menu_scene
node_node_weapon_scene -->|"plays"| node_node_audio_assets
node_node_ui_scene -->|"plays"| node_node_audio_assets
node_node_enemy_scene -->|"plays"| node_node_audio_assets
node_node_game_scene -->|"applies"| node_node_shader_assets
node_node_ui_scene -->|"applies"| node_node_shader_assets

click node_node_game_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/Game.tscn"
click node_node_player_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/Player/Player.tscn"
click node_node_enemy_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/enemies/Enemy.tscn"
click node_node_drop_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/drops/Dropped_Weapon.tscn"
click node_node_level_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/levels/Level_Kitchen.tscn"
click node_node_map_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/map/buyables/Door.tscn"
click node_node_ui_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/UI/Game_UI.tscn"
click node_node_menu_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/menus/Main_Menu.tscn"
click node_node_weapon_scene "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/weapons/bullets/Standard_Bullet.tscn"
click node_node_game_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/Game.gd"
click node_node_autoloads "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/autoload/World.gd"
click node_node_player_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/player/Player.gd"
click node_node_enemy_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/entities/enemy/Enemy.gd"
click node_node_gun_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/gun/Gun.gd"
click node_node_level_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/levels/Level.gd"
click node_node_ui_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/ui/Game_UI.gd"
click node_node_menu_script "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/menus/Main_Menu.gd"
click node_node_weapon_data "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/weapon/Base_Weapon.gd"
click node_node_bullet_data "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/bullet/Bullet_Res.gd"
click node_node_label_data "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/labels/Dropped_Weapons_Label.tres"
click node_node_combat_components "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/components/scenes/Health_Component.tscn"
click node_node_audio_assets "https://github.com/gamingxrelic/ratioactive/tree/main/top_down_shooter/assets/audio"
click node_node_shader_assets "https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/assets/shaders/outline.gdshader"

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_node_game_scene,node_node_player_scene,node_node_enemy_scene,node_node_drop_scene,node_node_level_scene,node_node_map_scene,node_node_ui_scene,node_node_menu_scene,node_node_weapon_scene toneBlue
class node_node_game_script,node_node_autoloads,node_node_player_script,node_node_enemy_script,node_node_gun_script,node_node_level_script,node_node_ui_script,node_node_menu_script toneAmber
class node_node_weapon_data,node_node_bullet_data,node_node_label_data toneMint
class node_node_combat_components toneRose
class node_node_audio_assets,node_node_shader_assets toneIndigo
```

## Components

### Scenes

Runtime scene composition and instanced game objects

- [Game](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/Game.tscn): composition root · Main gameplay scene that assembles the active run, player, UI, and level flow · `top_down_shooter/scenes/Game.tscn`
- [Player](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/Player/Player.tscn): entity scene · Player character scene for movement and interaction · `top_down_shooter/scenes/entities/Player/Player.tscn`
- [Enemy](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/enemies/Enemy.tscn): entity scene · Enemy actor scene for hostile behavior · `top_down_shooter/scenes/entities/enemies/Enemy.tscn`
- [Drops](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/entities/drops/Dropped_Weapon.tscn): loot scenes · Dropped weapon and powerup pickup scenes · `top_down_shooter/scenes/entities/drops/Dropped_Weapon.tscn`
- [Levels](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/levels/Level_Kitchen.tscn): level scenes · Playable level scenes and map layout entry points · `top_down_shooter/scenes/levels/Level_Kitchen.tscn`
- [Map objects](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/map/buyables/Door.tscn): map scenes · Interactive doors, pickups, and spawners placed in levels · `top_down_shooter/scenes/map/buyables/Door.tscn`
- [Game UI](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/UI/Game_UI.tscn): hud scene · In-game HUD and pause overlay scenes · `top_down_shooter/scenes/UI/Game_UI.tscn`
- [Menus](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/menus/Main_Menu.tscn): menu scenes · Main, options, levels, and death screen scenes · `top_down_shooter/scenes/menus/Main_Menu.tscn`
- [Weapons](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scenes/weapons/bullets/Standard_Bullet.tscn): combat scenes · Firing and projectile scenes for guns and throwables · `top_down_shooter/scenes/weapons/bullets/Standard_Bullet.tscn`

### Scripts

Behavior and scene logic

- [Game logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/Game.gd): scene controller · Script backing the main gameplay scene · `top_down_shooter/scripts/Game.gd`
- [Autoloads](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/autoload/World.gd): global state · Cross-scene singletons for world, menus, weapon state, and weapon catalog · `top_down_shooter/scripts/autoload/World.gd`
- [Player logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/player/Player.gd): entity logic · Player movement and interaction behavior · `top_down_shooter/scripts/player/Player.gd`
- [Enemy logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/entities/enemy/Enemy.gd): entity logic · Enemy AI and combat behavior · `top_down_shooter/scripts/entities/enemy/Enemy.gd`
- [Gun logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/gun/Gun.gd): combat logic · Weapon firing and projectile behavior · `top_down_shooter/scripts/gun/Gun.gd`
- [Level logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/levels/Level.gd): level logic · Shared level base and kitchen-specific triggers and transitions · `top_down_shooter/scripts/levels/Level.gd`
- [UI logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/ui/Game_UI.gd): ui logic · HUD and pause menu behavior · `top_down_shooter/scripts/ui/Game_UI.gd`
- [Menu logic](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/scripts/menus/Main_Menu.gd): menu logic · Main, options, levels, and death screen behavior · `top_down_shooter/scripts/menus/Main_Menu.gd`

### Resources

Data-driven tuning and shared definitions

- [Weapon data](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/weapon/Base_Weapon.gd): weapon resources · Data-driven weapon definitions and weapon catalog entries · `top_down_shooter/resources/weapon/Base_Weapon.gd`
- [Bullet data](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/bullet/Bullet_Res.gd): projectile resources · Bullet tuning resources used by projectile scenes · `top_down_shooter/resources/bullet/Bullet_Res.gd`
- [Label data](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/resources/labels/Dropped_Weapons_Label.tres): ui resources · Shared label/config resource for dropped weapon text · `top_down_shooter/resources/labels/Dropped_Weapons_Label.tres`

### Components

Reusable gameplay modules

- [Combat comps](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/components/scenes/Health_Component.tscn): reusable modules · Health, hurtbox, attackbox, contact damage, buyable, and text label components · `top_down_shooter/components/scenes/Health_Component.tscn`

### Assets

Art, audio, shaders, and UI media

- [Audio](https://github.com/gamingxrelic/ratioactive/tree/main/top_down_shooter/assets/audio): sound assets · Context-grouped audio for menus, player, enemies, weapons, and levels · `top_down_shooter/assets/audio`
- [Shaders](https://github.com/gamingxrelic/ratioactive/blob/main/top_down_shooter/assets/shaders/outline.gdshader): visual effects · Outline and other shader resources · `top_down_shooter/assets/shaders/outline.gdshader`

## Connections

- Game → Player: instantiates · Gameplay scene composes the player entity
- Game → Enemy: spawns · Gameplay scene brings enemies into the active run
- Game → Drops: contains · Gameplay scene manages drops and pickups
- Game → Levels: loads · Gameplay scene anchors the active level
- Game → Game UI: hosts · Gameplay scene overlays HUD and pause UI
- Game logic → Game: drives · Scene script controls gameplay composition and flow
- Autoloads → Game: coordinates · Global state coordinates gameplay across scenes
- Autoloads → Menus: navigates · Menu singleton logic routes between screens
- Player logic → Player: controls · Player behavior is attached to the player scene
- Enemy logic → Enemy: controls · Enemy behavior is attached to the enemy scene
- Gun logic → Weapons: controls · Weapon logic powers gun and projectile scenes
- Weapon data → Gun logic: configures · Weapon resources tune firing behavior and stats
- Bullet data → Weapons: configures · Projectile resources tune bullet instances
- Level logic → Levels: controls · Level scripts implement shared and level-specific behavior
- Levels → Map objects: contains · Levels place doors, spawners, and pickups
- Combat comps → Player: composes · Reusable modules build player interactions
- Combat comps → Enemy: composes · Reusable modules build enemy interactions
- Combat comps → Drops: composes · Reusable modules support pickups and interactables
- UI logic → Game UI: controls · HUD and pause behavior live in UI scripts
- Menu logic → Menus: controls · Menu behavior lives in menu scripts
- Weapons → Audio: plays · Weapons use context-specific sound effects
- Game UI → Audio: plays · UI uses menu and feedback sounds
- Enemy → Audio: plays · Enemy actions use enemy audio feedback
- Game → Shaders: applies · Gameplay visuals use outline and effect shaders
- Game UI → Shaders: applies · UI and visuals share shader-based theming
