I’ve started a dev blog for my thesis project, Quicksilver: Infinite Story, in hopes of explaining what it’s about and sharing some things that might be useful. So far I’ve written one post explaining what Quicksilver is, and another about computational storytelling. I’d appreciate any feedback about the direction or style of the dev blog – what would you like to see out of it? For the time being, I’m planning on updating every other Tuesday.
Quicksilver: Infinite Story is an action RPG inspired by animated adventure television shows, fusing the genre’s tropes and conventions into an unprecedented story generation engine to create unique new adventures every time you play. This past year, some classmates and I developed a prototype as part of the Advanced Game Project collaborations between the IMD and USC’s Gamepipe lab. For my thesis, I’m trying to reinvent the gameplay to mesh with the story generation system and take advantage of all the opportunities afforded by procedural narrative. Below, I’ve cross-posted the latest blog entry, about how to get a computer to write a story.
How Can a Computer Write a Story?
Quicksilver‘s main hook is creating a new story every time you play. That doesn’t mean it’s a sandbox where you read your own narrative into things, or a roguelike with random configurations of blocks and enemies. It means the game actually writes a whole new story – with a beginning, middle, and end, with plot twists and dramatic dialogue – every time you play. How are we pulling this off, when no game has done it before and even the techiest of academic efforts have had only mixed success? How did we get a computer program to write stories?
Computers are all about rules and procedures. If you want a computer to do something, you have to give it specific directions and definitions. So, to get a computer to write stories, you have to tell it what a story is, and how to make one.
What is a Story?
How do we define a story? People can tell stories without citing literary theory. Kids can tell stories. Stories are how we make sense of the world. We don’t usually need to think about what precisely goes into a story, unless we’re explaining it to, say, an alien or a computer.
On the most basic level, a story is some stuff that happened (or didn’t actually happen, if it’s fiction), and then is retold to an audience. But there’s more to it than that. You have to be selective about which happenings to include in your story. For example, if I just list everything that happened to me yesterday, is that a story? “I walked to the cabinet. I opened the cabinet. I saw a box of cereal. I lifted the box of cereal. I placed the box of cereal on the counter.” That not a story, that’s a bad walkthrough of the world’s most boring text adventure. Stories are supposed to be interesting. They’re supposed to have a point. But what makes a story interesting? What makes it a narrative, instead of just a bunch of stuff?
People have been telling stories since time immemorial, but most people credit Aristotle with being the first to lay out what goes into one: per Wikipedia, “A whole is what has a beginning and middle and end.” That’s a start! From that, we know that in the events of a story, conflicts and tribulations should be introduced, then resolved at the end. This line of literary theory evolved over the years to a structure most famously described by Gustav Freitag: the five-act dramatic arc, or “Freitag’s pyramid.” A story has to have an introduction, then rising action to a climax, then falling action to a conclusion. The intro has to give the audience the necessary info on the characters and setting, then the rising action builds tension and conflicts. The climax is the most exciting part where the main conflict comes to a head, and the falling action reveals its aftermath. Finally, the denouement ties up loose ends and lets the audience know how the story ends for all the characters. These are rules that most people use in their storytelling even without consciously considering them, but we have to lay them out specifically to give a computer rules to work with.
So now we can tell the computer to start by setting the stage, introducing a protagonist and an antagonist. Then, make some conflicts for the protagonist, introducing tension and uncertainty and generally ruining his/her day. But these conflict have to be resolvable in one exciting climactic scene, where the hero comes face to face with the source of the problems. Unless we want the story to be a downer, the hero should succeed, and then we should wrap up any hanging questions left from previous events, and end things happily ever after.
What Will We Tell Stories About?
Once we’ve got this outline of a story, we can ask the computer to start filling in the details. So, who should the protagonist be? A lawyer? A happy cat? A cyberpunk ninja with robot wings? The protagonist could be anything, wherein lies the problem. If our protagonist is a teen girl who longs to join the Space Brigade, and the antagonist is a grumpy turtle, and our main conflict is about tax evasion and the climax is an epee duel on the deck of a Portuguese galleon, chances are the story isn’t going to make a lick of sense – and it has to make (at least some) sense to be a narrative. To make matters worse, I wrote the previous example by just coming up with stuff off the top of my head, which is something a computer can’t do. There’s not (yet) a giant database of types of people and animals and events and causality and all the things we take for granted as common sense. You can’t ask a computer to give you, say, an event that might cause a conflict, without programming in every event that could possibly happen in the story.
That is, to say the least, a tremendous amount of work. Spending a lifetime entering minute data: “a person can be a teacher… a person can kick a bottle, but only with working legs… a cake is a type of dessert…” is equivalent to some definitions of hell, and when all you want to do is tell a nice story, the prospect of it can be like staring into the void.
So we’ve gotta narrow down which type of story we want to tell. Picking a genre will help, as will picking a reasonably small domain of character types and settings. If we’re doing a police drama set in the modern day, we don’t need to worry about spaceships or turtles or seafaring.
How Will It All Fit Together?
Still, there remains the question of how events fit together. Humans can intuit whether a series of events makes sense, whether the characters involved would be able to do them, and whether they’d introduce or resolve narrative tension. All this would all have to be programmed into a computer.
But maybe we don’t have to worry about how things connect logically, if we know that they connect according to the logic of storytelling. What if our rules about what makes a story are so solid that we know exactly what types of character, setting, and events will go into the story, when, and how they will connect? Then we could teach a computer that there are, say, 17 things that always appear in a story, and if each of those things fills a certain role, the story will make sense and have a point. We wouldn’t have to worry about whether the individual pieces fit together, or stress about the causality of events, because as long as each of those 17 things follows certain rules, it will work.
This style of piecing stories together is called a story morphology. The most famous of these is Joseph Campbell’s monomyth, or the “Hero’s Journey.” Campbell demonstrated that countless stories and myths across history had the same recurring formula, following a hero traveling through 17 stages. Certain characters archetypes – the hero, the supernatural guardian, the temptress – always appear at the same time and do the same things for the same reasons. The only things that change are the specifics: what those characters look like, their methods, and what exactly the hero is on a quest for.
The Hero’s Journey gives specific enough rules that you could program them into a computer, and give it a few options to fill in each of the specifics, and it would be able to automatically combine them and spit out the elements of a story. Sure, the stories would all follow the same formula, but it’s a formula that the most important stories of various world cultures all follow too. And at that point, is adherence to formula really a bad thing? Or is that, to get back to our original question, what makes it a story?
What Genre Are the Stories?
So to review, you can get a computer to put together stories with a morphology (the rules for what the pieces of the story are and how they fit together) and a domain (a set of choices for all the pieces). The variety of stories it can tell depends on how many pieces make up the morphology and how many choices are in the domain.
What morphology should we use? There aren’t exactly a plethora to choose from. There’s Campbell’s famous one, and there’s another influential one by Vladimir Propp about folklore. But these morphologies were designed to be general, to encompass a wide breadth of human storytelling. That means they can be a little vague, not helping much to specify a domain. If we shoot for a more specific type of story, it might help the narratives to be more focused and recognizably storylike, along with way less work. But to do that, we’d have to make our own morphology.
So What Genre is Quicksilver?
For Quicksilver, I chose to make a morphology based on the genre of animated adventure TV shows. There were three big reasons. First off, I didn’t want to tell timeless myths. I wanted to tell fun stories with lots of action that would work well in a video game. Second, these shows are divided cleanly into short episodes, so a program that could generate a single short episode would be enough to create the run of a whole series. Finally, there are tons of resources for someone looking to build a morphology of that genre, thanks to nostalgia and the collective knowledge of the Internet.
Most of my research took place at the notoriously time-consuming TV Tropes website. It’s a giant compendium of all the formulas and conventions that make up works in pop culture, notated with tons of examples to prove each one. It features hundreds of common plot structures, motifs, character archetypes, and more for various genres, but especially animated TV shows. For a kid looking to collect all the rules about how one of these shows is put together, it was the proverbial candy store. And as research goes, it’s more fun than reading tracts on narrative theory.
But even without research, it’s relatively easy to understand the formulas behind an episode of a Saturday morning cartoon. For the past forty years, networks have been churning out cartoons based on popular movies, video games, celebrities, or whatever focus groups thought kids would like. As a kid, I watched multiple cartoons based on Mario, multiple cartoons based on Sonic the Hedgehog, multiple cartoons featuring Mega Man, and multiple cartoons featuring Bo Jackson. These shows have obvious similarities, obvious templates and conventions that they had to follow. Every episode of these shows shared the core formula of hero meets villain, villain gets evil plan, hero beats villain. Oftentimes these plans would involve giant lasers or dark magic, and often, but not always, the villain would be snake-themed.
These shows are repetitive in a way that works especially well with a morphology. Take one possible narrative element: one of the heroes is captured by the bad guy. On most animated adventures, this would happen anywhere from a few times a season to pretty much every episode. Yet, these episodes weren’t the same story. It mattered who the villain was, how and why they captured the hero, and how things resolved in the end. Was the hero dragged off by an army, or did he mysteriously disappear after having an argument with his friends? Did the hero escape, or did his friends rescue him? Was there an overly elaborate deathtrap involved, or some kind of hypnotizing machine? If so, what kind, and how did the heroes defeat it and save their friend? The same plot motifs and ideas recur time and time again, always filling the same roles, but depending on how they’re combined they can make for drastically different stories.
So that’s how I wrote a computer program that can make up stories. The tricky part is getting it to tell the stories, especially when you want to tell them in the form of a well-crafted interactive narrative with crunchy gameplay and meaningful player agency. But that’s a different dev blog post. Or, pretty much all the dev blog posts.
Thanks for reading. I hope you found something interesting or useful. Please let me know if you have any feedback or suggestions.