Yumina Blog

Guides

What is an AI NPC, and how do AI NPCs work?

What an AI NPC is, how one turn of dialogue works, why it is hard to ship, games that have one today, and the steps to make an AI NPC for your own game.

Short answer, as of 3 December 2026: an AI NPC is a game character the player does not control, whose lines or choices come from a language model while the game runs. The game sends the model its current state. The model answers with a line and sometimes a request, and the game checks that request against its own rules.

What is an AI NPC?

NPC means non-player character: the shopkeeper, the quest giver, the teammate the computer runs. A scripted NPC picks from lines a writer wrote in advance. An AI NPC writes a new line each time, from what the player typed and what is happening in the game.

Slay the Spire 2 shows the difference. In the base game the Ancients say one of a few fixed lines and hand you a relic. In our SpireTalk mod you type what you want to say, and the same characters answer in character.

AI NPC vs scripted NPC: what is the difference?

Scripted NPC AI NPC
Where a line comes from A writer, before release A language model, during play
What the player says Picks from a menu Types anything
Cost of one line Nothing One model call
Time to answer Instant Seconds
Who applies the rules The game The game

In both columns the game applies the rules. The model writes the words.

How do AI NPCs work?

One turn has three parts.

  1. Game state goes in. The game writes down what the character may know. In PvZ Online, our AI Crazy Dave gets a snapshot of the lawn: the level, the wave, your sun, and the plants and zombies in each of the five rows. He does not get what the fog hides.
  2. A language model writes the reply. The server adds the character's persona and its memory of you, then makes one call to the model.
  3. A validated line and action come out. Dave's reply has to be a small JSON object: text of at most 900 characters and at most one offer. The game decides which of eight offers are on the table. An offer that is not on the list is dropped and the text is kept.

Nothing the model writes runs as code. The game's own C++ checks the board, the price and a once-per-level flag again before any sun moves.

Why are AI NPCs hard to make?

Cost per line. Every line is a model call that someone pays for. In PvZ Online the default model is free. A paid model bills the player's credits or the player's own key. Two limits bound a chatty player: eight requests a minute and one request in flight at a time.

Latency. In our Dave samples a small fast model answered in 4 to 9 seconds and a large one took over 30. In SpireTalk the engine builds the prompt in 30 ms and parses the reply in 31 ms, so the wait is almost all model.

Staying in character. Models copy what is in front of them. Darv, a SpireTalk character, ended every line with "Have a gander!" until the mod started comparing each reply with his earlier ones.

Breaking game rules. Dave once described a Potato Mine on a lawn that had only two Peashooters. In SpireTalk a model that returned text with no values made a character hand out the same reward twice. The mod now resets the three writable values before every line.

Which games have AI NPCs?

These are from the makers' own pages.

Game AI NPC What the maker says
inZOI Smart Zoi Krafton calls it the "first-ever implementation of CPC technology in a live game", in inZOI Early Access. Its page says it "runs reliably on-device using an SLM (Small Language Model)".
NARAKA: BLADEPOINT MOBILE PC VERSION AI teammate NVIDIA's 13 March 2025 post announced an "on-device, NVIDIA ACE-powered AI teammate" for 27 March that fights beside you, finds items and suggests skills.
PUBG: BATTLEGROUNDS PUBG Ally Krafton's page lists it as a demo: "a teammate CPC capable of real-time interaction and collaborative play with players".
PvZ Online Crazy Dave Ours, at yumina.io/pvz. How we built him.
Slay the Spire 2, SpireTalk mod Eight Ancients and the Merchant Ours. How the mod works.

CPC is Krafton's term, co-playable character. NVIDIA says its ACE characters "use AI to perceive, plan, and act like human players".

How did Yumina build its AI NPCs?

Yumina is an open-source engine for AI-native games and roleplay, and both games run on it. In SpireTalk each character is a Yumina card, a JSON file. Darv is 28 KB with 35 variables. The game fills 32 of them, such as HP, gold and floor, and the model can only read those. The model may write three: an affection change from -3 to 3, three suggested replies, and a reward request the game may refuse.

The engine sits inside the mod as one JavaScript file of 185 KB, and the mod calls the model with the player's own key. The engine is open source and needs no account. The vision page explains why Yumina does not profit from AI usage: "trying to profit from AI usage pushes platforms toward greed over time: offering worse models, shortening context windows, and selling user data."

How do you make an AI NPC?

These steps come from Yumina's developer docs. They work from C#, GDScript, JavaScript or plain HTTP.

  1. Register your game at yumina.io/app/developer. You get a client_id.
  2. Write the manifest, your game's contract with every character. It lists inputs the game sends each turn, outputs the character sets, and actions the character may ask for, each with parameters and limits.
  3. Sign the player in. On a PC the SDK opens the browser. Elsewhere you show a QR code.
  4. Send a turn. It is one HTTP call with the character, what the player said and the inputs. The answer has the line, three suggested replies, the outputs and at most one action.
  5. Apply the action with your own rules, then report what happened. Yumina checks each action against your manifest first. A rejected one comes back with a code such as limit or not_allowed, and you never apply it.
  6. Store memory.head in your save file. Load an older save and the characters remember that timeline only.

The docs say this is free for the developer. Each turn is charged to the player's own Yumina wallet at the model's real cost, and players who use their own AI key are charged nothing.

For a mod that should not need an account, bundle the open-source engine and run a card with four functions: startSession, applyVariables, buildTurnPrompt and finishTurn. Multiplayer AI games covers scenes that several people share.

FAQ

What is an AI NPC?

A non-player character whose lines or choices come from a language model while the game runs. A scripted NPC picks from lines written in advance.

How do AI NPCs work?

The game sends its state and the player's words to a language model. The model returns a line and sometimes a request. The game checks the request against its rules and applies it or drops it.

How do I make an AI NPC?

Declare what the character can see and what it may ask for, send one call per line, and apply only the actions your game accepts. Yumina has SDKs for C#, Godot and JavaScript.

What games have AI NPCs?

Krafton lists inZOI's Smart Zoi as live in Early Access. NVIDIA announced AI teammates for NARAKA: BLADEPOINT MOBILE PC VERSION. Yumina runs an AI Crazy Dave in PvZ Online and nine AI characters in a Slay the Spire 2 mod.

AI vs NPC: what is the difference?

Every NPC is run by the computer. Game developers have long called that scripted behavior AI too. "AI NPC" today means the character's words or plans come from a language model.

Sources

Checked 3 December 2026.

NVIDIA's March 2025 post announces the NARAKA date in advance. We did not confirm from NetEase's own pages that the feature shipped that day. NVIDIA's January 2025 post names more games with no release dates, so they are left out. The comparison table and the FAQ line about scripted behavior are our own wording.

Worlds you can play now

See every world on Yumina

More on how-to guides

Read next