# jackoodesu/aimlabs-minimal architecture

> Architecture diagram of the GitHub repository jackoodesu/aimlabs-minimal, 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/jackoodesu/aimlabs-minimal
- Repository: https://github.com/jackoodesu/aimlabs-minimal

## Overview

##### Main Components
- Assets & Scenes: Include subcomponents such as Assets (game materials, prefabs, shaders, UI Toolkit files, etc.) and ProjectSettings that configure Unity’s runtime (graphics, input, quality settings).
- Mission System:
– Mission Importer/Loader: The game executable auto-imports missions (from the “missions” folder under TsProject or local mission zips).
– Mission Repository & Template: Missions are defined in the TsProject folder with TypeScript/JavaScript scripts, JSON mission definitions, and custom mission actions.
– Crosshair Config: A separate module (using crosshair-config.cjs and a corresponding template) to customize crosshair settings.
- Scripting & Extensibility:
– PuerTs Integration: This module bridges C#/Unity with JavaScript, enabling dynamic mission logic.
– Generated Typings: Note the Assets/Gen/Typing/csharp directory which holds index.d.ts for mission API contract.
– VContainer (dependency injection)
– UniTask (asynchronous tasks)
– Realms (possibly for data persistence)
– Discord RPC (for community/game status updates)
– glTFast (for handling 3D models)
- Build and Deployment Tools:
– GitHub Actions Workflows (auto-release, Windows build)
– TsProject’s Dockerfile, Makefile, and docker-compose.yml (likely managing mission validate/build environment)

##### Out Relationships and Data Flow
- The Game Core interacts with the Mission System – launching, managing, and updating missions.
- Inside the Mission System, illustrate the interaction between the static Unity C# side and the dynamic JS scripting side (via PuerTs).
- That the Game Core uses external plugins for additional functionalities (dependency injection, async tasks, etc.).
- The Updater component acts as a bridge whenever a user’s database version is outdated – a separate data migration path triggered at game startup.
- For development and deployment, show an “Automation Pipeline” component representing GitHub workflows and additional TypeScript build tasks (from the TsProject folder).

##### Architectural Patterns and Design Principles
- Separation of Concerns: Different modules for game rendering (Unity/Scenes), mission logic (scripted missions), and system utilities (updater, crosshair config).
- Dependency Injection & Service-Oriented: Use of VContainer indicates modular, testable components; illustrate services like AudioService, DiscordHandler, etc.
- Scripting Extensibility: Represent the PuerTs module as the integration point, highlighting that missions are written in JavaScript/TypeScript and are decoupled from the core game engine.
- Mission Repository & Importer Workflow: Emphasize how missions are dynamically injected and then updated via the mission importer, reflecting an extensible mission repository design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    Player["Player"]:::user

    %% Game Core Layer
    subgraph "Game Core Layer"
        GC["Game Core (Unity)"]:::unity
        AS["Assets & Scenes"]:::unityDetail
        GC --> AS
    end

    %% Mission System
    subgraph "Mission System"
        MR["Mission Repository & Template"]:::missionRepo
        MI["Mission Importer/Loader"]:::missionScript
        CC["Crosshair Config"]:::missionScript
        MR --> MI
        MI -->|"feeds"| GC
        CC -->|"configures"| GC
    end

    %% Scripting & Extensibility
    subgraph "Scripting & Extensibility"
        PT["PuerTs Scripting Bridge"]:::scripting
        GT["Generated Typings"]:::scripting
        PT --> GT
        GC -->|"integrates"| PT
    end

    %% External Plugins & Dependencies
    subgraph "External Plugins & Dependencies"
        DR["Discord RPC"]:::external
        VC["VContainer"]:::external
        UT["UniTask"]:::external
        RL["Realms"]:::external
        GF["glTFast"]:::external
        GC -->|"Utilizes"| DR
        GC -->|"Utilizes"| VC
        GC -->|"Utilizes"| UT
        GC -->|"Utilizes"| RL
        GC -->|"Utilizes"| GF
    end

    %% Updater / Migration Engine
    subgraph "Updater"
        UP["Updater / Migration Engine"]:::updater
        UP -->|"updates"| GC
    end

    %% Dev & Build Automation
    subgraph "Dev & Build Automation"
        BA["Build and Deployment Tools"]:::build
        BA -->|"builds"| MR
    end

    %% Data Flow from Player to Game Core
    Player -->|"starts"| GC

    %% Click Events
    click GC "https://github.com/jackoodesu/aimlabs-minimal/tree/main/Assets"
    click AS "https://github.com/jackoodesu/aimlabs-minimal/tree/main/Assets"
    click MR "https://github.com/jackoodesu/aimlabs-minimal/tree/main/TsProject/src/missions"
    click MI "https://github.com/jackoodesu/aimlabs-minimal/blob/main/Assets/Scripts/ALM/Screens/Base/Service/MissionImporter.cs"
    click CC "https://github.com/jackoodesu/aimlabs-minimal/blob/main/Assets/Resources/crosshair-config.cjs"
    click PT "https://github.com/jackoodesu/aimlabs-minimal/tree/main/Assets/PuerTs"
    click GT "https://github.com/jackoodesu/aimlabs-minimal/blob/main/Assets/Gen/Typing/csharp/index.d.ts"
    click DR "https://github.com/jackoodesu/aimlabs-minimal/blob/main/Assets/Packages/DiscordRichPresence.1.2.1"
    click VC "https://github.com/jackoodesu/aimlabs-minimal/blob/main/Assets/Settings/VContainerSetting.asset"
    click UP "https://github.com/jackoodesu/aimlabs-minimal/blob/main/updater/v0-0-1~v0-0-4c.cjs"
    click BA "https://github.com/jackoodesu/aimlabs-minimal/tree/main/.github/workflows"
    click BA "https://github.com/jackoodesu/aimlabs-minimal/tree/main/TsProject"

    %% Styles
    classDef unity fill:#a7d8de,stroke:#333,stroke-width:2px;
    classDef unityDetail fill:#c2e9fb,stroke:#333,stroke-width:2px;
    classDef missionScript fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef missionRepo fill:#f7dc6f,stroke:#333,stroke-width:2px;
    classDef scripting fill:#d7bde2,stroke:#333,stroke-width:2px;
    classDef external fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef updater fill:#f5cba7,stroke:#333,stroke-width:2px;
    classDef build fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef user fill:#fcf3cf,stroke:#333,stroke-width:2px;
```
