# Make a game&#8217;s side characters talk with an AI model

Give each non-player character a short persona and rules, and have a model write their lines in response to what the player does, inside safe limits.

- Blaze Score: 43/100
- Proof: Blaze Fish recipe
- Difficulty: Builder
- Tools: Claude, Cursor
- Setup time: 3 hr
- Monthly cost: $10/mo
- Saves: pages of hand-written dialogue
- URL: https://www.blazefish.com/use-case/make-a-games-side-characters-talk-with-an-ai-model/

### Steps

1. Write a 5-line persona for each character: who they are, what they know, what they want, how they talk, what they never say.
2. Have your game send the persona, the recent events and the player's line to the model.
3. Limit replies to two sentences and a mood tag your game can animate.
4. Cache common lines so you do not pay for the same reply twice.
5. Add a fallback line for when the model is slow or offline.

### Prompt

```
You are {{npc_name}} in a game. Persona: {{persona}}. You know only: {{knowledge}}. You never reveal: {{secrets}}.
Recent events: {{events}}
The player says: "{{player_line}}"

Reply in character in at most 2 sentences. Return JSON: {"line": "...", "mood": "happy|neutral|angry|scared|sly", "gives_quest": true/false}. Stay family-friendly. Never break character or mention being an AI.
```

