Docs / LocalNPC Documentation

LocalNPC Documentation

Welcome to the LocalNPC developer manual. LocalNPC is an on-device conversational NPC framework for Unity 6000.0 or newer on 64-bit Windows. Speech recognition (Whisper) and the language model (Qwen 2.5, through llama.cpp) run on the player's PC, with no cloud service and no per-token API costs. LocalNPC sends no data about the player: its only network use is downloading the model files from Hugging Face (huggingface.co) over HTTPS, with the server's certificate checked and each file checked with SHA-256 (and the licence links in the Editor). LocalNPC runs no server of its own; Hugging Face sees the IP address of the computer that downloads. (Checked by reading the code; no network capture was made.) The NPC speaks with the Windows system voice (OneCore, SAPI 5 as last fallback); nothing is downloaded for it, and with no voice installed the NPC answers in text only.


📚 Table of Contents

GuideDescriptionTarget Audience
1. Quick StartSet up a talking NPC in a new projectNew Developers
2. Installation & RequirementsHardware requirements, Unity version, and project settingsTechnical Leads & IT
3. Personality Writing GuideSystem prompt craft, few-shot examples, and token constraintsWriters & Game Designers
4. Choosing a Model PresetCompare the Balanced (1.5B, default) and Fast (0.5B, low-end PCs) tiersProducers & Designers
5. API ReferenceComprehensive public C# contracts and code samplesProgrammers
6. Performance TuningCPU thread allocation, context windows, and latency budgetsOptimization Engineers
7. Lip Sync SetupA jaw that opens with the loudness of the voice, and blendshape mapping with an ARKit preset for viseme weights from your own code or the optional uLipSync bridge (not yet tested on a real character)Technical Artists
8. Shipping Your GameBuild pipeline, standalone Windows, and player deploymentBuild Engineers
9. Offline & Kiosk DeploymentPre-bundled StreamingAssets, air-gapped systems, and kiosk microphone setup (Push-to-Talk planned for v1.1)Enterprise & Exhibits
10. Language SupportMultilingual architecture seam and custom phonemizersLocalization Teams
11. TroubleshootingDiagnostic solutions for common audio, model, and DLL issuesAll Developers

Support: email localnpcsupport@gmail.com (what to include: Getting help).


âš¡ Architecture Pipeline in One Line

Microphone → VAD (energy; the downloaded voice activity model is not used) → Speech-to-Text (Whisper) → LLM (Qwen 2.5) → Sentence Splitter → TTS (Windows system voice) → Audio Queue (+ optional jaw by loudness)

The core streaming innovation: each sentence begins synthesizing and speaking out loud while the language model is still generating subsequent tokens. Reply time: Typically about 3 seconds after you stop talking: a 0.9 second end-of-speech wait plus about 2 seconds (measured 2.04 to 2.25 s on one laptop, Balanced preset, five voice turns). It depends on your hardware, and we have not measured other machines yet.

This page is the file docs/index.md of the LocalNPC package documentation (also in the package as Documentation~/index.md).