Adding Inworld AI Characters to an Existing Game, Part 2: First Words

Adding Inworld AI Characters to an Existing Game, Part 2: First Words

(originally published at https://medium.com/@jschomay/adding-inworld-ai-characters-to-an-existing-game-part-2-first-words-baf250e0307f)

After considering some implications of adding AI NPC’s to an existing game in my previous article, I have taken the first timid steps into creating my first character in Inworld. I want to share the experience, because it was strangely visceral, magical, and unexpected at the same time and made me think things I didn’t realize would come up.

This isn’t my first foray into AI character creation. I’ve played around at a low level with building templated prompts by hand to feed to GPT3 in order to get a rich and meaningful narration of a character action from player input. But Inworld has a very nice suite of tools for defining your character and its world that feels more like character building and world building than LLM prompt engineering.

I want to be clear that what I have done so far is extremely shallow, only the bare minimum of character creation, and the very beginning of what I expect will be a long road of tweaking and testing. Inworld keeps rolling out new advanced features that I can’t wait to dig into, but even at this early state, my experience felt worth sharing, so here it is.

Meet Carl

The game that I am adding AI characters to is called “Deadline.” It is a narrative-heavy game set in a fictional subway system where players help the protagonist, Steve, get to work on time to deliver a job-defining presentation, except that on this day, the subway is going haywire and Steve’s world is falling apart around him.

You can play the original version online if you’d like.

Carl’s first line

Carl’s first (scripted) words

In the very first scene, the player finds a small handful of characters and items to interact with, including the “Coffee cart” where Carl works. Carl is likely to be one of the first characters that players interact with.

Carl plays a very small role in the game, serving as a way to introduce players to the UI and basic mechanics. They learn that sometimes interacting with things give you inventory items (the ubiquitous to-go cup of hot coffee in this case). But more importantly, they get a very subtle introduction to Steve, the character they will be guiding around the subway for the next hour or so. They get a hint that Steve is a man of routine, and an idea of his financial position in the world, and that he likes order, rules, and efficiency.

Carl also introduces the plot and provides some foreshadowing. Over the course of the first few days that make up the introduction / tutorial scene of the game, Carl is a regular, and his energizing brew dispensing makes a natural conversation starter around Steve’s growing loss of sleep and mounting stress as he prepares for his high-stakes and overwhelming presentation levied by his arrogant boss. And then, (minor spoiler here), just when Steve needs Carl’s friendly encouragement the most, he’s gone, replaced by an irreverent teen who could care less about Steve’s troubles. If the player clicks on the coffee cart again after this unpleasant exchange, Steve just says “I miss Carl.” And hopefully, so does the player, but there’s no time to lament, because Carl’s absence is only the first indicator of everything that is about to go wrong.

“I miss Carl.”

Why Carl?

I chose Carl as the first character to get the Inworld treatment, for a number of reasons. First and foremost, I wanted to start simple. Carl is a simple character with a restricted personality and motivations (which I later realized might have actually made things trickier) and he goes away after the first scene.

Also, Carl is the perfect tutorial character to get the player used to talking to AI characters with limitless AI generated content, since he shows up immediately, and doesn’t risk impacting the plot by going off script too much (which again I realized later was a false assumption).

Also, as far as Inworld’s internal state is concerned, Carl isn’t exposed to much knowledge in the knowledge base, and isn’t affected by goals or scene triggers or the other more advanced Inworld options. That said, I do intend to use Carl to experiment with these options later, like making him aware of which day of the week it is, and become more concerned and sympathetic over Steve’s growing loss of sleep.

Meet Carl. Again.

After filling out all of the basic information that Inform uses to personalize characters, Carl 2.0 was ready for his first words. While the ultimate plan is to integrate a UI in the game to converse with AI characters seamlessly along side of the scripted content, for now I just used Inworld’s in-studio character testing chat window.

Carl is about to start talking for himself. Would he talk like how I imagined? Would I like him?

But before I hit that button, I experienced a surreal thrill of anticipation. I was about to actually talk with a character that had only lived in my head for years. I had written every line of dialog he has ever said up to this point. And now he is about to start talking for himself. Would he talk like how I imagined? Would I like him? It was thrilling. And also a little frightening.

And there was one more important question: what should be my own first words to him? In a display of spectacular timidness and unoriginal thinking, I went with the first words I wrote for Steve so many years ago:

Wow.

How was it? It was both good and bad, magical and frustrating. But the first thing I noticed hit me like a brick. Do you see it?

He didn’t say “Sure thing, Steve.” He said “Sure thing, Jeff!”

I’m Jeff. Obviously, Inworld knows my user name and uses templated variables to inject the player’s name in the dialog. But Carl doesn’t know that! All these years I have almost heard Carl’s voice, saying “Sure thing, Steve,” but now Carl is talking to me. Carl’s first words were directed to me.

Carl doesn’t live inside my game any more.

OK, once I got past that, the second line is interesting too, because it came directly out of the example dialog that I gave to Inworld. Very in character, but not original. But then, Carl immediately overcompensated:

Carl getting too creative, making up plot details about train schedule changes

Carl instantly getting too creative with his new found freedom

Here’s the thing, the train schedule most certainly did not change, and worse, later on the player learns that Steve’s train actually leaves at 6:30 AM and a ticking clock becomes a central piece of the plot as Steve races to get to work on time to give the presentation.

AI hallucinations like this can be nice for giving flavor and depth to the world, but detrimental in strongly plotted context. This is one of the biggest challenges in introducing generated content. In my earlier article I brought up this concern. I know that Inworld and the rest of the AI industry is working on issues like this, but for now we have to find ways to make it work.

I conversed a little more after that, but Carl got very chatty and, to my ear, sounded very “on the nose,” which is something I feel I notice in a lot of AI generated content. He also spouted some more untruths, saying, “This is the busiest station around,” when it actually is designed to be one of the more quiet stations away from the larger downtown ones that the player will arrive at next.

Tweak Time

While I wasn’t pleased with how “Carl” turned out, I was very aware that the real work was just beginning, the work of tweaking Carl’s textual DNA. Despite how far generative AI technology has come recently, we still are at a point where changing one word in a prompt can have drastic results, which is true in LLMs like Inworld’s models as well as other media like the contortions resorted to in Midjourney prompts (like this mouthful: “trending on artstation, high detail, high definition, high quality, photo-realistic, ultra realistic, hyper-realistic, 4k”).

For the second attempt, I removed the “knowledge of the train schedule” fact that I had first put in, and I changed a few of the personality and motivation fields to make Carl more terse and more likely to ask questions or engage in short small talk. There’s more to do, but the results are already better, and AI Carl sounds more like good ol’ Carl, though I’m still not sure what to say to him, or what players will want to say.

More examples of Carl’s tweaked lines, which now sound like small talk with no hallucinations

I have to admit, I didn’t quite get the joke, but I was amused nonetheless. This dialog mostly feels consistent with the picture I’ve had of Carl in my head all along.

Takeaways and Next Steps

I really enjoyed this experience of bringing my first character to life and hearing his first words. For me, the whole thing felt like as if you’ve ever imagined an upcoming conversation you were going to have, and played it over and over in your head, but then when it really happened it went nothing like what you imagined.

Adding AI to an existing character feels like learning to let go of a child, and having faith they’ll do well on their own.

Carl is just the beginning. I still have to integrate him into the game’s UI and experiment with the more advanced options. And then it will be time to pick a more challenging character, and go through this whole process again. To meet my other characters, again, for the first time.

Did you find this article valuable?

Support Jeff Schomay on Games, Narrative and AI by becoming a sponsor. Any amount is appreciated!