OpenNPC

OpenNPC

Personality-driven NPC dialogue.

NPCs aren't just dialogue trees.
They're people with personalities.

[ Play demo ]

OpenNPC interactive demo

Unity WebGL · runs in your browser · no API keys · MockDialogueProvider

The OpenNPC street: black stickman NPCs walking past line-drawn shops

Loads the Unity build on click

Loading the street

0%

  • WASD / Arrows Move
  • E Talk
  • Enter Send message
  • Tab Debug
  • P Persona
  • Esc Leave

Try: walk up to anyone, press E, type “What do you think about this city?” — then ask someone else the same thing.

Same question. Different minds.

Real output of the offline MockDialogueProvider, checked by the DemoVerify editor step.

“What do you think about this city?”

Every NPC has a personality. Every NPC can have different knowledge, moods, memories and speaking styles. The provider reads the persona — the NPC code never changes.

How it works

  1. Personawho the NPC is
  2. Contextwhere, when, what just happened
  3. OpenNPCmemory · prompt · policy
  4. Modelmock, local LLM, hosted API
  5. Responsetext + emotion, back to the NPC

A persona is data

{
  "id": "npc_001",
  "name": "Ravi",
  "occupation": "Taxi Driver",
  "personalityTraits": ["impatient", "sarcastic", "helpful"],
  "mood": "tired",
  "speakingStyle": "Short sentences and sarcastic remarks.",
  "likes": ["tea", "old movies"],
  "dislikes": ["traffic", "small talk"]
}

A provider is swappable

public interface IDialogueProvider
{
    string Name { get; }
    void Generate(DialogueRequest request,
                  Action<DialogueResponse> onComplete);
}

Mock today. A local model, an OpenAI-compatible server or the OpenNPC backend tomorrow — through a server you control. API keys never ship in a WebGL build.