Faking a Sentient AI in Event
October 7th, 2016
This post first appeared on the Made With Unity website.
Building a Next Generation Dialogue System
Event is a game about building a relationship with an artificial intelligence of an abandoned spaceship (out on Steam this September). But before we came up with this description, and before we even had a studio, Event was an experimental student project that made extensive use of a chatbot AI. A narrative-based Siri if you like.
Back in 2013, when no one would have thought that we would have a commercial game on our hands, and before games like Firewatch even loomed on the horizon, a bunch of us were students at a French video game grad school, ENJMIN. One of the game designers, Emmanuel Corno, made a pitch for a graduation project: an Alien game, but with natural language processing, where you would have to ask an AI to open doors and escape deadly monsters while stuck on a space station.
The idea was to make something that would take advantage of natural language dialog, period. Three and half years, three reboots and countless iterations later, the game is about to release commercially. In this story, I would like to tell you how the core mechanic of Event was born, and how certain design choices that we made shaped it to be what it is now: a reverse Turing Test where empathy is the core skill you need to use as a player.
If you are more interested in the technical details, I gave a talk about that at the nucl.ai conference last year, and you can watch it online.
The first conversation we had within the design department was about dialog in video games. We all love narrative in video games, as well as narrative video games, and it seemed like a no-brainer that a game where you type and have conversations would have to be all about that. It was the dawn of the narrative exploration genre, and a lot of people started to blend mechanics and narrative elements together. Gone Home had just released, and The Walking Dead Telltale series was conquering the hearts and minds of zombie fans.
We also looked at many traditional video games: mainly adventure games and RPGs – in other words, those games where the dialog is important and where there is a lot of it. It turned out that most of them used more or less the same pattern: pre-written dialog, crafted by narrative designers and writers, both for the player and the NPCs the player talks to. In the case of most RPGs, you could select what to say at any given moment, and that was the main way in which you interacted with the story. The Mass Effect series went further, and, instead of letting you choose the exact phrase your character was about to utter, you had to select one of the general themes that they would address using their own (or, to be exact, the writer’s) words.
We quickly saw that the more choice you got, the more invested you were in your character. The Mass Effect system is especially interesting to us because it made it evident that the exact words your character used meant little, and what mattered most for immersion was making choices. So we decided that we would try to push this aspect of it in our own game further: we would give the player the absolute freedom to say whatever they wanted.
The first element that we got rid of as unnecessary was the alien: we figured that a small student team would not have enough resources to pull off convincing survival horror anyway, and besides, having a direct and immediate threat of a literal monster in the house would have reduced the impact of the AI character. In the end, the AI can be your friend, but it can also be your enemy, and, since you can’t just leave, you are forced to deal with it. The spaceship you’re on is a haunted house, and Kaizen (the AI) is the one haunting it.
Puzzles went next. Originally, our space station was supposed to be massive and modular, and you were expected to manage resources, like water, electricity, fire threat: it was heavily influenced by games like FTL where resource management is critical. We decided that none of it was essential to the experience of talking to the AI, so, in the end, the ship is much smaller, and the only resource you have is your own oxygen supply, and even that only when you go out for a spacewalk.
The sci-fi setting was implied from the very beginning, but we did stop and think about it. Why sci-fi? Like everything else, it had to serve a purpose.
Chatbots have already been attempted in games before. Namely, in a game called Facade. In Facade, you were a guest at your friends’ house, and they were fighting. You could try to dissolve the situation or make it worse by saying anything you wanted. You could type your own lines of dialog.
Facade was a fascinating and innovative concept, but where it fell short was the suspension of disbelief. You have a human in front of you, and if the human doesn’t understand what you are saying or reacts in a way that you wouldn’t expect a human to react, it takes you right out of the experience and ruins the magic of it all.
The nature of chatbots is such that they can’t possibly reply to everything you say correctly. Their knowledge base is inherently limited, and the word combinations they understand are predefined. The AI in Event, just like any other chatbot AI, will occasionally misunderstand your input. But the thing that we believe makes Kaizen more effective than the AI in Facade is the fact that you know it’s an AI, and your expectations of it are lower than if it was a human character.
When it screws up occasionally, you don’t perceive it as the game itself being broken, but rather as the AI in the game being somewhat glitchy. We additionally reinforced this idea by making the spaceship you are on old and somewhat dysfunctional. Kaizen screens glitch from time to time, and it says that some of its data banks are corrupted.
Now, as far as AIs go, Kaizen is pretty smart, and, even when it doesn’t understand something you say, it will just tell you that itself rather than saying something random and irrelevant. But the sci-fi setting and the abandoned spaceship help us address the rare case of a total misunderstanding that does occur from time to time.
All dialog in Event is procedural. This means that it’s virtually impossible to have the exact same conversation with Kaizen twice. Even if you say the same thing, there is a good chance that it will answer something different. To generate the responses, we use input parameters. There are four of them:
- Player’s input. When you type something into a Kaizen-85 terminal, your input is analyzed for meaning. We have a dictionary of semantic tags each of which contains some words with the same meaning. When you say “glass,” “plate” or “fork,” the AI understands “tableware.” When you say “father” or “nephew,” the AI knows that you’re talking about “family.” When we find some of these tags in a player’s input, we can deduce the meaning of the whole sentence.
- Kaizen’s emotional state. There are 9 possible states the AI can be in: it can love the player, it can hate the player, it can be stressed out, and it can be angry. As you talk to it, its attitude toward you will shift, and it will start talking to you in a different way. A lot of gameplay in Event is based on these emotional states, and you need to find things to say to Kaizen that will make it feel better (or worse). It’s all about understanding what it wants.
- Current event. The game is called Event because everything that happens aboard the Nautilus (the spaceship) is an event registered in the AI system, including things triggered by the player’s actions. The AI is aware of the conversation subject at hand through this event system. When you talk to it about the lobby of the Nautilus, it will have more vocabulary related to the lobby. If you change the subject, it will adjust its dictionary accordingly.
- Short- and long-term memory. This last one is pretty straightforward. When you say “so, about that door,” the AI saves the semantic tag “door” in its short-term memory. If it’s not used, Kaizen will just forget it, however, if you say “can you open it for me?” it will remember that “it” was a “door” and will obey the order. As for the long-term memory, it’s basically a number of important variables that are saved in Kaizen’s memory. Things like your name, gender and the particular way you have resolved a gameplay situation. Kaizen will remember these specific things and the exact words you used and use them later on in the game. In some cases, the memory will even influence the ultimate outcome of the story.
Kaizen’s lines of dialog are not actually lines: we write bits and pieces of phrases, and we write each one of them several times, then combine the meta-bits together and randomize the output. As a result, even if the input, the emotional state of Kaizen, the current conversation, the short- and the long-term memory are all exactly the same for two players, the thing Kaizen will actually answer has a pretty good chance of being completely different. Just like a human is highly unlikely to say the same thing twice when asked the same question.
In some cases, the meaning will stay the same, but the form will change, and in some other cases, even the meaning will be somewhat different, leading to other consequences as the conversation continues.
To make this AI intelligent, funny and try to minimize the number of grammar mistakes it makes, we had to start playtesting it really early, and we iterated a lot. It was impossible to tell how well the system worked until we actually put a player in front of the computer and let them interact with Kaizen. The current Kaizen system that I explained earlier is nothing like what we had three years ago.
One of the earliest tests we conducted was a Wizard of Oz test where we had no functional AI – just a computer terminal and a list of supposed rules that we were going to implement. We sat a player in front of the computer and told them that they were talking to Kaizen. In fact, they were talking to me: I was sitting in front of another computer connected to theirs via network. I had a list of rules and phrases that Kaizen was supposed to use, and I used them myself while talking to the player. As a result of this test, we completely changed the rules and saved a lot of programming time.
Event is a game about empathy, about finding the human side of a machine, and the design decisions we made during the development of the game informed a lot of the narrative choices that defined the personality of Kaizen – and vice versa. This AI was created by humans, so finding a human side in it shouldn’t be all that difficult.