DEV Community

Murni Marcus
Murni Marcus

Posted on • Originally published at vantage-digital.online

Open-Sourcing Our Game AI Stack — SDKs, Templates, and CLI Tools for NPC Dialogue

Open-Sourcing Our Game AI Stack

At Vantage Digital Labs, we've been building AI-powered NPC dialogue systems for games. Most of our internal tooling is now stable enough to share. We're releasing everything as open source — SDKs, starter templates, and CLI debugging tools.

Here's what's in each repo and how to get started.

The Repos

We maintain code across two GitHub accounts:

Organization (vantage-digital-labs) — Production SDKs:

  • core-sdk — Node.js / Browser SDK
  • unity-sdk — Unity C# SDK
  • unreal-plugin — Unreal Engine 5 C++ plugin

Personal (maximilian32541-spec) — Developer tools:

  • npc-dialogue-starter — Template project
  • game-ai-utils — CLI debugging tools

core-sdk — The Foundation

The core SDK is a TypeScript client that talks to our inference API. It handles NPC chat, streaming responses, voice synthesis, and session memory.

const { VantageClient } = require('@vantage-labs/core-sdk');

const client = new VantageClient({
  apiKey: 'vk_live_your_key_here',
  region: 'asia-northeast1'
});

// Basic NPC chat
const response = await client.npc.chat({
  npcId: 'npc_blacksmith_01',
  playerId: 'player_abc',
  message: 'Can you repair my sword?',
  context: {
    playerGold: 150,
    reputation: 'friendly',
    timeOfDay: 'evening'
  }
});

console.log(response.dialogue);  // "Aye, I can fix that. 50 gold."
console.log(response.emotion);   // "helpful"
Enter fullscreen mode Exit fullscreen mode

For real-time dialogue, use WebSocket streaming:

const ws = client.npc.stream({
  npcId: 'npc_guard_01',
  playerId: 'player_abc'
});

ws.on('dialogue_chunk', (chunk) => {
  process.stdout.write(chunk.text);  // Display as it generates
});

ws.on('emotion_shift', (state) => {
  // state.sentiment, state.trust, state.alertLevel
  updateCharacterAnimation(state);
});

ws.send({ message: 'I need to pass through here.' });
Enter fullscreen mode Exit fullscreen mode

unity-sdk — For Unity Developers

The Unity SDK wraps the core API with MonoBehaviour components. Drop NPCDialogueController onto any GameObject, assign an NPC profile, and you're running.

using VantageSDK;

public class MerchantBehavior : MonoBehaviour
{
    private NPCDialogueController dialogue;

    void Start()
    {
        dialogue = GetComponent<NPCDialogueController>();
        dialogue.OnResponse += HandleResponse;
    }

    public void GreetPlayer(string playerId)
    {
        dialogue.SendMessage("Welcome! Looking for something special?", playerId);
    }

    void HandleResponse(DialogueResponse response)
    {
        Debug.Log($"{response.Text} [{response.Emotion}]");
        animator.SetTrigger(response.Emotion);
    }
}
Enter fullscreen mode Exit fullscreen mode

unreal-plugin — For Unreal Engine 5

The Unreal plugin is a C++ module with Blueprint-exposed nodes. It supports both REST and WebSocket connections, with async Latent Actions for non-blocking inference calls.

void AMyNPC::OnPlayerInteract(FString PlayerId, FString Message)
{
    UVantageNPCComponent* Vantage = FindComponentByClass<UVantageNPCComponent>();

    FVantageChatRequest Request;
    Request.NpcId = NPCId;
    Request.PlayerId = PlayerId;
    Request.Message = Message;

    Vantage->Chat(Request, FOnVantageResponse::CreateUObject(
        this, &AMyNPC::HandleDialogueResponse
    ));
}

void AMyNPC::HandleDialogueResponse(const FVantageChatResponse& Response)
{
    SpeechBubble->SetText(FText::FromString(Response.Dialogue));
    PlayEmotionAnimation(Response.Emotion);
}
Enter fullscreen mode Exit fullscreen mode

npc-dialogue-starter — Build Your Own

This is a standalone template for building NPC dialogue without our API. It works with any OpenAI-compatible endpoint (OpenAI, DeepSeek, Ollama, vLLM).

git clone https://github.com/maximilian32541-spec/npc-dialogue-starter
cd npc-dialogue-starter
npm install
cp .env.example .env  # Add your API key
node index.js
Enter fullscreen mode Exit fullscreen mode

The architecture:

Player Input → Context Builder → LLM API → Response Parser → Game Engine
                    ↑                              |
                    └──── Memory / State ──────────┘
Enter fullscreen mode Exit fullscreen mode

Four core modules:

Module What it does
DialogueManager Session history, message routing
ContextBuilder NPC personality + world state injection
MemoryStore Long-term memory with relevance scoring
EmotionSystem Emotion-aware prompt modification

game-ai-utils — Debugging Tools

Three CLI tools for testing NPC behavior during development:

npc-bench — Benchmark response quality and latency:

node npc-bench.js --npc merchant --iterations 10 --concurrent 3
Enter fullscreen mode Exit fullscreen mode

dialogue-replay — Replay saved conversations:

node dialogue-replay.js --file conversations/sample-merchant.json
Enter fullscreen mode Exit fullscreen mode

prompt-lab — Interactive prompt testing:

node prompt-lab.js --npc=guard
Enter fullscreen mode Exit fullscreen mode

Why Open Source?

Game AI is moving fast. Studios shouldn't have to rebuild basic infrastructure from scratch. By open-sourcing our tooling, we hope to:

  1. Lower the barrier — Anyone can prototype NPC dialogue in an afternoon
  2. Get feedback — Real game devs will find bugs and edge cases we miss
  3. Build community — The best ideas come from people actually shipping games

Everything is MIT licensed. Use it in commercial projects, fork it, rip it apart.

What's Next

  • Voice synthesis integration (TTS + emotion mapping)
  • Multilingual NPC support (currently testing JP/KR/ZH)
  • Pre-built NPC personality templates

Check out the repos, open issues, and let us know what you're building.


Vantage Digital Labs builds AI tooling for game teams. vantage-digital.online · GitHub

Top comments (0)