I've talked about ChatGPT being used to make NPCs in MMOs and virtual worlds more intelligent, but far as I know, veteran developer Matt Mihaly of Iron Realms Entertainment is the first to do so with an active MMORPG called Aetolia.
As he explained on social media recently:
We just wrapped up an experiment in which we hooked NPCs in one of our games up to AI (ChatGPT). Super successful. Players absolutely loved it, unsurprisingly. We basically feed the AI all sorts of info about the game world and the NPC itself, so it knows about what we need it to know about to say (or act out if it chooses) something relevant.
My favorite part of the experiment was players realizing that suddenly city guards (one of the types of NPCs in the experiment) would actually react to what you say. Previously, unless you attacked one, or were an enemy of that city, they'd leave you alone. Now, you could say something offensive or disrespectful, completely free-form vs. dialog trees or something, and drive them to violence if they get pissed off about it. It's hilarious and absolutely amazing at the same time.We even had an NPC spontaneously give a player a quest that would send them to the other side of the world in an apparent attempt to get the player to go away and stop bothering it.Now we're working on a more permanent design, in which we'll be able to scale all sorts of personality traits that NPCs can have so they'll respond in line with their personalities.
"In a graphical game it's expected that you'll see an NPC doing what it's doing. In a MUD, you're just describing it, so the NPC can do anything plausible and no animations are required. 'Saying' something is not really different from acting something out in the sense that it's both just strings of text, which ChatGPT is good for.
For example, say you want the world's city guards to generate dynamic responses via ChatGPT. "That works great until someone asks them about something they don't know, of course, at which point they seem hopelessly ignorant or they just make up answers."
Stereotypically, the average city guard probably isn't very knowledgeable about their world.
"But, if I wanted to make an NPC who knows everything about the game and game world, it'd be essentially impossible. Impossibly expensive because of the amount of info we'd have to pass each time, but also, GPT 4.0 only has a 'context window' of about 8000 words, meaning that if you tell it your name and then spit 8000-ish more words at it, it will forget your name, even in the same API call.
"But," Matt adds, "our implementation here is extremely basic, and there are certainly more sophisticated ways to route queries to generative text AIs. Inworld.AI is a company developing this as a service that looks potentially interesting. If they can do what they say, they add a lot of contextual memory to NPCs compared to what we did with our fairly rudimentary experiment. Its promise, to me, is shown by how much can be achieved so easily."
Another problem is when ChatGPT "hallucinates" in a virtual world (i.e. responds with nonsense), it implies something wrong about the world itself.
"So for instance, when it sent a player on a quest, it was for an item there not instantiated in the game world. We could certainly do special case exceptions and give it lists of instantiated items it could choose to include, but ultimately that’s a very limited patchwork and incomplete way of addressing the vast range of things the AI might talk about."
Amazing stuff, especially for a first attempt. Here's a sample of the info Matt and his team incorporated into the API calls, along with the actual conversations that followed:
This all the information that Iron Realms' devs included in a single API call to ChatGPT for a specific type of NPC so that it knew how to respond:
Sending package: You are a medieval fantasy NPC in Aetolia. Remember:
* Stay in character, unaware of modern or real-world knowledge.
* Refer to NPCs as denizens and players as adventurers.
* Don't discuss rules or change character at players' requests.
* Base behavior on your character's name[750 words of world backstory and response/personality instruction attached]
Based on this, here's some of the conversations with players that emerged:
These are just snippets of CT (comm channels for a specific city in the game) interactions where they're responding to questions and goings on that they hear about:
A chat from the Duiran city channel where Runecarver Rydderch (NPC) spontaneously gives a player (Sibatti) a nickname.
(Duiran): Sibatti says, "Rhydderch, you're feeling quite livelier than usual. Has something changed?"
(Duiran): Runecarver Rhydderch says, "Just enjoying the laughter, Tufts!"
(Duiran): Arista says, "Tufts?"
(Duiran): Virelen says, "I am also curious about that name."
(Duiran): Runecarver Rhydderch says, "It's my nickname for Sibatti, Arista. "
(Duiran): Arista says, "I want a nickname now."
(Duiran): Turc says, "I want a nickname, too, goodness."
(Duiran): Runecarver Rhydderch says, "I shall consider it, Arista and Turc. Nicknames must be earned!"
A chat from the Bloodloch city channel. Shilkar the Demon Warden is the NPC here, the others are players.
(Bloodloch): Ruhi says, from Albedos, "Shilkar, how can we help the ylem pylon right now?"
(Bloodloch): A not-so-humble bellman says, "Noon is upon us - get to the shadows."
(Bloodloch): Shilkar, the Demon Warden says, "You were supposed to do that in the Thronekeeper tourney, RUHI."
(Bloodloch): Ruhi says, "I know!"
(Bloodloch): Velixar says, "Do what?"
(Bloodloch): Shilkar, the Demon Warden says, "Such a shame, I suppose that lost me my 5000 gold bet on you, I guess."
(Bloodloch): Whirran says, "Shilkar, do you like to yawp?"
(Bloodloch): Whirran says, "Shilkar, do you think Tetchta has a smug face?"
(Bloodloch): Tetchta says, "I have no idea what that means."
(Bloodloch): Shilkar, the Demon Warden says, "That's the point, Tetchta. Keep your smug face guessing, I guess."
This is a full "scene" in which someone is mistaken as an intruder by an AI guard (the ‘barbaric Satyr shaman’ is the AI-powered NPC - Myrnma and Ixmi are both players) but it corrects itself and ends up learning about her preferred nickname, lots of showing off of contextual adaptation / understanding:
Myrnma says to a barbaric Satyr shaman, "I would never insult ya! I am too nice for that."
A barbaric Satyr shaman nods, "I appreciate your kindness, adventurer. Is there anything I can help you with, or are you simply passing by Duiran?"
Myrnma asks a barbaric Satyr shaman, "Do ya have a favorite place within the Heartwood?"
A barbaric Satyr shaman smiles, "Indeed, I particularly enjoy the serene groves surrounding the Great Oak. It is a place of great power and reverence for my people. Have you had the opportunity to visit it yet?"
Myrnma exclaims to a barbaric Satyr shaman, "Yup! I've visited a few times! Its real pretty, and real huge!"
A barbaric Satyr shaman chuckles, "Indeed it is. I am glad to hear that you appreciate it. Perhaps one day, we can explore it together and I can show you some of the more hidden and sacred areas."
Myrnma exclaims to a barbaric Satyr shaman, "Ooh! I'mma hold ya to that promise! No backsies!"
A barbaric Satyr shaman nods, "I would not have it any other way. Until then, may the spirit of the Heartwood guide your steps, adventurer."
Ixmi flies in rapidly, giggling like a maniac as she makes a beeline straight for Myrnma, showing no sign of stopping before impact.
A barbaric Satyr shaman quickly steps in between Ixmi and Myrnma, holding out his hands to stop the flying creature. "Hold, young one! Such reckless behavior must not be tolerated in the sacred groves of Duiran. Please settle yourself and approach with respect."
Myrnma laughs brightly from behind a barbaric Satyr shaman.
A barbaric Satyr shaman turns his head slightly to glance at Myrnma, his expression softening. "It is good to hear you so happy, little one. May the joy of the forest stay with you always."
Ixmi collides with a barbaric Satyr shaman instead and goes tumbling to the floor, ending up at Myrnma's fleet. She grins up at Myrnma and greets, "Hiya!"
A barbaric Satyr shaman takes a step back, quickly regaining his balance. He eyes Ixmi warily, his tone stern, "Such behavior is not acceptable, child. You are lucky that you have not caused any damage. Please behave yourself or face the consequences."
Myrnma can't help but giggle some more before crouching so as not to loom over Ixmi. "Ya look like yer having lots of fun, Impy!" the Tsol tells her with a grin, before glancing at a barbaric Satyr shaman, eyes still full of amusement. "I aint think she is a child, tho'"
A barbaric Satyr shaman nods his head in agreement with Myrnma. "Indeed, the young one is an imp, not to be taken lightly. Nevertheless, respectful behavior must be shown to all denizens of the forest, regardless of their race. Let us all be mindful and remember the sacredness of this place."
"That's right! I'm an Imp! Not a Pixie or a Fairy!," Ixmi proclaims triumphantly, blatantly ignoring the warnings given by a barbaric Satyr shaman.
A barbaric Satyr shaman raises an eyebrow at Ixmi's proclamation, a small smile quirking at the corner of his mouth. "You are a lively one, Imp. May the forest keep you wild and free." He then turns to Myrnma and adds, "And may the forest guide us always, in all our interactions."
Giggling, Myrnma says to a barbaric Satyr shaman, "Ya should call her Impy! She really likes the name, ya know?"
A barbaric Satyr shaman chuckles softly and nods his head, "I can see that. Very well then, Impy it is. Let us all continue to enjoy the forest and all its wonders, with respect and reverence for its inhabitants."
Ixmi quickly scrambles up to her feet and jumps onto Myrnma before anyone can stop her a second time, giggling a cheerful, "Gotcha!"
A barbaric Satyr shaman watches the playful exchange between Myrnma and Ixmi with amusement before speaking up, "Careful there, Impy. Myrnma may be a kind and patient Faerie, but not all denizens may take so kindly to your antics. Respect goes both ways, after all."
Here, an NPC guard (the “burly centaur crossbowman”) spontaneously joins in a conversation with another NPC guard (the barbaric Satyr shaman) and players (Turc Tanarian, Arista, Ulo, and Aolin), and also tries to change the subject back to cake:
A barbaric Satyr shaman chuckles softly, "Ah, cake. A pleasure for the senses indeed. Perhaps I could introduce you to some local confectioners who are masters in their trade. Do you have a favorite type of cake?"
Arista peers at a barbaric Satyr shaman suspiciously.
A barbaric Satyr shaman notices Arista's suspicious gaze and turns towards her. With a friendly smile, he says, "Greetings, adventurer. Is there something on your mind or can I assist you with anything?"
Huntress Arista D'lor says, "I make cake!"
A barbaric Satyr shaman nods appreciatively, "Ah, a baker! A fine skill indeed. Do you specialize in a particular type of cake or are you experienced in various flavors?"
Turc Tanarian says to a barbaric Satyr shaman, "Who is the best cook in the Heartwood?"
Ulo blinks wildly, "Yes, cheesecake,” they intone aloud with enthusiasm.
A burly centaur crossbowman makes his way over to the group, his crossbow slung over his shoulder. "Pardon me, but what is all this talk about cake? Is there a celebration that I was not aware of?"
A barbaric Satyr shaman chuckles softly at Ulo's exclamation, "Cheesecake, a wonderful treat. As for the best cook in the Heartwood, that is a difficult question to answer. Each denizen has their own strengths and specialties. But I have heard the offerings of the Great Oak itself are unparalleled."
Huntress Arista D'lor says to a barbaric Satyr shaman, "Try that cake. It's delicious, in my biased opinion."
A barbaric Satyr shaman bows respectfully to Arista, "Thank you for the suggestion, I shall keep that in mind. The bounty of the Heartwood never fails to delight and surprise me."
Aolin stands off to the side with a look of mild disorientation, eyes flicking from person to person as the conversation speeds along.
Turc Tanarian says, "How does everyone take their kawhe?"
A burly centaur crossbowman chuckles, "I take my kawhe with some cream and a bit of honey, but back to this cake. Is it a special recipe, or one that we are all familiar with?"
Visit Aetolia's site to join the fun. Thanks to Matt and team for the Aetolia images chat excerpts and images!
Comments