GameDev Resource Pick: Spelunky Level Generator

spelunky

(Please note: This tool/visualization is for Chrome only. Which is kinda annoying if you use Firefox like me, but downloading and installing Chrome was worth it to check this out.)

I don’t know how it took me so long to find this. I played the original Spelunky for hours and hours, marveling at its seamless world generation that felt simultaneously familiar and perpetually fresh.

I gleaned quite a lot about procedural generation by simply PLAYING the original game – the randomization felt so elegant and simple, I felt like it was something I could almost do in my own games. Or at least wrap my head around.

I found this Spelunky Level generator the other day (it works in Chrome only!), and spent quite a while discovering that I was right and wrong about my initial conceptions about how the randomization works. On the one hand, it is fairly simple, at least on the surface. And it is very elegant, no doubts about that.

On the other hand, though, I was very wrong about exactly HOW the randomization works. It was pretty clear to me that there were these chunks that fit together seamlessly, and there was a limited amount of them and they could randomize their contents to some degree.

It was the first few steps that I had missed. The simple numbered drunkard’s walk to populate the initial grid from the top-down … brilliant. It ensures that there will always be a direct path to the exit (in case you run out of bombs), but the variety of zero-numbered side rooms makes it just difficult enough for the casual player to not necessarily (or consciously, at least) see the descending pattern and find the exit with no missteps.

But it’s the randomization of the blocks inside the templates that really pushes my buttons. On this page (part two of the simulation), just keep hitting the 3 key and watch the white-highlighted squares – the ‘probabilistic tiles.’ Their quantity in any given chunk makes for near endless variation, yet not so much that you still can’t recognize the chunk type. This is the feature that really clinches the procedural generation for me. I’m used to enemies moving around in games like Mario, so variety of enemy placement is nice but not novel. These probabilistic tiles variation ensures that you’re going to be making new jumps, judging new distances, and accidentally falling to your death in new ways in every single run-through.

How cool is that?

SPOILER: Very cool.

In any case, hopefully it’ll give you some inspiration if you’re thinking about using procgen in your game! Give it a try!