Chatbots: Thank you, Roger Wilco!

It’s no great secret that our current exploration of chatbot technology is merely a short step on the long road of conversational interfaces. From the humble cassette-based voicemail machine to Microsoft’s socially challenged twitterbot Tay, automation of human communication has always been a powerful — and sometimes entertaining — enterprise.

Early video games capitalized on both of these features. My first experience with a computer game was with Colossal Cave Adventure, a simple text-based game of exploration and discovery. There was no on-screen visualization of the world in which you traveled — Adventure painted pictures in prose and expected you to respond in kind. “You’re at the edge of a forest with a path to the north, and your farm is behind you to the south.” Go north! “You’re in a forest….” The interface was simple and effective, and the resulting experience was powerful enough to inspire entire genres of other games.

Co
Colossal Cave Adventure

Other games explored different conversation systems. In the heart of the Ultima series, you could chat with any in-game character that wasn’t trying to kill you. Friendly characters might say hi and prompt you to respond, but otherwise, you were left to your own guesswork on how to continue. You quickly learn to ask everyone about their “Job”, and that they will not stop talking to you unless you politely say “Bye”. Each character could respond to a certain subset of topics, some of which would present themselves clearly in conversation, while others must be inferred from your growing knowledge of the world.

Ultima: Martian Dreams
Ultima: Martian Dreams

The true masters of the conversational game lived at Sierra On-Line. Creators of the famous King’s Quest, Space Quest, and Leisure Suit Larry series, Sierra games were conversational from the very beginning. Walk your character up to a locker and “Look at the locker” — why, the locker is closed! “Ok, open the locker” A bottle of shampoo drops to the floor. “Take the shampoo” You’re half ready for your shower!

Space Quest 2
Space Quest 2


Every time you popped a new Sierra game into your high-end, double density floppy drive, you immediately began to test the edges of its language skills. Weird requests, curse words, innuendo…it was fun to explore what a computer could and could not understand. No strangers to humor, the authors at Sierra anticipated a great deal of this behavior, resulting in a bevy of appropriate easter egg responses. “Take leak” was always good for a giggle, even when no onions were around.

Sierra managed to build conversational engines in 1980 that not only spawned a decade’s worth of hit games, but also predicted much of the technology we currently leverage for creating bots. Let’s take a look at how they implemented some modern concepts in AGI (the Adventure Game Interpreter) 36 years ago, and see how it stacks up against SuperScript, a modern bot development platform.

Topics

When building chatbots, related parts of a conversation get organized into topics. There’s no jumping from subject to subject without a specific transition, just like there shouldn’t be in a sane and sober human conversation.

In SuperScript, topics are separate scripts that contain a collection of related “gambits” — conversational pairs of user requests and bot responses. To change the scope of the conversation, a gambit must redirect the user to a separate topic. Talking about Robot Wars? Say “I’m tired of robots. Can we talk about Full House instead?” and a smart script will take you a new — and less interesting — topic.

> topic:keep old_games (games, non-millenials)//Provide a clue if we don't understand the request
+ *
- I hear you like old games - have you tried Leisure Suit Larry?//Give a simple response if they're fans
+ * (like|love) Leisure Suit Larry*
- Careful, he might love you back!//If they profess a love for a lesser game, respond with some snark,
//then send them to a topic that might be more appropriate for them
+ * (like|love) Pokemon*
- Uhm...yeah, sure, that's an old game.  (cough).  
^topicRedirect(millenials)
< topic

In AGI, scope is defined by a more “physical” boundary: the room that your character currently occupies. Each room carries its own set of definitions, gambits, and other scripts. If you try to “light the stove” in the bathroom, AGI won’t know what you’re talking about, but in the kitchen you’ll see little red pixels of fire spring up. Global scripts and gambits can be #included in any room, giving authors the flexibility to share data and conversations between rooms.

To change scope, simply walk your character into a different room.

//woods.txt
if(said('take', 'mushroom')) {
    print('You pluck a mushroom from the rotten log');
}//basement.txt
if(said('take', 'mushroom')) {
    print('You brace the window to prevent the purple elephant from flying into your cerebellum and stealing your Cheetos');
}

Triggers

Every time a user sends a request, it gets checked against a series of triggers. When the request matches a trigger, the response associated with that trigger is returned. These pairs are called gambits. They’re the guts of a good chat system.

In SuperScript, triggers are complex, powerful things. They can range from simple exact matches:

+ Hi there!
- Hello!

to wildcard matches:

+ What do you think of *?
- I love <cap>!

to full-blown, natural-language-tool-fueled, english-degree-justifying structures:

+ Why is my ENTY:animal <verb> a <noun> at me?
- Maybe if you remembered to feed it from time to time this wouldn't be a problem....

Even more, you can make rough conceptual matches using the built in WordNet english language lexicon:

+ Is a ~canine a doge? #(matches dog, canine, dalmation, etc.)
- <cap> is SO doge!  Wow!

This is where modern technology has left AGI well behind. Just including the WordNet database would have caused the original King’s Quest to take up at least 35 floppy disks, and you would have had to load and empty your system’s memory 88 times in order to read it all. We won’t even discuss the impossibility of the increased processing power required.

However, AGI did have a limited, yet clever, strategy for performing simplistic NLP. Games were distributed with a WORDS.TOK file that acted like a manually generated WordNet conceptual matcher. For each word you wanted to use in your trigger (“counter”), you could add a group of matching words (“countertop”, “cabinet”, “shelf”, “island”).

In an actual “gambit”, the string() function was used to find word matches inside the input. string(“get”, “knife”, “counter”) would then match “Get the cleaver off the island”, “Take the blade from the shelf”, and maybe even “Grab the stabbystabber from the boxtopthing.”

// WORDS.TOK
bae | smh | yolo | fleek => millennial
// grade_school.txt
if(string('say', 'millennial')) {
    print("I didn't understand a word you just said...");
}

What’s more, AGI was a full-fledged scripting language, so it could even do things that would be difficult or impossible in SuperScript:

//political_convention.txt
#define has_head_trauma f100if(say('listen', 'debate')) {
   if(has_head_trauma) {
       print('This all makes total sense!');
   } else {
       print('Their lips are moving, but all that comes out ');
       print('is darkness and disappointment');
    }
}
if(say('bang', 'head', 'wall')) {
   set(has_head_trauma);
}

Responses

Language generation is an area that doesn’t seem to have progressed very well in 35 years. Replies in both SuperScript and AGI are simple systems that combine plain text with the occasional piece of captured data. SuperScript adds the ability to make replies bounce the user between topics, while AGI can take advantage of its full scripting capabilities to tweak responses.

//SuperScript
+ Hello
- Hi
- Don't you have anything better to do?
- I SAID HI! ^topic_redirect(grumpy_bot)//AGI
#define response 1
if(say('hello')) {
    if(equaln(response, 1)) {
        print('Hi');
    } else if(equaln(response, 2)) {
        print("Don't you have anything better to do?");
    } else {
        print("I give up.");
    }
    increment(response);
}

Where are we now?

After 1990, Sierra moved from text to simpler icon-based actions in order to make their games feel more approachable.

Space Quest 5
Space Quest 5

Sadly, the entire industry followed suit, and modern games gradually moved away from conversational interfaces. Open-ended inputs were traded for choose-your-own-adventure style canned text, and now have been further simplified with radial-style clickers.

Mass Effect
Mass Effect

Text-based games did live on past the heyday of AGI in some places, such as online Multi-User Dungeons (MUDs), although they, too, are a dying breed:

MUD
MUD

Even the prolific indie game community seems to shy away from conversational interfaces. There was one heroic effort to build a conversationally driven game in 2005 called Facade which was hailed as the “Future of video games”. That future never arrived.

Facade
Facade

However, thanks to the current Bot craze, momentum has returned to conversational interface design. As we gain understanding in how best to use and design such interfaces, and as we design better and more efficient tools, maybe an ambitions game developer will figure out how to realize a powerful, modern, chat-based game.

Or maybe I’ll just rebuild Colossal Cave Adventure in Dexter.