# thehaudedai/strata architecture

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

- Interactive diagram: https://gitdiagram.com/thehaudedai/strata
- Repository: https://github.com/thehaudedai/strata

## Overview

1. **Project type and runtime**
   - This is a **Godot** game project (`project.godot`, `export_presets.cfg`), so the architecture is organized around **scenes** (`.tscn`) and **GDScript** (`.gd`) rather than traditional app layers.
   - The repository appears to be a small, self-contained game called **strata_descent**.

2. **Top-level scene structure**
   - The main runtime content is split into four scenes under `scene/`:
     - `main_menu.tscn` for entry/navigation
     - `world.tscn` for core gameplay
     - `resource.tscn` for in-world resource objects or pickups
     - `upgrade_shop.tscn` for progression/upgrades
   - This suggests the game flow moves from menu → world gameplay → upgrade/shop interaction.

3. **Core gameplay subsystem**
   - `scene/world.tscn` plus `script/world.gd` likely form the central gameplay loop.
   - This is probably where the player session, world state, spawning, and transitions to other scenes are coordinated.
   - In an architecture diagram, this should be treated as the **hub** of the game.

4. **Resource object subsystem**
   - `scene/resource.tscn` and `script/resource.gd` represent a discrete in-game entity type.
   - This looks like a reusable scene for collectible or interactable resources that the world spawns and the player consumes/collects.
   - It is likely a leaf node in the architecture: spawned by the world, read by progression systems, and not responsible for global state.

5. **Upgrade / progression subsystem**
   - `scene/upgrade_shop.tscn`, `script/upgrade_shop.gd`, and `script/upgrade_button.gd` define the upgrade UI and its interactive controls.
   - `script/UpgradeManager.gd` is the likely coordination point for upgrade state, unlocks, costs, or purchase effects.
   - This is the main **meta-progression boundary** separating session gameplay from persistent enhancement.

6. **Manager pattern and shared state**
   - `UpgradeManager.gd` is named like a centralized service rather than a scene-local script, so it probably holds shared progression state used by both gameplay and the shop.
   - If diagramming data flow, this is the most likely place where resource collection results are converted into upgrade availability or player power changes.

7. **UI and interaction flow**
   - `upgrade_button.gd` suggests the shop uses reusable button components rather than hardcoding every upgrade option.
   - That implies the upgrade shop scene is a UI composition layer that reads upgrade data from the manager and emits purchase actions back to it.
   - The UI is therefore a thin presentation layer around upgrade logic.

8. **Asset organization**
   - `assets/` contains fonts, sprites, UI art, and audio (`hmmspace.mp3`), indicating the project is asset-driven and likely relies on scene composition plus imported media.
   - `assets/UI/Upgrade` is specifically aligned with the upgrade shop, which reinforces that the shop is a distinct screen with dedicated visuals.
   - `assets/sprites/resources` likely contains art for the resource scene/entities.

9. **Scene composition boundary**
   - The architecture is strongly **scene-based**: each major gameplay area or UI screen is its own `.tscn`, with logic attached through scripts.
   - This means reusable behavior is probably shared through instancing scenes rather than inheritance-heavy code.
   - For a diagram, draw scene nodes as primary structural units and scripts as their behavior attachments.

10. **Likely runtime data flow**
   - Player progresses in `world.tscn`, interacts with `resource.tscn` objects, and accumulates some currency or material.
   - That progression feeds `UpgradeManager.gd`, which in turn drives `upgrade_shop.tscn` and its `upgrade_button.gd` controls.
   - Upgrades likely feed back into world gameplay, closing the loop between session play and meta-progression.

11. **Entry points and navigation**
   - `main_menu.tscn` is the front door to the game and probably routes into the world scene or other modes.
   - Scene switching is likely the primary navigation mechanism rather than an embedded state machine in a single scene.

12. **Packaging and deployment**
   - `export_presets.cfg` indicates the project is configured for Godot exports, so the repo is intended to be built into standalone game binaries.
   - There are no signs of backend services, databases, or networked infrastructure in the tree, so the architecture is local/client-side only.

Main entry points: [`scene/world.tscn`](https://github.com/thehaudedai/strata/blob/main/scene/world.tscn) (World), [`scene/upgrade_shop.tscn`](https://github.com/thehaudedai/strata/blob/main/scene/upgrade_shop.tscn) (Upgrade Shop), [`scene/resource.tscn`](https://github.com/thehaudedai/strata/blob/main/scene/resource.tscn) (Resource), [`script/UpgradeManager.gd`](https://github.com/thehaudedai/strata/blob/main/script/UpgradeManager.gd) (Upgrade Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenes["Scenes"]
  node_main_menu["Main Menu<br/>scene<br/>[main_menu.tscn]"]
  node_world_scene["World<br/>scene<br/>[world.tscn]"]
  node_resource_scene["Resource<br/>scene<br/>[resource.tscn]"]
  node_upgrade_shop_scene["Upgrade Shop<br/>scene<br/>[upgrade_shop.tscn]"]
end

subgraph group_scripts["Scripts"]
  node_world_script["World Logic<br/>gdscript<br/>[world.gd]"]
  node_resource_script["Resource Logic<br/>gdscript<br/>[resource.gd]"]
  node_upgrade_shop_script["Shop Logic<br/>gdscript<br/>[upgrade_shop.gd]"]
  node_upgrade_button_script["Upgrade Button<br/>gdscript<br/>[upgrade_button.gd]"]
  node_upgrade_manager["Upgrade Manager<br/>gdscript service<br/>[UpgradeManager.gd]"]
end

subgraph group_assets["Assets"]
  node_upgrade_ui_assets[("Upgrade UI<br/>asset pack")]
  node_resource_assets[("Resource Art<br/>asset pack")]
  node_audio_asset(("Soundtrack<br/>audio asset<br/>[hmmspace.mp3]"))
end

node_main_menu -->|"start game"| node_world_scene
node_world_scene -->|"drives"| node_world_script
node_world_scene -->|"spawns"| node_resource_scene
node_world_scene -->|"opens shop"| node_upgrade_shop_scene
node_world_scene -.->|"uses"| node_audio_asset
node_resource_scene -->|"drives"| node_resource_script
node_resource_scene -.->|"renders with"| node_resource_assets
node_upgrade_shop_scene -->|"drives"| node_upgrade_shop_script
node_upgrade_shop_scene -->|"composes"| node_upgrade_button_script
node_upgrade_shop_scene -.->|"renders with"| node_upgrade_ui_assets
node_upgrade_shop_script -->|"reads/writes"| node_upgrade_manager
node_upgrade_button_script -->|"purchases"| node_upgrade_manager
node_resource_script -->|"feeds"| node_world_script
node_upgrade_manager -->|"modifies"| node_world_script

click node_main_menu "https://github.com/thehaudedai/strata/blob/main/scene/main_menu.tscn"
click node_world_scene "https://github.com/thehaudedai/strata/blob/main/scene/world.tscn"
click node_resource_scene "https://github.com/thehaudedai/strata/blob/main/scene/resource.tscn"
click node_upgrade_shop_scene "https://github.com/thehaudedai/strata/blob/main/scene/upgrade_shop.tscn"
click node_world_script "https://github.com/thehaudedai/strata/blob/main/script/world.gd"
click node_resource_script "https://github.com/thehaudedai/strata/blob/main/script/resource.gd"
click node_upgrade_shop_script "https://github.com/thehaudedai/strata/blob/main/script/upgrade_shop.gd"
click node_upgrade_button_script "https://github.com/thehaudedai/strata/blob/main/script/upgrade_button.gd"
click node_upgrade_manager "https://github.com/thehaudedai/strata/blob/main/script/UpgradeManager.gd"
click node_upgrade_ui_assets "https://github.com/thehaudedai/strata/tree/main/assets/UI/Upgrade"
click node_resource_assets "https://github.com/thehaudedai/strata/tree/main/assets/sprites/resources"
click node_audio_asset "https://github.com/thehaudedai/strata/blob/main/assets/hmmspace.mp3"

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,node_world_scene,node_resource_scene,node_upgrade_shop_scene toneBlue
class node_world_script,node_resource_script,node_upgrade_shop_script,node_upgrade_button_script,node_upgrade_manager toneAmber
class node_upgrade_ui_assets,node_resource_assets,node_audio_asset toneMint
```

## Components

### Scenes

Scene-based runtime entry points and gameplay screens

- [Main Menu](https://github.com/thehaudedai/strata/blob/main/scene/main_menu.tscn): scene · Entry screen and navigation hub · `scene/main_menu.tscn`
- [World](https://github.com/thehaudedai/strata/blob/main/scene/world.tscn): scene · Core gameplay scene · `scene/world.tscn`
- [Resource](https://github.com/thehaudedai/strata/blob/main/scene/resource.tscn): scene · Reusable in-world collectible or interactable · `scene/resource.tscn`
- [Upgrade Shop](https://github.com/thehaudedai/strata/blob/main/scene/upgrade_shop.tscn): scene · Meta-progression and upgrade screen · `scene/upgrade_shop.tscn`

### Scripts

Behavior attached to scenes and shared logic

- [World Logic](https://github.com/thehaudedai/strata/blob/main/script/world.gd): gdscript · Coordinates gameplay flow and session state · `script/world.gd`
- [Resource Logic](https://github.com/thehaudedai/strata/blob/main/script/resource.gd): gdscript · Behavior for resource entities · `script/resource.gd`
- [Shop Logic](https://github.com/thehaudedai/strata/blob/main/script/upgrade_shop.gd): gdscript · Controls upgrade shop behavior · `script/upgrade_shop.gd`
- [Upgrade Button](https://github.com/thehaudedai/strata/blob/main/script/upgrade_button.gd): gdscript · Reusable upgrade UI interaction · `script/upgrade_button.gd`
- [Upgrade Manager](https://github.com/thehaudedai/strata/blob/main/script/UpgradeManager.gd): gdscript service · Shared upgrade state and purchase coordination · `script/UpgradeManager.gd`

### Assets

Imported art, audio, and UI resources

- [Upgrade UI](https://github.com/thehaudedai/strata/tree/main/assets/UI/Upgrade): asset pack · Visual assets for the upgrade shop · `assets/UI/Upgrade`
- [Resource Art](https://github.com/thehaudedai/strata/tree/main/assets/sprites/resources): asset pack · Sprites for resource entities · `assets/sprites/resources`
- [Soundtrack](https://github.com/thehaudedai/strata/blob/main/assets/hmmspace.mp3): audio asset · Background audio used by the game · `assets/hmmspace.mp3`

## Connections

- Main Menu → World: start game · Launches into core gameplay
- World → World Logic: drives · Scene is controlled by world logic
- World → Resource: spawns · Instantiates resource entities into the world
- World → Upgrade Shop: opens shop · Transitions to progression screen
- World → Soundtrack: uses · Provides game audio
- Resource → Resource Logic: drives · Scene behavior comes from resource script
- Resource → Resource Art: renders with · Uses resource sprite art
- Upgrade Shop → Shop Logic: drives · Scene behavior comes from shop script
- Upgrade Shop → Upgrade Button: composes · Builds shop UI from reusable buttons
- Upgrade Shop → Upgrade UI: renders with · Uses dedicated upgrade UI art
- Shop Logic → Upgrade Manager: reads/writes · Requests and updates upgrade state
- Upgrade Button → Upgrade Manager: purchases · Emits upgrade actions to shared manager
- Resource Logic → World Logic: feeds · Collected resources inform world progression
- Upgrade Manager → World Logic: modifies · Upgrade effects feed back into gameplay
