Forget Chess—the Real Challenge Is Teaching AI to Play D&D

Some artificial intelligence experts think role playing adventure games will help machines learn to be as clever as we are.
Dungeons  Dragons gear on a table
Dungeon Masters are good tests for artificial intelligence because they are are narrators who can improvise a story based on the play of the game. Photograph: David Kasnic/The New York Times/Redux

Fans of games like Dungeons & Dragons know that the fun comes, in part, from a creative Dungeon Master—an all-powerful narrator who follows a storyline but has free rein to improvise in response to players’ actions and the fate of the dice.

This kind of spontaneous yet coherent storytelling is extremely difficult for artificial intelligence, even as AI has mastered more constrained board games such as chess and Go. The best text-generating AI programs too often produce confused and disjointed prose. So some researchers view spontaneous storytelling as a good test of progress toward more intelligent machines.

An attempt to build an artificial Dungeon Master offers hope that machines able to improvise a good storyline might be built. In 2018, Lara Martin, a graduate student at Georgia Tech, was seeking a way for AI and a human to work together to develop a narrative and suggested Dungeons & Dragons as a vehicle for the challenge. “After a while, it hit me,” she says. “I go up to my adviser and say ‘We're basically proposing a Dungeon Master, aren't we?’ He paused for a bit, and said ‘Yeah, I guess we are!’”

Narratives produced by artificial intelligence offer a guide to where we are in the quest to create machines that are as clever as us. Martin says this would be more challenging than mastering a game like Go or poker because just about anything that can be imagined can happen in a game.

Since 2018, Martin has published work that outlines progress towards the goal of making an AI Dungeon Master. Her approach combines state-of-the-art machine learning algorithms with more old-fashioned rule-based features. Together this lets an AI system dream up different narratives while following the thread of a story consistently.

Martin’s latest work, presented at a conference held this month by the Association for the Advancement of Artificial Intelligence, describes a way for an algorithm to use the concept of “events,” consisting of a subject, verb, object, and other elements, in a coherent narrative. She trained the system on the storyline of such science fiction shows as Doctor Who, Futurama, and The X-Files. Then, when fed a snippet of text, it will identify events, and use them to shape a continuation of the plot churned out by a neural network. In another project, completed last year, Martin developed a way to guide a language model towards a particular event, such as two characters getting married.

Unfortunately, these systems still often get confused, and Martin doesn’t think they would make a good DM. “We're nowhere close to this being a reality yet,” she says.

Noah Smith, a professor at the University of Washington who specializes in AI and language, says Martin’s work reflects a growing interest in combining two different approaches to AI: machine learning and rule-based programs. And although he’s never played Dungeons & Dragons himself, Smith says creating a convincing Dungeon Master seems like a worthwhile challenge.

“Sometimes grand challenge goals are helpful in getting a lot of researchers moving in a single direction,” Smith says. “And some of what spins out is also useful in more practical applications.”

Maintaining a convincing narrative remains a fundamental and vexing problem with existing language algorithms.

Large neural networks trained to find statistical patterns in vast quantities of text scraped from the web have recently proven capable of generating convincing looking snippets of text. In February 2019, the AI company OpenAI developed a tool called GPT-2 capable of generating narratives in response to a short prompt. The output of GPT-2 could sometimes seem startlingly coherent and creative, but it also would inevitably produce weird gibberish.

Still, GPT-2 has been employed to develop a kind of Dungeon Master. In December 2019, Nick Walton, an undergraduate at Brigham Young University specializing in machine learning, created a text adventure game, AI Dungeon, using GPT-2 to generate open-ended scenarios.

Walton says he first played Dungeons & Dragons a few months before building AI Dungeon, and the board game was part of the inspiration. “One thing that's so cool about Dungeons & Dragons is that you can do anything, and the Dungeon Master can decide what happens as a result of that,” he says. “You can be so creative compared to other games.”

Playing AI Dungeon often feels more like a maddening improv session than a text adventure, because the algorithm veers off in bizarre directions and quickly loses the plot. Even so, Walton says more than 1.3 million people have played his game, some racking up more than 30 hours of gameplay. “There are definitely users who, like, this is their jam,” he says. “Like, this is what they've been waiting for.”

In fact, while players can currently donate money to AI Dungeon through Patreon, Walton says he recently decided that instead of joining a self-driving car startup he will turn AI Dungeon into a commercial effort.

New approaches, such as those outlined in Martin’s research, might help produce text adventure games or Dungeon Masters that are more coherent and compelling. But even if it were possible to build a perfectly convincing AI Dungeon Master, some experts caution that this certainly wouldn’t reflect true intelligence or mastery of language. That’s because these programs aren’t connecting the meaning of text to anything.

“The problem is that natural language processing is nowhere near extracting or manipulating meaning from text,” says Simone Teufel, a professor who works on AI and language at the University of Cambridge in the UK. “But it's easy to trick ourselves into thinking that something ‘intelligent’ is going on.”

In fact, Tuefel thinks the current infatuation with statistical, machine learning methods will ultimately result in disappointment. “The first wave of AI failed circa 1985 because it was naive and ambitious, and it didn't realize just how complex language and communication was,” she says. “The second wave of AI, right now, is soon going to fail because too much trickery and even self-trickery is used.”

Still, who knows, with D&D experiencing something of a renaissance thanks to Stranger Things-style 80s nostalgia, perhaps the game could even capture the public’s imagination as the next big challenge for AI.

Martin also hopes the effort might also reveal something about the way storytelling taps into elements of intelligence such as commonsense, embodiment, and imagination. “If we could create a convincing AI DM, it would tell us more about how we create and experience these worlds,” she says.

Anyone who’s reached for a 20-sided die as their character is attacked by a “displacer beast” or a “gelatinous cube” might just find an artificial Dungeon Master fun, especially if they're struggling to find enough people for a good quest.

More Great WIRED Stories