A Game Powered By 'GPT-2' AI, Can Rewrite Itself To Change Plot Accordingly

Traditionally, games played on computers have certain story plot in which the protagonist must follow from start to finish.

While game plots are not revealed to the gamers, they are actually programmed and hard coded to the game. But using AI, this traditional approach in games can be changed, as a Northwestern University neuroscience graduate student Nathan Whitmore has shown.

He created a game that is powered by GPT-2 text-generating AI.

According to OpenAI that created the AI, the algorithms in the AI were designed to generate text so human-like that it could convincingly pass itself off as being written by a person. What users need to do, is feed it a sentence or paragraph, and the AI will start creating a convincing story by dreaming it up.

The company that is backup up by Elon Musk, stated that the AI could create significant societal impacts, that even OpenAI is scared of

However, it didn't take long until developers started to develop projects based on this GPT-2 AI's open-source code. The first most notable, is the 'Talk to Transformer' AI that can write poems, recipes, news, and more.

And this time, Nathan Whitmore created an adventure game based on this AI.

Based on the GPT-2 AI's predictive neural network framework, the 'GPT2 Adventure' promises to rewrite itself every time it’s played.

The game looks essentially like a decades-old text adventure games, with the same basic elements and gameplay mechanics.

The quirk is that, the game can generate procedurally gaming experience in which players can do whatever they want within the confines of a world controlled by the AI. And it doesn't flow like a traditional narrative, since there's no beginning, middle and end to each scenario.

"GPT-2 is basically an extremely powerful predictive text algorithm."

"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."

GPT2 Adventure
GPT2 Adventure responds to gamers' interactions differently, and based on their previous commands

In other words, the collection of rooms and monsters in the GPT2 Adventure aren't created in advance, or hard coded on the software. Instead, the gamer starts their protagonist character in a location, where the AI will predict what's going happen next based on users' interaction.

To train the AI, Whitmore started out by collecting transcripts of users playing Zork: The Great Underground Empire, a game of the 1980s, and Colossal Cave Adventure, a game developed between 1975-1977.

These text-based adventure games were created originally for Digital Equipment Corporation’s PDP-10, a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. These computers were as big as a refrigerator, and considerably less powerful than the devices in the modern world.

Whitmore also said that he was inspired by Mind Game, a fictitious game that’s generated in real-time by AI 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. 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.’"

The resulting game is playable, despite some issues.

For example, the game is text-based only, with Whitmore saying that, “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.

Then there is the occasional hiccups where the AI that creates the plot, forgets the plot.

“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.”

Then there is the fact that the game is resource intensive, despite only text-based. This is why users must run it on Google's servers through its Colab service.

GPT2 Adventure
A snippet of the GPT2 Adventure text-based game

The game is simple and may not go as far as keeping gamers on the edge of their seat, especially in the era where cutting-edge 3D games thrive.

However, GPT2 Adventure is essentially showing how AIs can also flourish in games, where the technology is not only limited to powering NPCs (non-playable characters) or generating game environment, as it can also generate game plot and its story.

And this in turn, shows how machines to some degree, are able to display creativity, in a way that logic doesn't really apply.

According to Whitmore:

"From a gameplay perspective, the cool thing is it can be totally open-ended and you can do basically anything you want."

"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.”

Whitmore continued by saying that:

"I think it’s creative in a very basic way, like how a person playing ‘Apples to Apples’ is creative."

"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."