# chorizite/chorizite architecture

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

- Interactive diagram: https://gitdiagram.com/chorizite/chorizite
- Repository: https://github.com/chorizite/chorizite

## Overview

##### Main Components (Top Level)

- Core System (Central Component)
- Plugin Manager (Rectangle)
- Backend Interfaces (Rounded rectangle)

- Launcher System (Left Side)
- Launcher Application
- Bootstrapper
- Standalone Loader

- Plugin System (Right Side)
- Core Plugins Container
- Custom Plugins Container
- Plugin Interfaces

##### Key Relationships and Data Flow

a) Bootstrap Process:
**Launcher → Bootstrapper → Standalone Loader → Core System**

b) Plugin Management:
**Core System ↔ Plugin Manager ↔ Plugins**

c) Backend Communications:
**Core System ↔ Backend Interfaces ↔ Game Client**

##### Detailed Subsystems

Create nested components showing:

a) Core System Details:
- Input Management
- Rendering System
- Lua Scripting Engine
- DAT File Management
- Network Parser

b) Plugin Architecture:
- Plugin Loader
- Plugin Instance Management
- Assembly Loading Context
- Plugin State Management

c) UI System:
- RmlUI Integration
- HTML/CSS Renderer
- ImGui Integration
- Screen Management

##### Integration Points

Interface connections:
- IChoriziteBackend
- IClientBackend
- ILauncherBackend
- IRenderInterface
- IPluginLoader

##### Cross-Cutting Concerns

Shared services as horizontal layers:
- Logging System
- Configuration Management
- Event System
- Resource Management

##### Notes

Annotations for:
- Plugin loading process
- UI rendering pipeline
- Game client integration points
- Configuration requirements

##### UI system integration with both launcher and game client

This design captures the essential architecture while maintaining clarity about how the various components interact within the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        L1[Core Components]:::core
        L2[Plugin Systems]:::plugin
        L3[UI Components]:::ui
        L4[Game Integration]:::game
        L5[Infrastructure]:::infra
        L6[("Data Flow ↔")]:::legend
    end

    subgraph "Core System"
        Core["Chorizite.Core"]:::core
        click Core "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Chorizite.cs"
        
        subgraph "Core Components"
            Config["Configuration"]:::core
            click Config "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/ChoriziteConfig.cs"
            
            InputMgr["Input Manager"]:::core
            click InputMgr "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Input/IInputManager.cs"
            
            RenderSys["Render System"]:::core
            click RenderSys "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Render/IRenderInterface.cs"
            
            LuaEngine["Lua Engine"]:::core
            click LuaEngine "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Lua/LuaContext.cs"
            
            DatMgr["DAT Manager"]:::core
            click DatMgr "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Dats/FSDatReader.cs"
            
            NetParser["Network Parser"]:::core
            click NetParser "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Net/NetworkParser.cs"
        end
    end

    subgraph "Backend System"
        BackendInt["Backend Interfaces"]:::infra
        click BackendInt "https://github.com/chorizite/chorizite/tree/master/Chorizite.Core/Backend/"
        
        IChorizite["IChoriziteBackend"]:::interface
        click IChorizite "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Backend/IChoriziteBackend.cs"
        
        IClient["IClientBackend"]:::interface
        click IClient "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Backend/IClientBackend.cs"
        
        ILauncher["ILauncherBackend"]:::interface
        click ILauncher "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Backend/ILauncherBackend.cs"
    end

    subgraph "Plugin System"
        PluginMgr["Plugin Manager"]:::plugin
        click PluginMgr "https://github.com/chorizite/chorizite/blob/master/Chorizite.Core/Plugins/PluginManager.cs"
        
        subgraph "Core Plugins"
            ACCore["AC Core"]:::plugin
            click ACCore "https://github.com/chorizite/chorizite/tree/master/Plugins/Core.AC/"
            
            Debugger["AC Debugger"]:::plugin
            click Debugger "https://github.com/chorizite/chorizite/tree/master/Plugins/Core.AC.Debugger/"
            
            DatService["DAT Service"]:::plugin
            click DatService "https://github.com/chorizite/chorizite/tree/master/Plugins/Core.DatService/"
            
            ImGui["ImGui Integration"]:::plugin
            click ImGui "https://github.com/chorizite/chorizite/tree/master/Plugins/Core.DearImGui/"
        end
    end

    subgraph "Launcher System"
        Bootstrap["Bootstrapper"]:::infra
        click Bootstrap "https://github.com/chorizite/chorizite/tree/master/Launcher/Chorizite.Bootstrapper/"
        
        Loader["Standalone Loader"]:::infra
        click Loader "https://github.com/chorizite/chorizite/tree/master/Launcher/Chorizite.Loader.Standalone/"
        
        MainLauncher["Main Launcher"]:::infra
        click MainLauncher "https://github.com/chorizite/chorizite/tree/master/Launcher/Launcher/"
    end

    subgraph "UI System"
        RmlUI["RmlUI Integration"]:::ui
        click RmlUI "https://github.com/chorizite/chorizite/tree/master/ext/RmlUI.Net/"
        
        UICore["UI Core Plugin"]:::ui
        click UICore "https://github.com/chorizite/chorizite/tree/master/Plugins/Core.UI/"
    end

    %% Relationships
    MainLauncher --> Bootstrap
    Bootstrap --> Loader
    Loader --> Core
    
    Core --> PluginMgr
    PluginMgr --> ACCore & Debugger & DatService & ImGui
    
    Core --> BackendInt
    BackendInt --> IChorizite & IClient & ILauncher
    
    Core --> InputMgr & RenderSys & LuaEngine & DatMgr & NetParser & Config
    
    UICore --> RmlUI
    ImGui --> RenderSys

    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef plugin fill:#90EE90,stroke:#333
    classDef ui fill:#DDA0DD,stroke:#333
    classDef game fill:#FFA500,stroke:#333
    classDef infra fill:#D3D3D3,stroke:#333
    classDef interface fill:#FFE4B5,stroke:#333
    classDef legend fill:none,stroke:none
```
