# rrrrbit/blitz_ architecture

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

- Interactive diagram: https://gitdiagram.com/rrrrbit/blitz_
- Repository: https://github.com/rrrrbit/blitz_

## Overview

1. **Project shape**
   - This is a **Unity 2D endless runner** with a strong separation between **scene flow, gameplay runtime, world entities, and UI/menu presentation**.
   - The repo is content-heavy: most of the architecture is expressed through **prefabs, ScriptableObject-like assets, shader graphs, and scene setup**, with code acting as orchestration.

2. **Scene boundary**
   - There are two main runtime scenes: **`menu_main.unity`** and **`game.unity`**.
   - The menu scene owns title/menu interactions and transitions into the game scene; the game scene contains the core runner loop, world generation, player control, HUD, and effects.

3. **Core game runtime**
   - The central gameplay layer lives in the `Assets/Scripts/` root with classes named **`GAME`**, **`GAME_manager`**, **`GAME_globalData`**, **`GAME_objManager`**, **`GLOBAL`**, **`CAMERA`**, **`GLOW`**, and **`GAME_vfx`**.
   - This suggests a **manager-driven architecture**: a global state layer, a gameplay state/controller, an object manager for spawned entities, a camera controller, and a VFX coordination layer.

4. **Player subsystem**
   - Player behavior is split into **movement**, **animation**, and **attack/action** concerns:
     - `PLAYER_baseMvt.cs`
     - `PLAYER_anim.cs`
     - `PLAYER_slash.cs`
     - `Trajectory.cs`
   - This indicates the player is not a monolith; input likely flows into movement/attack logic, which then triggers animation and slash trajectory visuals.

5. **Input layer**
   - `InputSystem_Actions.inputactions` and the generated `InputSystem_Actions.cs` show the project uses Unity’s **new Input System**.
   - Input is therefore a dedicated subsystem rather than ad hoc polling, which matters for diagramming because it sits between player control and gameplay state.

6. **World object model**
   - The `Assets/Scripts/World/` folder contains the entity layer:
     - base types: `GAME_obj.cs`, `GAME_objType.cs`, `GAME_relativeParticles.cs`
     - interactable hierarchy: `Interactable.cs`, `Destructible.cs`, `OBJ_node.cs`, `OBJ_proxy.cs`, `OBJ_relay.cs`, `OBJ_burst.cs`, `OBJ_window.cs`, `OBJ_empty.cs`
   - The repo also includes corresponding content assets under `Assets/Prefabs/entries/` and prefabs like `node.prefab`, `relay.prefab`, `proxy.prefab`, `burst.prefab`, `window.prefab`.
   - This suggests a **template-driven entity system** where gameplay objects are instantiated from predefined archetypes and then handled through shared interaction/destruction logic.

7. **World generation and background**
   - Background and stage ambience are handled separately from interactable objects:
     - `BG_spawns.cs`
     - `World/bg objs/*` such as `BG_grid`, `BG_lattice`, `BG_stripe`, `BG_window`
     - matching prefabs in `Assets/Prefabs/bg Elements/`
   - That separation implies the endless-runner environment is composed of **spawned scenic layers and gameplay-relevant obstacles/entities**, likely with independent spawning rules.

8. **UI and menu system**
   - Menu/HUD code lives in `Assets/Scripts/MENUandUI/`:
     - `MENU_main.cs`, `MENU_death.cs`, `MENU_info.cs`
     - `HUD.cs`
     - UI effects: `UI_fadeOut`, `UI_flickerImage`, `UI_flickerTextIn`, `UI_textBtn`, `UI_plugButton`, `Flicker`
   - The UI is therefore a distinct presentation layer with its own animation/effect scripts, rather than being embedded in gameplay logic.

9. **Visual style and rendering**
   - The project uses **URP 2D** and is visually shader-driven:
     - URP settings assets and 2D renderer assets
     - Shader Graph assets like `glow.shadergraph`, `glitch.shadergraph`, `bgGrid.shadergraph`, `lattice.shadergraph`, `squashShear.shadergraph`
     - materials like `glow.mat`, `glitch.mat`
   - Visual effects are not just post-processing; they are part of the gameplay identity through glowing/glitching UI, stylized background elements, and object-specific materials.

10. **Animation and particle effects**
   - There are dedicated animation assets (`slash.anim`, animator controller) and particle prefabs (`nodeParticle`, `relayParticle`, `burstParticle`).
   - This indicates a layered presentation pipeline: **game events trigger animation and VFX**, which are managed separately from the underlying gameplay state.

11. **Data/configuration assets**
   - The repo includes build profiles (`itch.asset`, `windows.asset`), a physics material (`playerpmat.physicsMaterial2D`), a volume profile, render pipeline assets, fonts, TMP resources, and scene templates.
   - These are important to diagram as the **configuration/infrastructure layer** supporting the runtime, especially since the project depends heavily on author-time Unity assets.

12. **Likely runtime flow**
   - At a high level: **menu scene → game scene → input-driven player actions → manager/world spawning logic → interactable object resolution → VFX/UI feedback → death/menu loop**.
   - The main architectural boundary is between **state/control systems** (`GAME_*`, `GLOBAL`, player controllers) and **content instances** (prefabs, object entries, background elements, UI prefabs).

13. **What to emphasize in an architecture diagram**
   - Draw separate boxes for **Menu/UI**, **Game Runtime**, **Player Controller**, **World/Object System**, **Background Spawner**, and **Rendering/VFX**.
   - Show **Unity scene assets** as the top-level composition units and **prefabs/ScriptableObject-like entries** as the content definitions feeding the runtime.

Main entry points: [`Assets/Scripts/GAME_manager.cs`](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_manager.cs) (Manager), [`Assets/Scripts/GAME.cs`](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME.cs) (GAME), [`Assets/Scenes/game.unity`](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scenes/game.unity) (Game scene), [`Assets/Scripts/GAME_objManager.cs`](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_objManager.cs) (Object manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenes["Scenes"]
  node_scene_menu["Menu scene<br/>Unity scene<br/>[menu_main.unity]"]
  node_scene_game["Game scene<br/>Unity scene<br/>[game.unity]"]
end

subgraph group_runtime["Gameplay Runtime"]
  node_game_core["GAME<br/>[GAME.cs]"]
  node_game_manager["Manager<br/>[GAME_manager.cs]"]
  node_global_data["Global data<br/>shared state<br/>[GAME_globalData.cs]"]
  node_obj_manager["Object manager<br/>spawn manager<br/>[GAME_objManager.cs]"]
  node_global["GLOBAL<br/>shared control<br/>[GLOBAL.cs]"]
  node_input_actions["Input actions<br/>input map"]
  node_input_code["Input code<br/>input wrapper"]
end

subgraph group_player["Player"]
  node_player_move["Movement<br/>player control<br/>[PLAYER_baseMvt.cs]"]
  node_player_anim["Animation<br/>player presentation<br/>[PLAYER_anim.cs]"]
  node_player_slash["Slash<br/>player action<br/>[PLAYER_slash.cs]"]
  node_trajectory["Trajectory<br/>visual guide<br/>[Trajectory.cs]"]
end

subgraph group_world["World"]
  node_bg_spawns["BG spawns<br/>background spawner<br/>[BG_spawns.cs]"]
  node_world_base["World base<br/>entity base<br/>[GAME_obj.cs]"]
  node_interactable["Interactable<br/>entity base<br/>[Interactable.cs]"]
  node_destructible["Destructible<br/>entity behavior<br/>[Destructible.cs]"]
  node_obj_types["Object variants<br/>entity archetypes<br/>[OBJ_node.cs]"]
end

subgraph group_presentation["Presentation"]
  node_menu_main["Main menu<br/>menu controller<br/>[MENU_main.cs]"]
  node_menu_death["Death menu<br/>menu controller<br/>[MENU_death.cs]"]
  node_hud["HUD<br/>ui controller<br/>[HUD.cs]"]
  node_vfx["VFX<br/>effects coordinator<br/>[GAME_vfx.cs]"]
  node_camera["Camera<br/>[CAMERA.cs]"]
  node_glow["Glow<br/>render effect<br/>[GLOW.cs]"]
  node_shader_assets["Shaders<br/>render assets<br/>[glow.shadergraph]"]
end

node_scene_menu -->|"contains"| node_menu_main
node_scene_menu -->|"transitions to"| node_scene_game
node_scene_game -->|"contains"| node_game_core
node_scene_game -->|"contains"| node_hud
node_menu_main -->|"uses"| node_input_actions
node_input_actions -->|"generates"| node_input_code
node_input_code -->|"feeds"| node_player_move
node_input_code -->|"feeds"| node_player_slash
node_game_core -->|"coordinates"| node_game_manager
node_game_manager -->|"reads/writes"| node_global_data
node_game_manager -->|"spawns"| node_obj_manager
node_game_manager -->|"drives"| node_camera
node_game_manager -->|"triggers"| node_vfx
node_game_manager -->|"relies on"| node_global
node_player_move -->|"updates"| node_player_anim
node_player_slash -->|"shows"| node_trajectory
node_player_slash -->|"triggers"| node_vfx
node_obj_manager -->|"instantiates"| node_world_base
node_world_base -->|"extends"| node_interactable
node_interactable -->|"specializes"| node_destructible
node_destructible -->|"implements"| node_obj_types
node_obj_manager -->|"spawns"| node_obj_types
node_bg_spawns -.->|"separates from"| node_obj_types
node_bg_spawns -->|"renders with"| node_shader_assets
node_hud -->|"uses"| node_shader_assets
node_menu_death -.->|"shares layer"| node_hud
node_game_core -->|"emits"| node_vfx
node_game_core -->|"orchestrates"| node_camera
node_game_core -->|"advances"| node_bg_spawns

click node_scene_menu "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scenes/menu_main.unity"
click node_scene_game "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scenes/game.unity"
click node_menu_main "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/MENU_main.cs"
click node_menu_death "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/MENU_death.cs"
click node_hud "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/HUD.cs"
click node_game_core "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME.cs"
click node_game_manager "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_manager.cs"
click node_global_data "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_globalData.cs"
click node_obj_manager "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_objManager.cs"
click node_global "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GLOBAL.cs"
click node_player_move "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_baseMvt.cs"
click node_player_anim "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_anim.cs"
click node_player_slash "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_slash.cs"
click node_trajectory "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/Trajectory.cs"
click node_input_actions "https://github.com/rrrrbit/blitz_/blob/main/Assets/InputSystem_Actions.inputactions"
click node_input_code "https://github.com/rrrrbit/blitz_/blob/main/Assets/InputSystem_Actions.cs"
click node_bg_spawns "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/BG_spawns.cs"
click node_world_base "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/GAME_obj.cs"
click node_interactable "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Interactable.cs"
click node_destructible "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Destructibles/Destructible.cs"
click node_obj_types "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Destructibles/OBJ_node.cs"
click node_vfx "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_vfx.cs"
click node_camera "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/CAMERA.cs"
click node_glow "https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GLOW.cs"
click node_shader_assets "https://github.com/rrrrbit/blitz_/blob/main/Assets/Shaders/glow.shadergraph"

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_scene_menu,node_scene_game toneBlue
class node_game_core,node_game_manager,node_global_data,node_obj_manager,node_global,node_input_actions,node_input_code toneAmber
class node_player_move,node_player_anim,node_player_slash,node_trajectory toneMint
class node_bg_spawns,node_world_base,node_interactable,node_destructible,node_obj_types toneRose
class node_menu_main,node_menu_death,node_hud,node_vfx,node_camera,node_glow,node_shader_assets toneIndigo
```

## Components

### Scenes

Runtime entry scenes and flow boundaries

- [Menu scene](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scenes/menu_main.unity): Unity scene · Main menu runtime scene · `Assets/Scenes/menu_main.unity`
- [Game scene](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scenes/game.unity): Unity scene · Core gameplay runtime scene · `Assets/Scenes/game.unity`

### Gameplay Runtime

Core managers, state, and execution flow

- [GAME](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME.cs): game state · Primary gameplay state and flow controller · `Assets/Scripts/GAME.cs`
- [Manager](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_manager.cs): game manager · Coordinates gameplay systems · `Assets/Scripts/GAME_manager.cs`
- [Global data](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_globalData.cs): shared state · Cross-system runtime data and flags · `Assets/Scripts/GAME_globalData.cs`
- [Object manager](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_objManager.cs): spawn manager · Controls world object creation and lifecycle · `Assets/Scripts/GAME_objManager.cs`
- [GLOBAL](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GLOBAL.cs): shared control · Global utility or state bridge · `Assets/Scripts/GLOBAL.cs`
- [Input actions](https://github.com/rrrrbit/blitz_/blob/main/Assets/InputSystem_Actions.inputactions): input map · Unity Input System action definitions · `Assets/InputSystem_Actions.inputactions`
- [Input code](https://github.com/rrrrbit/blitz_/blob/main/Assets/InputSystem_Actions.cs): input wrapper · Generated input bindings used by gameplay code · `Assets/InputSystem_Actions.cs`

### Player

Input-driven player control and actions

- [Movement](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_baseMvt.cs): player control · Player locomotion and position control · `Assets/Scripts/PLAYER_baseMvt.cs`
- [Animation](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_anim.cs): player presentation · Player animation state and transitions · `Assets/Scripts/PLAYER_anim.cs`
- [Slash](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/PLAYER_slash.cs): player action · Attack handling and slash trigger · `Assets/Scripts/PLAYER_slash.cs`
- [Trajectory](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/Trajectory.cs): visual guide · Slash path or motion visualization · `Assets/Scripts/Trajectory.cs`

### World

Spawned entities, interactions, and background layers

- [BG spawns](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/BG_spawns.cs): background spawner · Background generation and ambience spawning · `Assets/Scripts/World/BG_spawns.cs`
- [World base](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/GAME_obj.cs): entity base · Shared world object types and particle support · `Assets/Scripts/World/GAME_obj.cs`
- [Interactable](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Interactable.cs): entity base · Base interaction behavior for world objects · `Assets/Scripts/World/Interactables/Interactable.cs`
- [Destructible](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Destructibles/Destructible.cs): entity behavior · Breakable object behavior and resolution · `Assets/Scripts/World/Interactables/Destructibles/Destructible.cs`
- [Object variants](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/World/Interactables/Destructibles/OBJ_node.cs): entity archetypes · Node, relay, proxy, burst, window, and empty variants · `Assets/Scripts/World/Interactables/Destructibles/OBJ_node.cs`

### Presentation

Menus, HUD, camera, effects, and rendering

- [Main menu](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/MENU_main.cs): menu controller · Title screen and start flow · `Assets/Scripts/MENUandUI/MENU_main.cs`
- [Death menu](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/MENU_death.cs): menu controller · Game-over and restart flow · `Assets/Scripts/MENUandUI/MENU_death.cs`
- [HUD](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/MENUandUI/HUD.cs): ui controller · In-game heads-up display · `Assets/Scripts/MENUandUI/HUD.cs`
- [VFX](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GAME_vfx.cs): effects coordinator · Gameplay-driven visual effects management · `Assets/Scripts/GAME_vfx.cs`
- [Camera](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/CAMERA.cs): camera controller · Runtime camera behavior and framing · `Assets/Scripts/CAMERA.cs`
- [Glow](https://github.com/rrrrbit/blitz_/blob/main/Assets/Scripts/GLOW.cs): render effect · Glow and screen-effect coordination · `Assets/Scripts/GLOW.cs`
- [Shaders](https://github.com/rrrrbit/blitz_/blob/main/Assets/Shaders/glow.shadergraph): render assets · URP 2D shader graphs and materials for glow, glitch, and background styling · `Assets/Shaders/glow.shadergraph`

## Connections

- Menu scene → Main menu: contains · Menu scene hosts the main menu controller
- Menu scene → Game scene: transitions to · Menu flow leads into the gameplay scene
- Game scene → GAME: contains · Game scene hosts the core gameplay state
- Game scene → HUD: contains · Game scene includes the in-game HUD
- Main menu → Input actions: uses · Menu interactions are driven by the Input System
- Input actions → Input code: generates · Input action asset produces wrapper code
- Input code → Movement: feeds · Player movement consumes input bindings
- Input code → Slash: feeds · Slash and action input reach the player action layer
- GAME → Manager: coordinates · Primary game state delegates to manager logic
- Manager → Global data: reads/writes · Manager uses shared gameplay state
- Manager → Object manager: spawns · Manager drives object lifecycle and instantiation
- Manager → Camera: drives · Gameplay state influences camera behavior
- Manager → VFX: triggers · Gameplay events emit visual effects
- Manager → GLOBAL: relies on · Manager uses the shared global control layer
- Movement → Animation: updates · Movement state selects animation transitions
- Slash → Trajectory: shows · Slash action drives trajectory visualization
- Slash → VFX: triggers · Attack action emits effects
- Object manager → World base: instantiates · Object manager creates world entities
- World base → Interactable: extends · Interactable layer defines shared world behavior
- Interactable → Destructible: specializes · Destructible objects add breakage behavior
- Destructible → Object variants: implements · Concrete object variants use destructible behavior
- Object manager → Object variants: spawns · Manager instantiates object archetypes and prefabs
- BG spawns → Object variants: separates from · Background generation is distinct from interactable gameplay objects
- BG spawns → Shaders: renders with · Background elements rely on shader and material styling
- HUD → Shaders: uses · UI presentation uses stylized rendering assets
- Death menu → HUD: shares layer · Death flow belongs to the UI presentation stack
- GAME → VFX: emits · Core gameplay events produce VFX feedback
- GAME → Camera: orchestrates · Core gameplay adjusts camera framing
- GAME → BG spawns: advances · Gameplay progression drives background spawning
