How to Use AI for NPC Dialogue in Your Indie Game
A practical guide to using ChatGPT, Claude, and Inworld AI for writing and implementing NPC dialogue — from quest barks to branching conversation trees.
Why NPC dialogue is the ideal AI writing task
NPC dialogue hits the sweet spot for AI-assisted game writing: it is repetitive enough to bottleneck a solo dev, structured enough for AI to follow rules, and low-stakes enough that imperfect output is easy to spot and fix.
A well-prompted language model can produce a first draft of 50 NPC barks in the time it would take you to write five manually. Here is how to get useful output.
The two types of NPC dialogue
Before picking a tool, decide which type you are building:
Offline / pre-written dialogue — Lines are written before shipping, stored in a dialogue system (like Yarn Spinner or Dialogic), and played back during runtime. Most indie games use this approach.
Runtime / dynamic dialogue — NPCs generate responses in real-time using an AI model. Requires live inference, costs money per request, and adds complexity. Suitable for very specific game concepts.
This guide covers offline dialogue — the practical choice for most indie games.
Step 1: Write a character brief
The single most important thing you can do before prompting any AI is write a brief for each NPC. Without context, AI output is generic. With context, it is surprisingly good.
A minimal NPC brief:
``` Name: Edra Role: Blacksmith in a frontier mining town Personality: Gruff but fair, secretly lonely, proud of her craft Speech pattern: Short sentences, avoids eye contact topics, uses mining metaphors Relationship to player: Neutral → becomes an ally if you help her apprentice Current concern: Her apprentice hasn't returned from the mines in three days ```
Copy this brief into the system prompt of ChatGPT or Claude. Every line you generate in that session will carry this character's voice.
Step 2: Prompt templates that actually work
Ambient barks (idle lines) ``` Generate 8 idle ambient lines for Edra. She says these when the player walks past but doesn't talk to her. Short, 1–2 sentences. In character. ```
Quest hook dialogue ``` Write the dialogue for when the player first speaks to Edra about her missing apprentice. Include: - 1 opening line from Edra introducing the problem - 2 player response options (interested / dismissive) - Edra's reply to each option - The quest acceptance confirmation line Keep each line under 100 characters for in-game text boxes. ```
Reaction lines (on quest completion) ``` Write 3 versions of Edra's reaction when the player returns with her apprentice: - Grateful but trying to hide emotion - Relieved and direct - Overwhelmed with thanks ```
Step 3: Iterate with a style guide
After generating your first batch, pick the lines you like and create a style guide. Tell the AI: "These lines match Edra's voice well. Generate 10 more in this style for when she sells items to the player."
This self-referential prompting dramatically improves consistency across a large dialogue set.
Step 4: Export to your dialogue system
Yarn Spinner (Unity/Godot) Ask ChatGPT to format output in Yarn Spinner syntax directly:
``` Format the following dialogue as a Yarn Spinner node called "Edra_QuestAccept". Include speaker labels and choice nodes. ```
Dialogic (Godot) Dialogic uses a JSON structure. You can ask Claude to output a JSON array of dialogue events and paste it directly into your project.
Custom systems Ask the AI to output a CSV or JSON schema matching your existing dialogue format. Give it one example row and ask it to fill in the rest.
ChatGPT vs Claude for NPC dialogue
ChatGPT is faster at short barks and system-oriented output (JSON, CSV). Good for high-volume production.
Claude often produces more nuanced characterization for longer scenes and emotional moments. Worth using for hero NPCs and key story beats.
Practical recommendation: use ChatGPT for bulk production, Claude for characters that matter most to your narrative.
When to consider Inworld AI for runtime dialogue
If your game concept requires NPCs to respond dynamically to player choices in real time, Inworld AI is designed for this. It manages character memory, personality consistency, and intent detection at runtime.
The trade-offs: you pay per API call, you need a backend, and the player experience depends on latency. This is right for a specific type of game — an AI-native RPG or social simulator — not a general recommendation.
Common mistakes to avoid
Mistake 1: No character brief. Generic NPCs sound generic regardless of AI quality.
Mistake 2: Accepting first drafts. AI output needs editing. Budget 30% of time for cleanup.
Mistake 3: Inconsistent voice. If you switch sessions or AI tools mid-project, the character voice drifts. Keep one session per major character.
Mistake 4: Over-generating. 500 lines of mediocre barks is worse than 50 great ones. Define line counts before generating.
Quick-start checklist
- [ ] Write a one-page character brief for each NPC
- [ ] Set the brief as the AI system prompt
- [ ] Start with quest hook dialogue (the most critical lines)
- [ ] Pick the best 20% of generated lines as your style guide
- [ ] Generate remaining categories using the style guide
- [ ] Export to your dialogue system format
- [ ] Playtest and flag any lines that break immersion
---
See the full list of AI tools for game writing and NPC design at [game.fengyuai.site/categories/ai-game-design-tools](/categories/ai-game-design-tools).