Many games with procedural generation, like Spelunky, build their levels out of interlocking, randomly-chosen level “chunks”, like a big jigsaw puzzle. For TowerFall, the levels are too small to take this approach. Cataclysm, the Dark World’s procedurally generated final tower, instead takes pre-designed layout “shells” and mutates them to generate new stages. The goal is to maximize the amount of meaningful variations that can occur, while eliminating as many broken or unfair outcomes as possible. “Broken” and “unfair” are of course subjective terms, but I’ve developed a good intuitive sense for them over the course of designing and testing more than 160 TowerFall levels.

The first step is to build the basic solid geometry. The black cells above are guaranteed to be solid (at this step, anyway). The red squares are player spawn points, and the pink rectangles are “random areas”. All the Cataclysm levels are symmetrical, so random areas are only placed on the left side of the stage.

TowerFall will randomly fill these pink areas with solids, and it will do so intelligently based on their position. There’s different algorithms for horizontally-wrapping areas, vertically-wrapping areas, free floating ones, and other cases.

Here’s one possible outcome of the geometry mutation.

The next step is to place game objects, such as jump pads, exploding orbs, spikeballs, or ice. This step is more free-form, and each object has its own specialized placement algorithm. I’m still tweaking them all, and trying to decide how common they should be. Even objects like the moving platforms from Thornwood, or the crushers from Sunken City will show up occasionally! While placing game objects, the level geometry may be mutated further.

And finally, we place treasure chests. This is a fairly simple step - any 2-tile-wide floor space with 4 tiles of overhead clearance is eligible for a treasure spawn point. The game randomly picks a few from the list, making sure they aren’t too close together. The big treasure chest is always centered, and prioritizes lower positions over higher ones to counteract height advantage when playing with tournament rules.

A fourth step is coming soon - background tiles. The levels in these screenshots are using the Twilight Spire tilesets as placeholders, but soon Cataclysm will have its own tilesets and randomly-placed background blocks.

All the levels in this post are generated from the same original “shell”. So far we have 12 layouts Cataclysm can generate from. Tonight I’m working on adding some more, as well as tweaking the generation algorithms further. I’m also thinking about the best way to let players fight on Cataclysm using a specific random seed, if they find a set of layouts they particularly love.

Cataclysm is shaping up to be my favorite tower, but there’s still a lot of work left fine-tuning it.