Spelunky 2 has proven irresistible to players and game critics looking for old school difficulty in a shiny new package. The game presents compelling stages that generate randomly each time a level loads, which is no minor accomplishment. The unusually successful implementation builds on extensive work by co-developer BlitWorks on advanced AI that seems almost human.
In an email interview with Polygon, gameplay and AI programmer Javier Moya Nájera explained that lead programmer Mickey Pascual created a testing system to process numerous randomly generated stages. This allowed the team to find issues with the level generation system during development. As players explore the finished product, they also encounter non-playable characters (NPCs) known as Hired Hands. They required their own AI routines to navigate the dynamic environments.
Since it was already developing AI to test stages on a rudimentary basis, the team at Blitworks (which assisted on Spelunky 2‘s development, due to the sequel’s expanded scope) decided to see if it could kick things up a notch. It supplied the computer-controlled player character with more advanced skills it could rely on when testing random levels. The developers could then watch to see how that AI character overcome challenges.
“After a few changes,” Nájera said, “we had a primitive level testing where the AI was just trying to reach the exit door without taking into account anything else.”
Actual players do a lot more than just navigate. Their success in Spelunky 2 relies on considerably more advanced play. Therefore, an AI character created to test levels needed to behave more like a human might to determine whether the random environments were compelling.
“The game has a lot of items, powerups, monsters, etc. to handle, and each one has its own behavior and peculiarities, and the AI has to know all of them to decide how to proceed,” explained Nájera. “It is not the same to [fight] a flying bat, which can be stomped or whipped, [versus] a yeti, which cannot be whipped but [can be] shot, for example.”
Although the AI is interesting and advanced (and good at its job), there’s currently no way to see it do its thing merely by playing Spelunky 2. You can get close by following one of the Hired Hand characters to see how it copes with the various obstacles. Infused with AI wisdom, those plucky NPCs have what it takes to serve as some of the most experienced guides in gaming. Who knows? They might even teach you a thing or two.