/npctalk:make-npcs-talkfrom npctalk
Guides building a real-time voice dialogue loop for game NPCs: speech-to-text, LLM in character, Fish Audio voice cloning, streamed playback, and action hooks. Covers latency budgets, costs, and integration order.
Ships in npctalk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The finished loop, as built for GTA V (examples/gta-v), with times measured in the game:
player's mic ──► voice activity ──► speech-to-text ──► who? + scene ──► LLM in character ──► voice server ──► NPC speaks
(open mic, (end of the (fal Nemotron, (the game) (Cerebras, with (Fish Audio on (streamed PCM,
push-to-talk, sentence) 0.4-0.8 s) persona + lines, an H100, first panned, subtitles,
or typing) 0.3-1.0 s) audio ~0.4 s) mouth, action)
│
└──► action choice (Jev, ~0.1 s, in parallel) ──► animation
From the end of the player's sentence to the NPC's voice: 1.2-2.2 s warm with push-to-talk (logged exchanges: 1.15 s, 1.20 s, 1.57 s, 2.19 s); the open mic adds the 0.7 s of silence it waits for before deciding the sentence ended. The LLM sometimes spikes to 5-8 s, so log every step's time per exchange.
references/game-hooks.md
for the engine, and knowledge/ for anyone who already did this game.fish-voice-server): npctalk health, then
npctalk say "..." --voice Name/clone. A game is the worst place to debug a GPU server.voice-references).stt / llm / tts / total for every exchange.voice-input): push-to-talk first, then the open mic.npc-dialogue): persona files, the character's own lines as style samples, scene
facts, per-NPC history, output cleaning.npc-actions): what they physically do, and doing what they're told.npc-showcase-clips), and if voice likeness matters, measure it (skill
voice-likeness-eval) before claiming a setting is better.knowledge/games/<game>/ (see knowledge/README.md).Everything else is game-free code. In the GTA V example about 2,450 of the mod's ~5,500 lines (dialogue, LLM,
voice clients, streaming playback, speech-to-text, open mic, action picking) build and run outside the game:
examples/gta-v/tools/npcvoice-check compiles exactly those files into a console app.
| Hook | What it returns | GTA V (ScriptHookVDotNet) |
|---|---|---|
| Who is being talked to | The NPC, or nobody | Living humans within 12 m; within 5 m always counts, 5-12 m only if the camera points at them (dot > 0.85). Named characters win ties; the last partner sticks while within 6 m |
| Scene facts | A few short strings | Zone and street name, time, weather, the player's vehicle and weapon, wanted level, health, whether this is the NPC's home |
| Voice at the NPC | Play streamed PCM from that NPC | NAudio playback, panned by screen position, faded 4-30 m, mouth driven by the audio level, the game's subtitle style |
| Actions | Name → animation or behaviour | Anim dictionaries checked at load (a missing one falls back), clothing swaps, tasks (flee, fight, kneel) |
Keep the hooks thin. If a game exposes them, the rest of this repo's code carries over.
| Need | Default | Alternatives |
|---|---|---|
| Voice, realtime | Fish Audio Drama 3 self-hosted on Modal (server/drama3.py): first audio ~0.4 s warm, acts [tags] well | S2 Pro (server/s2pro.py, smaller, fine-tunable); MiniMax via fal (no GPU to run, $1.50 per voice clone, 2.5-4.5 s per line) |
| Voice, pre-rendered (cutscenes, demos) | Drama 3 with best_of: 8 (best likeness measured) | ElevenLabs (scored lowest here, 0.612) |
| LLM | Cerebras qwen-3.8-27b, reasoning off (~0.3 s) | Any OpenAI-compatible endpoint; reasoning models add seconds |
| Speech-to-text | fal nvidia/nemotron-asr-multilingual/asr (~0.4 s, audio inline) | Whisper anywhere |
| Actions | TypeSafe Jev (typed choice + probability, ~0.1 s) | A second LLM call with a JSON schema (slower, less calibrated) |
Costs: an H100 runs about $4/hour while it's up; it scales to zero 5 minutes after the last request, and the next
request waits 1-3 minutes for a cold start. The game pings the server while it runs, so it stays warm exactly
while someone plays (server/keepwarm.py holds it up for a demo without the game).
npcvoice-check in the GTA example, npctalk say for the
server).voice-likeness-eval). Two runs of ten lines fooled us
once; ten runs didn't.npctalk check blocks audio and transcripts)./health needs no token: anyone with it can keep your GPU awake.npc-dialogue).Full reasoning: references/safety.md. Architecture and file map: references/architecture.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npc-dialogue, voice-cloning, game-modding, real-time-voice, fish-audio
npx claudepluginhub christos-antono/npctalk --plugin npctalk8 skills in this plugin
/fish-voice-serverHost Fish Audio's open-weights voice models (Drama 3 and S2 Pro) on a serverless GPU (Modal, or fal) behind one small HTTP API a game can call. POST /speak takes text and a voice and streams 16-bit PCM back with first audio in ~0.4 s, cloned zero-shot from a reference clip, with [tags] like [angry] or [laughing] for delivery. Covers deploying with SGLang-Omni, the API, preparing voices at startup, keep-warm and cold starts, scaling to zero and cost, sampling settings that measurably help likeness, picking the best of several takes for pre-rendered lines, an optional S2 Pro fine-tune, and the setup gotchas. Use when a game, mod or app needs realtime cloned character voices, the user mentions Fish Audio, Fish Speech, S2 Pro, Drama 3 or a self-hosted TTS server, or a voice server is slow, cold or failing./npc-actionsMake NPCs physically react to a conversation and follow spoken orders. Pick an action (punch, slap, hug, kneel and beg, flee, flip off, square up, nothing...) from what the player said and what the NPC replied, with TypeSafe's Jev returning a typed choice and a probability in ~0.1 s, per-action thresholds, a repeat cooldown, orders ("get on your knees") that override mood and make the LLM rewrite the line, and mapping action names onto the game's animations with checks at load. Use when NPCs should act out what they say, obey commands, or when actions picked by an LLM are too random, too timid or too frequent.Other plugins' skills for the same job