# tonyjdev/indiespainjam23 architecture

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

- Interactive diagram: https://gitdiagram.com/tonyjdev/indiespainjam23
- Repository: https://github.com/tonyjdev/indiespainjam23

## Overview

##### Project Type and Purpose
- This is a Unity-based 2D game prototype for the “IndieSpainJam23” game jam.
- It uses the Universal Render Pipeline (URP), the new Input System, and various asset packs (animations, audio, tiles, prefabs) under “Assets/Undead Survivor.”
- The core gameplay logic lives in “Assets/Scripts/Game,” e.g. PlayerMovement.cs, and is tied together in “Assets/Scenes/Game.unity.”

##### File-Structure Analysis
- Top-level folders:
- Assets – all game code, scenes, input actions, graphics, audio, templates.
- Packages – Unity package manifests for dependencies.
- ProjectSettings – engine configuration (Rendering, Physics2D, Audio, Input, URP settings).
- Docs – any plain-text documentation (tasks.md).
- Inside Assets:
- Input – InputAction asset for mapping user controls.
- Scenes – contains Game.unity (the main scene).
- Scripts/Game – MonoBehaviour scripts for Player, future enemies, managers.
- Settings – custom URP Scene templates and pipeline assets.
- Sprites/Undead Survivor – imported sprite sheets, animation controllers, audio clips, demo scene.
- Key engine/config files: Packages/manifest.json, ProjectSettings/URPProjectSettings.asset, InputManager.asset, Physics2DSettings.asset.

##### README Insights
- README.md only names the jam; no architecture details.
- We infer a single-scene game, using Unity’s core subsystems with custom game logic layered on top.

a. Main Components
‑ Core Loop (Update, FixedUpdate)
‑ Rendering Subsystem (URP)
‑ Physics2D Engine
‑ AudioManager
‑ Input System
2. Game-Specific Layer:
‑ Scene Manager (loads/unloads Game.unity, Demo.unity)
‑ Game Controllers (PlayerMovement, enemy controllers)
‑ UI Layer (if any HUD, menus)
3. Asset Pipeline:
‑ Sprites & Animations (Animator Controllers, .anim files)
‑ Audio Clips (WAVs for BGM, effects)
‑ Tile Assets / Prefabs (Tiles/RanTile.asset, Pal.prefab)
4. Configuration & Build:
‑ Packages (manifest.json)
‑ ProjectSettings (URP settings, Input mappings, Quality settings)

b. Relationships and Interactions
- User Input flows into the Input System → triggers PlayerMovement script → updates Transform & Rigidbody2D → Physics engine resolves collisions.
- PlayerMovement changes Animator state → URP renders sprites & animations.
- Game scripts call AudioManager to play SFX/BGM.
- Scene Manager initializes game objects & UI on scene load.
- Asset Pipeline feeds sprites/audio into engine at runtime.
- ProjectSettings and Packages define engine behavior & build dependencies.

c. Architectural Patterns / Principles
- Layered architecture:
- Engine core at bottom
- Shared subsystems (Rendering, Physics, Audio, Input)
- Game logic scripts on top
- Separation of concerns:
- Input assets separate from code
- Rendering templates (URP) separate from game logic
- Assets (animations, audio) decoupled from scripts
- Data-driven assets: use ScriptableObjects / .asset files for templates.

d. Key Technologies / Frameworks
- Unity 2021+ with Universal Render Pipeline
- Unity Input System (.inputactions)
- 2D Physics (Rigidbody2D, Collider2D)
- Animator Controllers & Override Controllers
- Scriptable pipeline assets (Lit2DSceneTemplate, URP2DSceneTemplate)

##### Final Advice
- Do not over-break: group all ProjectSettings under one “Configuration” node.
- Keep it simple, but include each major folder or system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Unity Engine Layer
    subgraph "Unity Engine"
        direction TB
        CoreLoop["Core Loop (Update, FixedUpdate)"]:::engine
        InputSys["Input System"]:::engine
        Rendering["Rendering Subsystem (URP Renderer)"]:::engine
        Physics2D["Physics2D Engine"]:::engine
        AudioSys["Audio Manager"]:::engine
    end

    %% Game Logic Layer
    subgraph "Game Logic"
        direction TB
        SceneMgr["Scene Manager"]:::logic
        PlayerCtrl["PlayerMovement.cs"]:::logic
        EnemyCtrl["Future Enemy Controllers"]:::logic
        UILayer["UI Layer (HUD/Menus)"]:::logic

        subgraph "Scenes"
            GameScene["Game.unity"]:::asset
            DemoScene["Demo.unity"]:::asset
        end
    end

    %% Asset Pipeline Layer
    subgraph "Asset Pipeline"
        direction TB
        Sprites["Sprites"]:::asset
        Anims["Animations"]:::asset
        AudioClips["Audio Clips"]:::asset
        Prefabs["Tile Assets & Prefabs"]:::asset
    end

    %% Configuration & Build Layer
    subgraph "Configuration & Build"
        direction TB
        Packages["Packages\n(manifest.json & packages-lock.json)"]:::config
        ProjectSet["ProjectSettings"]:::config
        URPGlobal["UniversalRP Global Settings"]:::config
    end

    %% Data Flows
    UserInput([User]):::external -->|"presses keys"| InputSys
    InputSys -->|"triggers"| PlayerCtrl
    PlayerCtrl -->|"moves Rigidbody2D"| Physics2D
    Physics2D -->|"updates Transform"| CoreLoop
    PlayerCtrl -->|"sets Animator state"| Anims
    Anims -->|"render frames"| Rendering
    PlayerCtrl -->|"plays SFX/BGM"| AudioSys
    AudioSys -->|"outputs audio"| AudioClips

    SceneMgr -->|"loads scene"| GameScene
    SceneMgr -->|"loads scene"| DemoScene

    Packages -.->|"defines deps"| CoreLoop
    Packages -.-> Rendering
    ProjectSet -.-> Physics2D
    ProjectSet -.-> AudioSys
    URPGlobal -.-> Rendering

    %% Click Events
    click InputSys "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Input/Input.inputactions"
    click Rendering "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Settings/UniversalRP.asset"
    click URPGlobal "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/UniversalRenderPipelineGlobalSettings.asset"
    click ProjectSet "https://github.com/tonyjdev/indiespainjam23/blob/main/ProjectSettings/Physics2DSettings.asset"
    click AudioSys "https://github.com/tonyjdev/indiespainjam23/blob/main/ProjectSettings/AudioManager.asset"
    click GameScene "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Scenes/Game.unity"
    click DemoScene "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Undead Survivor/Demo/Demo.unity"
    click PlayerCtrl "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Scripts/Game/Player/PlayerMovement.cs"
    click Anims "https://github.com/tonyjdev/indiespainjam23/tree/main/Assets/Undead Survivor/Animations"
    click Sprites "https://github.com/tonyjdev/indiespainjam23/tree/main/Assets/Undead Survivor/Sprites"
    click AudioClips "https://github.com/tonyjdev/indiespainjam23/tree/main/Assets/Undead Survivor/Audio"
    click Prefabs "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Undead Survivor/Tiles/Pal.prefab"
    click Prefabs "https://github.com/tonyjdev/indiespainjam23/blob/main/Assets/Undead Survivor/Tiles/RanTile.asset"
    click Packages "https://github.com/tonyjdev/indiespainjam23/blob/main/Packages/manifest.json"
    click Packages "https://github.com/tonyjdev/indiespainjam23/blob/main/Packages/packages-lock.json"

    %% Styles
    classDef engine fill:#cfe2f3,stroke:#6fa8dc,color:#073763;
    classDef logic fill:#d9ead3,stroke:#6aa84f,color:#274e13;
    classDef asset fill:#ffe599,stroke:#f1c232,color:#783f04;
    classDef config fill:#e7e6e6,stroke:#a6a6a6,color:#3c3c3c;
    classDef external fill:#f4cccc,stroke:#e06666,color:#660000;
```
