Streaming Render, Physical Metrics, and Structured Action Consumption
sequenceDiagram
participant K as Plugin Kernel
participant GT as Game Thread (UI)
Note over K: Token Chunk Ready
K->>GT: OnChunk(FString) [Auto Marshalling]
GT->>GT: Update UMG Typewriter
Note over K: Inference Completed
K->>GT: OnDone(Result Object)
GT->>GT: Parse ToolCalls for Logic
GT->>GT: Display Latency/TPS Stats
Listen for fragments to achieve zero-wait visual feedback.
// Consumed in WinyunqDialogueWidget
void OnChunk(const FString& Chunk) {
CurrentText += Chunk;
Text_Block->SetText(FText::FromString(CurrentText));
}
Extract AI "Thoughts" to drive game logic.
// Parse actions in OnDone
for (auto Call : Result.ToolCalls) {
if (Call->Name == "OpenDoor") { ExecuteOpenDoor(Call->Params); }
}
Show speed and latency to the user.
// Extract physical results
float TPS = Result.TokensPerSec;
float Latency = Result.TimeMs;
AI drops tokens one by one. The plugin marshals these from background threads to GameThread, ensuring UI safety.
How to force JSON? Logits probability filtering allows us to block hallucinations and only allow valid structural output.