Decades-old ASCII adventure NetHack may hint at the future of AI

Machine learning models have already mastered Chess, Go, Atari games and more, but in order for it to ascend to the next level, researchers at Facebook intend for AI to take on a different kind of game: the notoriously difficult and infinitely complex NetHack.

“We wanted to construct what we think is the most accessible ‘grand challenge’ with this game. It won’t solve AI, but it will unlock pathways towards better AI,” said Facebook AI Research’s Edward Grefenstette. “Games are a good domain to find our assumptions about what makes machines intelligent and break them.”

You may not be familiar with NetHack, but it’s one of the most influential games of all time. You’re an adventurer in a fantasy world, delving through the increasingly dangerous depths of a dungeon that’s different every time. You must battle monsters, navigate traps and other hazards, and meanwhile stay on good terms with your god. It’s the first “roguelike” (after Rogue, its immediate and much simpler predecessor) and arguably still the best — almost certainly the hardest.

(It’s free, by the way, and you can download and play it on nearly any platform.)

Its simple ASCII graphics, using a g for a goblin, an @ for the player, lines and dots for the level’s architecture, and so on, belie its incredible complexity. Because Nethack, which made its debut in 1987, has been under active development ever since, with its shifting team of developers expanding its roster of objects and creatures, rules, and the countless, countless interactions between them all.

And this is part of what makes NetHack such a difficult and interesting challenge for AI: It’s so open-ended. Not only is the world different every time, but every object and creature can interact in new ways, most of them hand-coded over decades to cover every possible player choice.

NetHack with a tile-based graphics update – all the information is still available via text.

“Atari, Dota 2, StarCraft 2… the solutions we’ve had to make progress there are very interesting. NetHack just presents different challenges. You have to rely on human knowledge to play the game as a human,” said Grefenstette.

In these other games, there’s a more or less obvious strategy to winning. Of course it’s more complex in a game like Dota 2 than in an Atari 800 game, but the idea is the same — there are pieces the player controls, a game board of environment, and win conditions to pursue. That’s kind of the case in NetHack, but it’s weirder than that. For one thing, the game is different every time, and not just in the details.

“New dungeon, new world, new monsters and items, you don’t have a save point. If you make a mistake and die you don’t get a second shot. It’s a bit like real life,” said Grefenstette. “You have to learn from mistakes and come to new situations armed with that knowledge.”

Drinking a corrosive potion is a bad idea, of course, but what about throwing it at a monster? Coating your weapon with it? Pouring it on the lock of a treasure chest? Diluting it with water? We have intuitive ideas about these actions, but a game-playing AI doesn’t think the way we do.

The depth and complexity of the systems in NetHack are difficult to explain, but that diversity and difficulty make the game a perfect candidate for a competition, according to Grefenstette. “You have to rely on human knowledge to play the game,” he said.

People have been designing bots to play NetHack for many years that rely not on neural networks but decision trees as complex as the game itself. The team at Facebook Research hopes to engender a new approach by building a training environment that people can test machine learning-based game-playing algorithms on.

NetHack screens with labels showing what the AI is aware of.

The NetHack Learning Environment was actually put together last year, but the NetHack Challenge is only just now getting started. The NLE is basically a version of the game embedded in a dedicated computing environment that lets an AI interact with it through text commands (directions, actions like attack or quaff)

It’s a tempting target for ambitious AI designers. While games like StarCraft 2 may enjoy a higher profile in some ways, NetHack is legendary and the idea of building a model on completely different lines from those used to dominate other games is an interesting challenge.

It’s also, as Grefenstette explained, a more accessible one than many in the past. If you wanted to build an AI for StarCraft 2, you needed a lot of computing power available to run visual recognition engines on the imagery from the game. But in this case the entire game is transmitted via text, making it extremely efficient to work with. It can be played thousands of times faster than any human could with even the most basic computing setup. That leaves the challenge wide open to individuals and groups who don’t have access to the kind of high-power setups necessary to power other machine learning methods.

“We wanted to create a research environment that had a lot of challenges for the AI community, but not restrict it to only large academic labs,” he said.

For the next few months, NLE will be available for people to test on, and competitors can basically build their bot or AI by whatever means they choose. But when the competition itself starts in earnest on October 15, they’ll be limited to interacting with the game in its controlled environment through standard commands — no special access, no inspecting RAM, etc.

The goal of the competition will be to complete the game, and the Facebook team will track how many times the agent “ascends,” as it’s called in NetHack, in a set amount of time. But “we’re assuming this is going to be zero for everyone,” Grefenstette admitted. After all, this is one of the hardest games ever made, and even humans who have played it for years have trouble winning even once in a lifetime, let alone several times in a row. There will be other scoring metrics to judge winners in a number of categories.

The hope is that this challenge provides the seed of a new approach to AI, one that more fundamentally resembles actual human thinking. Shortcuts, trial and error, score-hacking, and zerging won’t work here — the agent needs to learn systems of logic and apply them flexibly and intelligently, or die horribly at the hands of an enraged centaur or owlbear.

You can check out the rules and other specifics of the NetHack Challenge here. Results will be announced at the NeurIPS conference later this year.