# ctrl-games-dev/under-control architecture

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

- Interactive diagram: https://gitdiagram.com/ctrl-games-dev/under-control
- Repository: https://github.com/ctrl-games-dev/under-control

## Overview

Based on your file tree and the README, this project is a Unity game (specifically “Under Control a T3G game from CTRL Games”) built on the UnityEnginePlatform. Although the README is brief, the detailed file structure reveals that it is a fairly complete game project that leverages many of UnityEnginePlatform’s features such as scenes, prefabs, a wide variety of assets (animations, audio, textures, models), scripting for game logic (AI, inventory, UI, etc.), and third-party plugins (like DOTween).

##### Main Components
- Scenes: Include major scenes such as Adventure, Boss, Hub, MainMenu, and various workspaces. These are the levels or game states.
- Prefabs and Assets: Group together prefabs (for UI, characters, enemies, environmental elements) and resources such as FBX models, textures, materials, animations, and audio.
- Scripts: Highlight key scripting layers. For instance:
- Game Management (GameManager, Scene/Level Managers, MainMenuManager)
- UI Systems (HUD, Inventory, PauseScreen, HoverTooltip)
- AI Components (BoarAI, BoarBoss, enemy behaviors, actions)
- Player Control (PlayerController and related player scripts)
- Inventory and Item Systems (Inventory scripts, item datas, and item entity handling)
- Visual and Audio Effects (VFX, WeaponTrail, MusicPlayer)
- External Dependencies: Include third-party toolkits such as DOTween from Demigiant.
- Settings and Project Configuration: Represent the ProjectSettings (e.g., Input, Physics, Graphics) which configure core behavior.

##### Relationships and Interactions
- Directional data flows from the UnityEnginePlatform as the foundation interacting with all components.
- That the GameManager acts as the central orchestrator connecting:
- Scene and Level Managers: these load and manage different scenes (Adventure, Boss, Hub, etc.).
- UI components: for in-game interactions and menus.
- Inventory and Item systems: managing player inventory, interactable objects, and pickups.
- Link AI and player scripts to their related animations, prefabs, and behavior graphs.
- That prefabs (characters, enemies, environmental objects) are constructed in UnityEnginePlatform and then manipulated by their corresponding scripts.

##### Architectural Patterns and Design Principles
- The project is structured in a modular way where each feature (AI, Inventory, UI, Levels) is in its own set of directories under Assets/Scripts.
- Use MVC-like separation: where game data (such as ScriptableObjects for Items, Guilds, and Effects) are decoupled from the logic that manipulates them.
- Event-driven communication using central systems like the EventBus.
- Use of dependency injections or manager classes (GameManager, HubManager, etc.) that coordinate interactions between loosely coupled systems.

##### Relevant Technologies and Frameworks
- That the project runs on UnityEnginePlatform (as required, using that exact string).
- DOTween is used for tweening animations and smooth transitions.
- Other built-in Unity systems such as NavMesh, audio mixers, and timeline/post-processing effects are managed through ProjectSettings.
- ScriptableObjects are used extensively for managing data (items, spells, AI behavior, and game context).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Platform Layer
    subgraph "Platform Layer"
        UnityEnginePlatform["UnityEnginePlatform"]:::platform
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Scenes["Scenes"]:::presentation
        PrefabsAssets["Prefabs & Assets"]:::presentation
        UISystems["UI Systems"]:::presentation
    end

    %% Logic Layer
    subgraph "Logic Layer"
        GameManager["GameManager"]:::logic
        SceneManagers["Scene Managers"]:::logic
        AIComponents["AI Components"]:::logic
        PlayerController["PlayerController"]:::logic
        InventorySystem["Inventory System"]:::logic
        ItemEntity["Item Entity"]:::logic
        VFX["VFX & WeaponTrail"]:::logic
        MusicPlayer["MusicPlayer"]:::logic
    end

    %% External Integrations
    subgraph "External Integrations"
        DOTween["DOTween"]:::external
    end

    %% Relationships from Platform Layer to Presentation and Logic
    UnityEnginePlatform -->|"manages"| Scenes
    UnityEnginePlatform -->|"manages"| PrefabsAssets
    UnityEnginePlatform -->|"provides"| UISystems
    UnityEnginePlatform -->|"orchestrates"| GameManager
    UnityEnginePlatform -->|"runs"| PlayerController

    %% Relationships within Logic Layer and between Layers
    UISystems -->|"updates"| GameManager
    GameManager -->|"controls"| SceneManagers
    GameManager -->|"updatesInventory"| InventorySystem
    InventorySystem -->|"managesData"| ItemEntity
    AIComponents -->|"affects"| PrefabsAssets
    GameManager -->|"triggersEffects"| VFX
    GameManager -->|"plays"| MusicPlayer
    PlayerController -->|"sendsInputTo"| GameManager

    %% External Integrations relations
    DOTween -->|"animates"| UISystems
    DOTween -->|"animates"| VFX
    DOTween -->|"animates"| GameManager

    %% Click Events
    click UnityEnginePlatform "https://github.com/ctrl-games-dev/under-control/tree/main/ProjectSettings"
    click Scenes "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scenes"
    click PrefabsAssets "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Prefabs"
    click GameManager "https://github.com/ctrl-games-dev/under-control/blob/main/Assets/!/Scripts/GameManager.cs"
    click SceneManagers "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/Levels"
    click UISystems "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/UI"
    click AIComponents "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/AIs"
    click PlayerController "https://github.com/ctrl-games-dev/under-control/blob/main/Assets/!/Scripts/Player/PlayerController.cs"
    click InventorySystem "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/Inventory"
    click ItemEntity "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/ItemEntity"
    click VFX "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/!/Scripts/VFX/WeaponTrail"
    click MusicPlayer "https://github.com/ctrl-games-dev/under-control/blob/main/Assets/!/Scripts/MusicPlayer.cs"
    click DOTween "https://github.com/ctrl-games-dev/under-control/tree/main/Assets/Plugins/Demigiant/DOTween"

    %% Styles
    classDef platform fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef presentation fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef logic fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef external fill:#FFC0CB,stroke:#000,stroke-width:2px;
```
