Infinite Metroidvania

[This is a project I’ve been working on since I realized I could actually write game code, somewhere in the midst of making Daughters of Ash. I hope for it to be my first original release.]

I’ve been transfixed by Super Metroid since first playing it at a friend’s house in 1999. My obsession with it was clearly no joke, because my long-reluctant parents finally gave in that year and bought me a SNES — my first console.

Super Metroid is still my favorite game of all time. The many reasons for this have been detailed elsewhere by equally many people, but I want to reiterate two reasons that continue to impress today in a crowded field of mostly inferior descendants.

Reason one: the game’s atmosphere is unreal. Immersion is established quickly and never, ever lets up. You simply feel alone on an alien world. After a brief prologue, you are never interrupted by NPC conversations, in-game messages, obvious tutorials, or hand-holding objectives. Your only mission is to find the last Metroid after it is taken by Ridley. This simple goal never changes, and the only clue you receive thereafter is an ominous gold statue in a dripping, dead-end cave. The game’s music and sound design elevate the ambience to perfection. The game is challenging, but never makes you want to stop playing. And all of this is pulled off so flawlessly that most players will never notice the well-tuned orchestra of design decisions that went into it.

Most of the credit for the Super Metroid‘s atmosphere goes to reason two: the map design. Tomes have been written about this online — I’ve seen some map sections broken down to the tile level — yet I still think there’s more to be said, and I’m sure I’ll be doing that myself in future posts. But just briefly consider some of the many gameplay roles assumed by Planet Zebes:

  1. Zebes silently tells a story. It features numerous memorable areas, cutscene-free plot developments (the shattered Metroid tube), and a great deal of lore curiosities for those who care (Draygon’s children? Mocktroids? A mysterious, haunted wrecked ship?).
  2. Zebes silently hands you quests. It presents you with various “locks” throughout the game, to which you must find the matching keys, along with just enough information to point you in the right direction (the teasing, frugal map stations).
  3. Zebes silently teaches you how to play. It forces you to learn new abilities without any overly artificial gauntlets or demonstration videos.
  4. Zebes silently antagonizes you. It dares you to get lost in its labyrinth, and you absolutely would if not for the in-game map. Finding the path forward is a more persistent, difficult, and ultimately rewarding task in Super Metroid than any individual combat or platforming segment.

These duties ask so much of the game’s map — demand such ludicrous perfection from its designers — that one cannot help but suspect there was some degree of luck involved in how well it turned out. Few games have come close to it since. Dracula’s Castle in Castlevania: Symphony of the Night (the canonical source of the second half of “Metroidvania”) is even larger than Zebes and opens up to the player surprisingly quickly, but you’re often asked to poke around randomly until you find the One True Path forward. The same thing happens in Axiom Verge, and Shadow Complex only escapes it by marking the player’s destination on their map for most of the game. All three games are also rather talky, place more emphasis on combat, and (for me) leave something to be desired thematically: Symphony’s world is too scatter-shot in its mythology and dozens of mostly useless items; Axiom Verge is so alien that it’s hard to keep track of the game’s locations (try recalling and describing the different areas without referencing color); and Shadow Complex is about as generic as military science fiction can get (plus Nolan North).

Meanwhile, the various developers of the Metroid series apparently decided they were done with god-tier map design after 1994. 2002’s Metroid Fusion — the last original 2D entry in the series — is fun, but notoriously story-heavy and linear. Metroid Prime has a fantastic atmosphere of its own and hits many of the right notes with its memorable environments and focus on exploration, but running back and forth across Tallon IV can start to feel like a bit of a chore in the late game (and there’s a decidedly non-subtle hint system enabled by default that many players won’t turn off). Metroid Prime 2: Echoes is a great game as well, but the obvious hub-with-three-spokes approach it takes to world design leaves fewer surprises to be discovered; the same goes for Metroid Prime 3: Corruption, which has you visit three main worlds in sequence with some occasional backtracking along that well-defined straight line. All of these entries do a good job emulating Super Metroid within certain localized segments, but they lack the large-scale magic of the journey through Zebes. They have quality map components that are interesting to explore locally, but then join those components together using rails (Fusion, Corruption), a dull geometric template (Echoes), or a haphazard shotgun blast (Prime). Only Super Metroid offers a world map greater than the sum of its parts. (Lest I neglect the other entries: Metroid: Zero Mission writes over the chaotic freedom of the original Metroid with the forced linearity of Fusion; the 3DS remake of Metroid 2: Samus Returns barely resembles a Metroidvania; Metroid: Other M is kind of a joke.)

In my view — and I don’t think this will be too controversial — only one game in the last twenty-five years has expanded Super Metroid’s formula in a way that is almost uniformly positive. Hollow Knight is rightfully regarded as an opus: the world of Hallownest is sprawling, visually and thematically gorgeous, and a sheer pleasure to explore and navigate. It’s filled with characters and dialogue, sure, but they’re all weirdos doing their own weird things, and plenty of Hallownest’s areas still drip with enough existential dread and solipsistic despair to make the darkest depths of Zebes blush. Your options for exploration grow wildly out of control after the first few hours — but unlike in Symphony, there’s more than one right answer when choosing which area to visit next, and keys can be collected in many different orders (or skipped entirely). This is big tech, and there are consequently less physical and mental dead ends in Hallownest than other games in the same genre. It should be noted that HK also firmly salutes Dark Souls with its quirky “fellow traveler” NPCs, its constant references to shadow and plague, and its (slightly questionable) death mechanic.

The challenge faced by Cherry Games was less about designing invisible hands into the world that guide the player along the One True Path (something only SM has ever nailed) and more about maximizing the number of Multiple True Paths that will lead to a positive game experience. I’m not sure which of these design problems is more difficult; both seem to require a great deal of handcrafted love and care.

Which brings us, finally, to the question at hand: can we create a procedural generator of worlds like Zebes and Hallownest?

I think the answer is yes, but I’m well aware of three reasons this might seem unlikely:

  1. Procedural generators have thus far not impressed with their ability to create high-level content. Beloved rogue-like games like Spelunky and The Binding of Isaac create fun individual, five-minute levels, but that’s a far cry from generating interesting, multi-hour, distinct worlds.
  2. It took larger teams years after release to create good procedural world generators in games like No Man’s Sky, and their vast planets still don’t typically stay interesting for more than five minutes.
  3. Chasm tried to do this in 2018 and it wasn’t great.

I’ll address all of these points in way too much detail in future posts, but for now, consider this: high-level content generation is a perceptual problem. It forces you to translate high-level perceptual patterns into low-level source code. Game designers do this all the time, but only after they’ve chosen very specific high-level patterns — like “the player immediately thinks of Kraid’s lair after finding the Hi-Jump Boots,” or “Lower Norfair feels like literal hell,” or “the player feels trapped and afraid when they fall into Deepnest” — that can then be carefully broken down into a configuration of low-level game components on a case-by-case basis. Said another way: the designer knows the high-level perceptual experience they want the player to have, and must ultimately represent that in ones and zeroes.

To do this procedurally, we need to go one step further. It’s not enough to pick and choose certain high-level patterns and encode them individually. We need to encode the perceptual system itself: the game designer. We need to abstract away from specific instances of high-level patterns, like the Kraid and Deepnest examples given above, and instead encode the perceptual categories those patterns belong to. This code can then, on request, generate new instances of high-level patterns that belong to these even higher more abstract categories.

These perceptual categories are complex and layered: at the very top level, we have the unifying category of “the player perceives the game world the same way they perceived Zebes and Hallownest.” When we say “the same way” here, we’re not talking about the player seeing identical pixels on the screen. We’re talking about an abstract class of perceptual experience that includes everything that Zebes, Hallownest, and our prospective new game worlds have in common. In fact, we already have some idea of how this abstract category can be broken down into other categories, many of which are mentioned in the standard definition of “Metroidvania”: things like interconnected areas, locks and keys, backtracking, and critical paths. Each of these things needs to be further taken apart until the structure can be codified in machine language (or a human-friendly interface to it, like Python). At this point, we will have fully reverse-engineered a tiny part of the human brain — the part that perceives Metroidvania games — and will be able to randomly generate content at the lowest levels in a way that ensures the resulting world is still perceived as a (brand new) Metroidvania, and ideally one of high quality.

Creating the Infinite Metroidvania Generator is like building a spaceship. I have a PhD in perceptual psychology; designing this exact type of spaceship is what I do for a living. If you liked Daughters of Ash or Roguelike Souls, I have hopefully already convinced you that I can actually implement those designs in code, and that I plan to fly our spaceship somewhere you will all enjoy. If you didn’t like them, well, this is the kind of spaceship that will hopefully be able to take you wherever you want anyway.

Of course, I’m not quite stupid enough to try developing this game alone, but until the project launches for real and I can put my all into developing it and directing a team, it’s just me. I’ve been working on it sporadically for a few years and have already made good headway codifying specific categories like map topology and non-linear progression.

When I have enough to demo, or when I start thinking about doing something crazy like quitting my job, you’ll all be the first to know.

~ Grim