Conversational AI NPCs for games
Build a talking NPC with a persona, voice and game-world knowledge. Connect scene context and permitted Blueprint actions so players can converse with the character.
Dialogue trees have a hard ceiling: the player can only ask what a writer thought of. An IAMX NPC has a persona, a memory, knowledge of your world and a set of things it is allowed to do, so the player can ask anything and the answer stays in character. You set the character up in IAMX Studio and connect it to your Unreal project with one component.
What an IAMX NPC can do that a scripted one can't
| Capability | What it means in your game |
|---|---|
| Unscripted conversation | The player speaks or types anything. The NPC answers in character, in its own voice, with lip sync. |
| Scene awareness | The NPC knows what you told it is around it. "What's that on the table?" gets a real answer because the objects you registered are described to it. |
| Movement decisions | It can decide to walk somewhere, follow the player, stop or wait because the conversation called for it. Your Blueprint carries out the movement. |
| Gestures | It picks gestures such as wave, nod or point to match what it says, and your montages play them. |
| Your own actions | Anything you expose from Blueprint: open a door, hand over an item, start a quest, sound an alarm. |
| NPC-to-NPC | Start Npc Conversation passes each reply of one IAMX component to another as its next input. With cloud characters both share one session, so one character answers every line; see NPCs that talk to each other. |
| Memory | With memory on, it remembers each player between sessions: what they did, what they promised, what they were told last time. |
| Lore that stays consistent | Your world bible goes in the knowledge base, so the NPC quotes your canon instead of inventing it. |
Set up the character in IAMX Studio
There is no game-specific template in the cloud studio. New character on the Characters page creates a draft at once and opens the editor on Templates, where you pick a look. Then set it up for a game:
- Write who it is: on Identity, fill in Name, Role, Background / Persona and Conversation Style.
- Keep answers short: on Mind & knowledge › Core AI, pick the model and set Max Tokens (per response) under Generation Settings.
- Pick a fast voice: on Language & voice › Language & Voice, choose the voice and a fast TTS Model.
- Turn on the game switches: on Identity & model › Model settings › UE Plugin Settings, switch on Game Actions (MoveTo / Follow / …) and Conversational Gestures as needed.
- Save: press Save in the editor toolbar. The settings apply from the next session.
Making it aware of the world
The two switches on UE Plugin Settings give the language model ready-made tools:
- Game Actions (MoveTo / Follow / …): move to, follow, stop moving and wait. "Wait here, I'll be back" becomes something it can do. Each call arrives in Unreal as an event with the target's name and, when you registered it as a scene object, the actor itself. Your Blueprint moves the character.
- Conversational Gestures: it chooses gestures while speaking. Map gesture names to montages in the component's Gesture Montages, or handle the
On Gestureevent.
Then, from Blueprint, tell it what is around it. Register the objects and characters you want it to know about, a name and a short description each, with Register Scene Object or Register Scene Actor. Those become things it can talk about and target. Register them once the session has started: the Blueprint API page shows the event to use.
Scene objects you register: "Tavern door" — heavy oak door, leads to the street "Bruno" — the blacksmith, working at the anvil "Locked chest" — iron chest by the fireplace, no key in sight
The NPC can now answer "who's that by the anvil?", walk to the door when it says it's leaving, and refuse to open the chest because it hasn't got the key.
Letting it run your game logic
This is the part that turns conversation into gameplay. You define an action with Register Action or in the component's Local Action Tools, for example give_quest, open_gate or hand_over_item, with a description of when to use it. The NPC decides to call it mid-conversation and your Blueprint runs.
- Define the action and describe it the way you'd brief an actor: "Use this when the player agrees to help find the missing shipment."
- Handle the event: bind
On Action Receivedand branch on the action name, then start the quest, spawn the marker or play the cutscene. - Test with an oblique request. Don't say "give me the quest"; say "alright, I'll look into it" and check that it fires. That is what players will actually say.
NPCs that talk to each other
Start Npc Conversation links two IAMX components for an exchange. Call it on one component with the other component, a Topic and Max Turns (default 6, from 1 to 50). The first component sends the topic as its text input; after that, each complete reply is sent to the other component as its input. The exchange ends after at most Max Turns replies, when you call Stop Npc Conversation, or when text is sent to either component with Send Text Input or the built-in chat; that component then answers the text. The node does nothing if the other component is the same one or either one is already in an exchange.
For an exchange between cloud characters, this means both components use the same session: the topic and every handed-on line go to the character of the component that began play last, that character answers every line, and each reply reaches both NPCs. In one game instance the node does not give you two cloud characters that each answer with their own persona and voice.
Quests and story structure
For an NPC that has to move a story forward rather than just chat, write the stages and what moves the player from one to the next into its Background / Persona. Keep the current stage up to date from Blueprint with Set Context Fact, for example Set Context Fact("quest_stage", "The player agreed to find the shipment"), and let actions report progress back to your game. The NPC improvises the words; the instructions and the facts keep it on mission.
Practical matters
Usage per NPC
Usage is counted per conversation turn, in quota units from your plan, not per NPC. Units are weighted, so heavier models and realtime voice use more per turn. An NPC nobody talks to uses none, and each line of an NPC-to-NPC exchange is a turn. Use the lightest model that holds character: for most NPCs a small fast model is not just adequate but better, because waiting is what breaks immersion. See plans & quota.
| NPC type | Suggested setup |
|---|---|
| Ambient villager | Small fast model, a higher temperature, short replies, no actions |
| Quest giver | Small fast model, the quest stages in its persona, your Blueprint actions registered |
| Companion who remembers you | Mid-tier model, Long-term Memory enabled with a longer Retention Period (days) |
| Central story character | Flagship model, world lore in the knowledge base, actions and tools attached |
CloudSpeakerId to a stable value per player, so each player gets their own memory instead of sharing default-user.Latency
Three settings decide how alive an NPC feels, and none of them is the model's intelligence:
- Voice model: pick a fast one. For ElevenLabs, the studio recommends Flash v2.5 for a live NPC, which brings the wait before speech from about 500 ms to 75 ms.
- Answer length: shorter answers start playing sooner and end sooner.
- Interruption: let the player cut the NPC off. Keep Interrupt (on new input) on in UE Plugin Settings.
Keeping it in character
Use Behavior › Guardrails (Enable guardrails, then write the Rules) to stop the illusion breaking: no discussing the real world, no admitting to being an AI, no answering questions this character could not possibly know. A medieval blacksmith explaining machine learning ends the immersion instantly.
Getting started
- Install the plugin in your project.
- Create a character in IAMX Studio, write its persona on Identity, and turn on the UE Plugin Settings you need.
- Copy its Character ID from Channels › Publish and create an API key on My workspace › API Keys.
- Add the IAMX component to your NPC Blueprint and enter the connection settings. Set its Interaction Mode to Proximity if the conversation should start when the player walks up.
- Add the three animation nodes so it lip syncs and looks at the player.
- Press Play and talk to it. Then add scene objects, actions and lore.