Rick Vu

LLM or scripted NPC dialogue, and how to decide per character

PER LINE

Script an NPC’s dialogue when your writers can list every situation it will face, or when one wrong line would break the story or hurt a player. Use a live language model when the NPC has to answer things nobody can list in advance, such as free typed or spoken input, and the game can afford a delay of a second or more and a running cost per player. Many characters need both. In that mix, writers author the persona and the lines that carry the story, and a model generates small talk and reactions behind checks in code.

The choice is per character, and often per line. This guide gives a three-question test a designer can run on one NPC, then describes the hybrid that the answers usually point to. Rick Vu, who directed this piece, builds Red Dog Studio, a game studio, so he has a stake in how this field develops. Nothing below describes Red Dog’s work.

Choosing between scripted and generated NPC dialogueA designer asks three questions about one NPC: whether it must react to inputs the writers cannot list, how much harm a wrong line does, and what time and money each turn may spend. The answers sort the character's lines. A writer authors the persona and the key story lines, a model generates reactions, and code checks every generated line and falls back to an authored line when a check fails.THREE QUESTIONS PER NPCTHE USUAL HYBRIDEVERY GENERATED LINEINPUTSLISTABLE?BAD LINEHOW BAD?BUDGETPER TURNSORT EACH LINEBY THE COST OF A WRONG VERSIONPERSONAWRITTENKEY LINESAUTHOREDREACTIONSGENERATEDCHECKS IN CODEA FAILED CHECK PLAYS AN AUTHORED LINE
Fig 1. The test sorts lines, not whole games. Writers keep the persona and every line that carries the story, and the model fills in reactions behind checks in code.

What scripted dialogue gets right

A writer composes each scripted line before the game ships. A team reviews it, an actor records it, and a translator localizes it. QA can play every branch, and legal reviewers can read every word. The line plays the instant the game asks for it and costs nothing per player at runtime.

The cost sits up front. Every branch is a line someone has to write, and often record and translate. Branches multiply fast. A conversation with three choices at each of four steps has 81 paths if no branches merge. Writers keep that in check by merging branches and narrowing choices, which is why many dialogue trees offer a few options that lead back to the same place. The other cost is repetition. A guard with ten authored barks repeats on the eleventh, and players notice.

Scripted dialogue has one hard limit. It cannot answer an input that nobody wrote a line for. If the player only picks from a menu, that never happens. If the player can type or speak anything, it happens on the first turn.

What a live model adds, and what it costs

A language model can answer any input in character, using whatever the game puts in its prompt. The best-known research demonstration is the Generative Agents paper by Joon Sung Park and colleagues. It placed 25 agents in a small town reminiscent of The Sims. Each agent stores its experiences, reflects on them, and plans from them. The researchers gave one agent the idea of throwing a party. Over the next two game days, word spread to twelve other agents, they asked each other to come, and five of them arrived at the right time. No writer authored that chain of conversations. That is the case for a model. Its behavior follows from the situation instead of from a list.

The same paper is honest about the failures. The authors report that agents sometimes “hallucinated embellishments” to what they knew, failed to retrieve the right memories, and talked in a style that felt overly formal. They also write that simulating 25 agents for two game days cost “thousands of dollars in token credits” and took multiple days to complete. Those were 2023 prices, for agents that planned and reflected all day long. Read the figure as a warning that model calls add up, not as a current price.

For current numbers, the worked example in what an AI NPC costs per player puts one talking NPC at between under one cent and about 40 cents per player hour, at October 2026 list prices. The latency budget for a talking AI NPC estimates one to three seconds from the end of the player’s speech to the NPC’s first word. A scripted line has neither cost.

Writers still author the character

Ubisoft’s NEO NPC is a useful case because it was built to show off generated dialogue. It is a prototype that Ubisoft announced in March 2024 and presented at GDC 2024, built with Inworld’s language model and NVIDIA’s Audio2Face. In Ubisoft’s article on the NEO NPC prototype, the company says the characters’ personalities “aren’t created by a machine, but by a writer.” Narrative director Virginie Mosser builds each character’s backstory and personality. She keeps adjusting the character after the model starts to improvise. Ubisoft also describes guardrails and filters for toxic input. The article calls the project “only a prototype”, with a way to go before it reaches a game.

So even a showcase for generated dialogue kept a writer in charge of who the character is. The model improvised inside that character. The same split shows up in the hybrid below.

A three-question test for one NPC

Run these questions on one character at a time. A single game can have a scripted quest giver, a mixed companion, and generated crowd chatter.

Does it need to react to things your writers cannot list?

Write down what the NPC can perceive. Menu choices, quest flags, and a fixed set of world events are all listable, and a scripted or templated system covers them. Free typed or spoken input is not listable. Neither is a simulation where combinations of state multiply faster than anyone could write for them, as in the Generative Agents town. If everything the NPC reacts to fits on a list, stop here and script it.

How bad is a wrong line?

Sort the NPC’s lines by what a wrong version does. Wrong ambient chatter costs almost nothing. A shopkeeper who misquotes a price confuses the player. A quest giver who invents a quest that does not exist breaks the game. A slur, or real-world medical advice, harms the player and the studio.

The higher a line sits on that scale, the more it should be authored, or picked from options a writer approved. Facts the game acts on, such as prices and quest state, belong in game code, never in the model’s free text. The model can ask for an action, and code decides whether it happens.

What time and money does the loop allow per turn?

Some loops have no room. A combat callout has to play on the frame the event happens, so it stays scripted. A conversation the player starts, at a pace the player sets, can absorb a second or two if the game covers the gap with an authored nod or sound.

Then work out the money. Estimate turns per player hour and price them with the formula in the cost piece. Add memory, because how AI NPCs remember estimates that memory takes about half of each prompt. If the total does not fit what a player is worth to the game, script the NPC, cap its turns, or move it to a small model on the player’s device.

The usual hybrid

When the test returns mixed answers, which happens for most characters worth talking to, the split usually looks like this:

The routing step does most of the work. It keeps the model away from the lines where a wrong version is expensive, and it keeps the cost per player down because many turns never reach a model.

One more option sits between scripted and live. Use a model while writers write, not while the player plays. Writers generate many variants of barks and reactions, keep the good ones, and ship them as ordinary scripted lines. The player hears more variety, and the game pays nothing and waits for nothing at runtime. This option does not help with free input, which sends you back to the first question.

When the answer is still a script

Some NPCs should stay fully scripted even when the budget allows a model. A character whose every line is a story beat gains little from improvisation. A voiced character loses the actor’s performance on every line a synthetic voice reads instead. A game that ships in many languages needs its checks on generated lines to work in each of those languages, while a scripted line is translated and reviewed once.

Rerun the test when the design changes or when prices move. The cost and latency figures linked above carry dates because they change, and a character that failed the budget question this year may pass it next year.

Questions

Should game NPCs use an LLM or scripted dialogue?

Use scripted dialogue when writers can list every situation the NPC faces, or when a wrong line would do real harm. Use a live model when the NPC must react to free player input or to game states nobody can list in advance, and the game can afford the delay and the cost per player. Many characters need both.

What is hybrid NPC dialogue?

A writer authors the character's persona and every line that carries the story, such as quest steps and reveals. A language model generates small talk and reactions to things the writers could not predict. Code checks each generated line and plays an authored fallback line when a check fails.

Is LLM dialogue more expensive than scripted dialogue?

At runtime, yes. A scripted line costs nothing to play, while every generated line is a paid model call or a share of the player's GPU. Scripted dialogue pays its cost before launch in writing, recording, and translation, so the comparison depends on how many lines you would otherwise have to write.

Do AI NPCs still need writers?

Yes. In Ubisoft's NEO NPC prototype from 2024, a writer built each character's backstory and personality and kept adjusting the character after the model began to improvise. The model writes lines inside a character that a person designed.