# adenc123/mtstringmore architecture

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

- Interactive diagram: https://gitdiagram.com/adenc123/mtstringmore
- Repository: https://github.com/adenc123/mtstringmore

## Overview

##### Main Components
a. Unity Engine Core – At the heart of the project, including the Unity Editor, physics engine, rendering pipeline, and project settings.
b. Scenes & Level Structure – Represented by the “Assets/Scenes” directory. Each scene (e.g., DemoLevel1, MainMenu, various cutscenes) illustrates a different gameplay area or state.
c. Game Assets and Art Pipeline – This includes directories for Sprites, Animations, Materials, Audio, and Prefabs. These are the visual, audio, and interactive elements loaded in various scenes.
d. Game Logic and Scripts – Found in “Assets/Scripts”. This folder contains gameplay logic such as controllers for characters (Knitby, Marshmallow), environmental interactions (BouncyPlatform, CollapsingPlatform), and utility systems (DevConsole commands, Yarn dialogue integration).
e. Dialogue and Narrative System – Housed in “Assets/Story” and “Assets/Scripts/Yarn”. This area integrates YarnSpinner for dialogue scripting and narrative flow.
f. Editor and Custom Tools – Located in “Assets/Editor” and custom tools (e.g., for the DevConsole) that help in level design, debugging, and asset configuration.
g. Configuration and Build Tools – Seen in the root and the “ProjectSettings” as well as “Packages” directories. These define project-wide settings, dependencies (like TextMesh Pro and YarnSpinner), and build profiles.

##### Relationships and Interactions
- Scenes load and instantiate Prefabs and GameObjects, which in turn are populated with components drawn from Scripts, Animations, and Audio assets.
- The GameManager (part of the Scripts) coordinates the overall game state and manages scene transitions.
- Player controllers and character animations (e.g., KnitbyAnimator, PlayerController) interact with environmental elements (platforms, checkpoints, moving objects) as defined in Prefabs and Scripts.
- The Dialogue system (via Yarn scripts) connects narrative flow with in-game events, while the DevConsole (with its suite of commands) allows runtime tweaking and debugging.
- Third-party integrations (TextMesh Pro for UI, YarnSpinner for dialogue processing) are part of the project settings and libraries, interacting directly with game scripts.

##### Architectural Patterns and Design Principles
- Component-Based Design – Each prefab is built of reusable components (scripts, animations, physics materials) which encapsulate specific functionalities.
- Separation of Concerns – Visual assets (sprites, audio, animations) are managed independently from gameplay logic (controllers, managers, Yarn dialogue).
- Event-Driven Interactions – Many game elements interact using Unity’s event system (e.g., triggers, input events, and scene transitions).
- Extendability – The DevConsole and Yarn scripts indicate thoughtful design for debugging and narrative extension.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "Core Layer"
        A["Unity Engine & Core Systems"]:::core
        G["Configuration & Dependencies"]:::config
    end

    %% Game Layer
    subgraph "Game Layer"
        B["Scenes & Level Management"]:::scenes

        subgraph "Game Assets & Art Pipeline"
            subgraph "Visual Assets"
                CA["Sprites"]:::assets
                CB["Animation"]:::assets
                CC["Materials"]:::assets
            end
            subgraph "Audio & Prefabs"
                CD["Audio Assets"]:::assets
                CE["Prefabs"]:::assets
            end
        end

        subgraph "Game Logic & Scripting"
            DA["GameManager"]:::logic
            DB["PlayerController"]:::logic
            DC["DevConsole"]:::logic
        end

        subgraph "Dialogue/Narrative System"
            EA["Story (Yarn)"]:::dialogue
            EB["Yarn Scripts"]:::dialogue
        end

        subgraph "Editor & Custom Tools"
            F["Editor Tools"]:::editor
        end
    end

    %% Relationships
    G -->|"supports"| A
    A -->|"powers"| B
    B -->|"loads"| CE
    CE -->|"populates"| DA
    DA -->|"controls"| DB
    DA -->|"triggers"| EA
    EA -->|"utilizes"| EB
    DA -->|"accesses"| DC
    F -->|"assists"| DC
    DA -->|"manages scene transitions"| B

    %% Styles
    classDef core fill:#f9f,stroke:#333,stroke-width:2px;
    classDef scenes fill:#ccf,stroke:#333,stroke-width:2px;
    classDef assets fill:#cff,stroke:#333,stroke-width:2px;
    classDef logic fill:#cfc,stroke:#333,stroke-width:2px;
    classDef dialogue fill:#fcf,stroke:#333,stroke-width:2px;
    classDef editor fill:#ffc,stroke:#333,stroke-width:2px;
    classDef config fill:#f96,stroke:#333,stroke-width:2px;

    %% Click Events
    click A "https://github.com/adenc123/mtstringmore/tree/main/ProjectSettings/"
    click G "https://github.com/adenc123/mtstringmore/blob/main/Packages/manifest.json"
    click B "https://github.com/adenc123/mtstringmore/tree/main/Assets/Scenes"
    click CA "https://github.com/adenc123/mtstringmore/tree/main/Assets/Sprites"
    click CB "https://github.com/adenc123/mtstringmore/tree/main/Assets/Animation"
    click CC "https://github.com/adenc123/mtstringmore/tree/main/Assets/Materials"
    click CD "https://github.com/adenc123/mtstringmore/tree/main/Assets/Audio"
    click CE "https://github.com/adenc123/mtstringmore/tree/main/Assets/Prefabs"
    click DA "https://github.com/adenc123/mtstringmore/blob/main/Assets/Scripts/GameManager.cs"
    click DB "https://github.com/adenc123/mtstringmore/blob/main/Assets/Scripts/PlayerController.cs"
    click EA "https://github.com/adenc123/mtstringmore/blob/main/Assets/Story/Level1Script.yarn"
    click EB "https://github.com/adenc123/mtstringmore/blob/main/Assets/Scripts/Yarn/CutsceneCharacter.cs"
    click F "https://github.com/adenc123/mtstringmore/blob/main/Assets/Editor/AttachableMovingObjectEditor.cs"
```
