The world’s most freakishly realistic text-generating A.I. just got gamified

What would an adventure game designed by the world’s most dangerous A.I. look like? A neuroscience grad student is here to help you find out.

Earlier this year, OpenAI, an A.I. startup once sponsored by Elon Musk, created a text-generating bot deemed too dangerous to ever release to the public. Called GPT-2, the algorithm was designed to generate text so humanlike that it could convincingly pass itself off as being written by a person. Feed it the start of a newspaper article, for instance, and it would dream up the rest, complete with imagined quotes. The results were a Turing Test tailor-made for the fake news-infused world of 2019.

Of course, like Hannibal Lecter, Heath Ledger’s Joker, or any other top-notch antagonist, it didn’t take GPT-2 too long to escape from its prison. Within months, a version of it had found its way online (you can try it out here.) Now it has formed the basis for a text adventure game created by Northwestern University neuroscience graduate student Nathan Whitmore. Building on the predictive neural network framework of GPT-2, GPT Adventure promises to rewrite itself every time it’s played. It’s a procedurally generated game experience in which players can do whatever they want within the confines of a world controlled by the fugitive A.I.

And you know what? Not since Sarah and John Connor teamed up with The Terminator to take on Skynet has the world’s most dangerous artificial intelligence been quite so much fun.

The game that rewrites itself

“GPT-2 is basically an extremely powerful predictive text algorithm,” Whitmore told Digital Trends. “You give it some text and it tries to predict what comes next. This is really well-suited to text adventure games. You can feed in the player’s current location and their action — [for example], ‘go east’ — and then you just ask GPT-2 to predict what text comes next, which is the consequence of that action. Then the player makes another action, and you have a game.”

gpt adventure text based game openai 2

In GPT Adventure, the text world of the game is generated by the predictive GPT-2. That means that, instead of programming a collection of rooms and monsters in advance, the game starts your character in a location and then uses A.I. to figure out what happens next.

To turn GPT-2 into the world’s most dangerous Dungeon Master, Whitmore started out by collecting transcripts of users playing Zork and Colossal Cave Adventure. These text-based adventure games were created in the mid-1970s, originally for Digital Equipment Corporation’s PDP-10 mainframe, a computer about the size of a refrigerator, and considerably less powerful than the devices most of us carry around in our pockets. He was inspired by Mind Game, a fictitious game that’s generated in real-time by artificial intelligence in Orson Scott Card’s sci-fi novel Ender’s Game.

“[To create the game, I had to] train GPT-2 to produce text that looks like the game transcripts,” Whitmore continued. “This is done using algorithms that automatically adjust GPT-2’s internal parameters until the text it produces looks like the text from the text adventures. This lets GPT-2 learn the mechanics of text adventure games; things like ‘If the player says look east, describe an object to the east of them.’”

“You give it some text and it tries to predict what comes next.”

The resulting game looks and plays a lot like the decades-old text adventure games it is modeled on, with the same basic elements and gameplay mechanics. Whitmore acknowledges that he had to make a few tweaks along the way. “Even with this, GPT-2 sometimes makes mistakes like forgetting where the player is,” he said. “So there’s also some manually written code that tries to correct the more common kinds of mistakes and make the game more playable.”

On the face of it, the resulting game is simplistic. It’ll play in your browser (you can follow the simple instructions to get it started here) and, unlike Ender’s Game’s Mind Game, there are no graphics. Whitmore said, “I did play around with using this neural network to automatically generate images based on the place descriptions which yielded some weird results.” However, these are not a part of the finished product.

But is it creative?

GPT Adventure is good fun, albeit full of the strange flourishes that occur when people use A.I. to generate new scripts for, say, one of J.D.’s monologues from Scrubs or a chapter from a new Game of Thrones novel. If you’re familiar with the source games, you can begin to see where some of the ideas and concepts have been lifted from and mashed together in strange new ways.

gpt adventure text based game openai 2 example
Click to enlarge

Really, though, it hints at something amazing: Another piece of evidence that machines can, to some degree, display creativity. While logic doesn’t always apply, players can type any command into the game and, in many cases, it will oblige and try to come up with whatever step follows next.

“From a gameplay perspective, the cool thing is it can be totally open-ended and you can do basically anything you want,” Whitmore said. “I tried a version of it where you’re exploring a space station instead of a cave. I can say ‘>eat rock’ or ‘>ride sheep’ and the game will just go with it and try to figure out what should happen next. You can do all this weird stuff that no-one would ever bother to program because the GPT-2 model has enough ‘common sense’ knowledge to roll with it in a believable way.”

“You can do all this weird stuff that no-one would ever bother to program because the GPT-2 model has enough ‘common sense’ knowledge to roll with it in a believable way.”

Would he say that it’s creative? “I think it’s creative in a very basic way, like how a person playing ‘Apples to Apples’ is creative,” Whitmore continued. “It’s taking things from old adventure games and rearranging them into something that’s new and interesting and different every time. But it’s not actually generating an overall plot or overarching idea. There are a lot of different kinds of creativity and I think it’s doing one: Generating novel environments, but not the other kinds: Figuring out an intriguing plot for a game.”

A step in the right direction

Ultimately, just as text adventure games were just one step in the process that led to today’s cutting-edge 3D games (and will continue on from there), so GPT Adventure is just another data point in the advance of A.I. But it’s a pretty darn exciting data point — and, as Whitmore notes, the fact that such tools are now publicly available makes things all the more fun.

“One of the really cool things about this is that there are public tools like GPT-2-simple and Google Colaboratory (read: Google’s Jupyter notebook environment which runs programs in the cloud and stores its notebooks on Google Drive) that make it really easy to do these kinds of creative things with A.I.”

Anyone want to guess where things go from here? Heck, if the Simulation Hypothesis is true, maybe we’re all in a big A.I.-generated adventure game already…

Editors' Recommendations

Barnes & Noble Nook