Back to Coordinator
Workflow 01 / Authority

Authority: Singleton

EngineSubsystem Initialization and Kernel Sovereignty Locking

Sequence / Engine Subsystem Initialization
            sequenceDiagram
                participant E as Unreal Engine
                participant SUB as LiteRtLmSubsystem
                participant PL as Plugin Wrapper
                
                E->>SUB: 1. Initialize(Collection)
                activate SUB
                SUB->>PL: 2. Attempt Dynamic Binding to DLL Symbols
                PL-->>SUB: 3. Return Handle to DLL
                SUB->>SUB: 4. Initialize Global ModelHandle State
                deactivate SUB
                Note over E, SUB: Subsystem enters Ready state (Singleton Locked)
            
01 / Concept: Why EngineSubsystem?

Local LLM loading involves physical VRAM locking. If multiple Actors reload the model, memory will overflow instantly.

Singleton Sovereignty

The plugin ensures only one EngineHandle exists per engine lifecycle. Multiple NPCs share the same physical inference instance.

Cross-Level Persistence

Once loaded into the subsystem, the VRAM footprint is preserved across OpenLevel transitions, avoiding redundant AI warm-up times.

02 / Source Code Demo (C++)

How business logic securely acquires authority:

// 1. Acquire singleton handle
ULiteRtLmSubsystem* Subsystem = GEngine->GetEngineSubsystem<ULiteRtLmSubsystem>();

// 2. Query kernel sovereignty
if (Subsystem && Subsystem->IsModelLoaded()) {
    // Model is physically locked, proceed to session ops
    void* MySession = Subsystem->GetOrCreateSession(this);
}