Roguelike column thumbnail ['@ Play' is a monthly column by John Harris which discusses the history, present and future of the Roguelike dungeon exploring genre.]

"Probably the easiest way to describe Spelunky is that it's (kind of) like La Mulana meets Nethack - every time you play the levels, items, monsters, and so forth, are all procedurally-generated. [...] My goal was to create a fast-paced platform game that had the kind of tension, re-playability, and variety of a roguelike. In roguelikes, the gameplay tells the story, and I wanted to give Spelunky that type of a feeling... but make the player rely on their reflexes rather than their brain (or knowledge of what 50 billion command keys do!). If there's a best of both worlds, that's what I was trying to go for."
-- Derek Yu, introducing Spelunky on TIGSource Forums.

spelunkytitle.pngSpelunky has been talked about on a fairly substantial number of blogs in the short month of its public existence. Considering that its aim is to bring some of the unique characteristics of the roguelike games into a different genre, I figured it was fair game for examination here. The result is quite a clever little game, highly addictive and quick to play. Death is incredibly frequent, but that should come as no hindrance to us, right?


[Note: This is @Play's fiftieth column. At the end is an overview of topics already covered and a list of links to them.]

The object of Spelunky is to work through a series of cave levels, avoiding damage and sudden death while collecting treasure and working towards the mysterious goal. Every level begins with the player at the top, the exit somewhere at the bottom, and a lot of loot and pain to discover along the way. Yep, sounds like a roguelike all right.

But Spelunky is a platformer, an action game presented with a side view. Its controls are greatly simplified, and the emphasis is on finding clever ways around obstacles. Treasure is found in the form of money and jewels, as extra supplies, as carryable tools like teleporters and shotguns, and as special equipment ranging from climbing gloves to jetpacks.

spelunky1.pngMaking its array of dynamically-created action puzzles possible is a fairly deep system of object interactions, which helps to push this borderline case back into our purview.

Nearly everything can be made use of in the right circumstances, including a lot of the enemies who are trying to eat our poor hero, unofficially dubbed "Indie" by the TIGSource Forums. Bats can be lured to set off arrow traps. Exploding frogs can break open sealed chambers. Falls from great heights can be survived by landing upon a hapless snake. One of the most impressive examples of these interactions has to do with the many ways of defeating arrow traps. Found in the first four levels, they are one of the game’s most interesting obstacles, and they well illustrate the kind of situations the game's excellent random level algorithm can produce.

Avoiding the Point

spelunky2.pngOne of the best ways to design traps, in other games as well as in roguelikes, is to give them an activating method, to simulate some operating mechanism. Not to just automatically harm the player when he enters the trigger area, but set some process in motion that harms him. It feel less arbitrary, but it potentially gives him a way of escaping the effect if he can come up with a way to avoid or subvert the process. In Nethack, for example, levitation means floor triggered traps or pits will not be set off, and if one can find and move the boulder-half of a rolling boulder trap, it is made harmless. This way it feels lell like damage by fiat. It makes sense.

Spelunky’s arrow traps are another good example. They operate by sensing motion. It doesn’t matter what, of the game’s many types of objects, is doing the moving. What follows, in the name of examining the kinds of design decisions that went into making Spelunky, is a fairly in-depth examination of them. It should go without saying that this is a spoiler, although in this game it's a relatively minor one.


In the image above, the trap is circled in white, and the extent of its sight range is represented by the red line. That’s about six-and-a-half blocks in front of the statue. The orange line shows about the route the arrow will follow.

Now take note that, in Spelunky, objects in rapid motion may harm the player. A stationary or slow-moving arrow is harmless, yet if you throw a rock against a wall so it bounces back and strikes you at full speed it’ll hurt you. So, when the arrow reaches the end of that orange line it’ll be at rest on the ground and cease to be a problem. If there were a wall in the way, the arrow would bounce off, and possibly harm Indie on its rebound. If it hurts it hurts bad, for arrow hits in Spelunky do two points of damage. That's half the player’s base total, and a enough penalty this early in the game to warrant a restart unless some other advantage has been found.

One way to thwart an arrow trap is simply to fall straight down through its watch line. If the player is a full block away from the trap as he falls by the arrow will miss him, even with the arrow’s high speed. So, falling from point 1 will set the trap off safely… but only if the player can bend his fall so he lands on the steps below; if he landed on the low portion of the ground, the fall might be enough distance to inflict a point of falling damage. (This, mind, could be avoided by doing a ledge-hang from the upper platform, a good technique to utilize if you’re unsure if the fall is safe or not.)

spelunky3.pngIf the player is approaching from ground level, then the situation is a little trickier. In many cases then it might be best to walk under the trap and let it be. But what if there were some prize on the upper route the player wanted to obtain, like a supply box or treasure chest? Standing on the upper-most step, at point 2, and jumping is a bad move. Indie would set off the trap at the apex of his jump, leaving him hanging for too long in the arrow’s path, giving it plenty of time to strike and bleed off two pints.

But one of the enemies circled above is a bat. Bats trigger when the player enters a wide area beneath it, causing it to give chase. They’re slow enemies, so in this case when it crosses the red line it’ll trigger the trap and get killed instead of the player. Just standing at point 2, at the top of the stairs, should do the job. Triggering the spider would probably work too, though it activates only if Indie walks directly beneath, and it's more unpredictable in its attack than a bat.

What if the player is moving in from the right, and wants to pass the trap going left? It’s a little expensive resource-wise, but he could drop a bomb above the trap at point 3 to outright destroy it. The player would have to be sure to get out of range of the blast; bomb hits are instant kills in this game. In a pinch he could also throw the bomb across from either point 3 or, in an upward arc, from point 4, and use its motion to set off the trap. Bombs are important equipment though, and it’s best to look around for something else, like a rock, jar or skull to throw and set off the trap.

If none of these tools are available then it’s really best to avoid setting it off at all, but if the player could find a way to enter the trap’s sight at the very end and move slowly, he might be able to take advantage of the difference between its straight vision range and the arrow’s curving path. This can be used to safely trigger arrow traps lying on flat ground; if the player slowly walks towards the trap, the arrow will actually hit the ground around the player's feet.

Spooky + Spelunky = Spelooky?

Roguelikes get their tension from the fact that the player, ideally, never has all the resources he might want. The tradeoff used in Rogue is food vs. experience; the player could stick around on the easy levels forever killing weak monsters to rise in level if he didn’t have to keep moving to keep himself fed.

Spelunky’s version of this takes the form of the Ghost. On all levels except the first and last, there is a two minute timer on the level. After that the music turns spooky and a warning message is displayed. 30 seconds after that and the Ghost enters the level, relentlessly chasing the player down and causing instant death on contact.

spelunky4.pngSome have complained about the timer, but I find that it’s a brilliant addition, and the time limit seems quite well-tuned; if the player is working towards nothing other than reaching the exit then he has plenty of extra time; most levels can be beaten in less than a minute. But there are plenty of other rewards to find: damsels to increase health, idols worth a fortune if brought to the exit, and an abundance of gold and jewels.

There are also shops to buy from (or rob), supplies to collect and treasure to uncover. If the player is going along collecting these things as fast as he can, he might be able to get them all, but he’ll have used up lots of his bombs and ropes getting them, and has probably taken a good amount of damage as well. The proper way to look at it is to look at an early exit, in the early levels at least, as a waste of resources. There’s no benefit from having extra time at the end of a level (except for achieving a special trophy), so the player must strike a balance between efficient progress and loot collection.

Somewhere, Izchak Miller is Looking Down on Us, Smiling

Of most interest to us roguelike fans is perhaps Spelunky's shops, which are lifted just about as completely as possible, given the completely different style of game it is, from Nethack. In Nethack a shop is a room with a shopkeeper at the door; the primary reason not to steal from the shop is that the owner will attempt to take out payment in flesh if you abscond with his merchandise. Spelunky's shopkeepers are similarly protective over their inventory; every one of them carries a shotgun, perhaps the game's most formidable weapon.

The following things will draw the wrath of a storekeep: walking out of a shop carrying inventory without paying, damaging the walls, floor or ceiling of a shop, harming inventory or otherwise causing it to leave the premises, harming the shopkeeper either directly or indirectly, or sending an instakill object into a shop. (Throwing in a bomb is particularly entertaining, even if you are unlikely to survive the situation.)

spelunky5.pngEven if you escape the shopkeeper, or manage to kill him, all the remaining shopkeepers in the game will be out for blood. They'll also camp out by the exit waiting for you for a couple of levels. Of course, there are strategies to decrease the danger of robbery,but… but I don't think I'll be spoiling those kinds of things today, sorry.

Raising Real Estate Values in the Caves

For everything Spelunky does well, there are a couple of things that could perhaps use some work. (Well it is beta software after all.) What there is usually errs on the side of being just a little too difficult. There are a number of carryable items the player can use; firearms, exploration tools, flares, idols and damsels. But only one of these things can be carried in-hand at a time. The player can make due by running back and forth ferrying items along towards the exit, but this is somewhat annoying, and rapidly approaches unworkability as the player juggles more than two such items.

spelunky6.pngThis could be seen as a limiting factor, to prevent people from being able to make full use of their inventory or to limit their usable possessions, but when the player encounters a dark level, carrying around a flare is essential unless the player wants to stumble into an arrow trap or jump down onto a bed of spikes. The result: dark levels tend to act as an effective barrier to carried items, making it difficult to keep even a single useful tool, like a shotgun, through them.

Even if the player manages to keep a flare all the way through a dark level, the odd way that light behaves in the game makes them less useful than you'd think. All light sources in a dark area display a very small portion of the (otherwise black) terrain around them. The player has a similar aura around him. If the player is physically close to a light source however, his own circle expands, getting bigger the closer he is. The upshot is, the technique of throwing a flare into a hole to see if there's spikes, monsters or arrow traps nearby is less useful than you'd expect, as the flare won't reveal anything beyond a block around where it lands. (It may also find water, which kills the flare.) To see further, the player will have to jump down to be closer to the flare, but will then probably end up getting feasted upon by whatever lurks there unseen. This is potentially a big problem with the man-eating plants in some of the later levels.

Those arrow traps I mentioned before, for all their charming complexity, have a problem that makes them slightly too difficult in certain situations. Their sight range is 6 and 1/2 blocks. The play window 20 blocks wide. The player is typically in the middle of that, giving him 10 blocks of vision horizontally. The result is, when walking along level ground, the player tends to have little time to react to arrow traps lying on the ground in front of him, especially if he's using the run button to escape some other danger, like giant spiders or crushing boulders.

spelunky7.pngSome of the later areas are unusually demanding upon the player's supplies and equipment. He begins with four bombs and four ropes. Bombs can break through rock, generally one space horizontally and two spaces down; ropes allow the player to go upwards in a level without needing platforms to rest on. Extras can be found in the levels and bought in some stores, and while they're often common, they're just as often absent in the game. Not to spoil things unnecessarily, but the third area (levels 9-12) seems particularly bad in this regard. Making it through usually depends on loading up on ropes on the earlier levels, but sometimes there just aren't many ropes to be had.

All of these things comes to matter a little more than it might in a traditional roguelike because Spelunky severely limits the number of hit points the player has. He has no maximum, but can only regain hits from damsels, and then only one at a time. Each level contains an huge variety of ways to get hurt for one or more hits, or get instantly killed, and our hero only has one life. As a result, everything that can harm the player effectively does so permanently; the player can never let himself just eat damage to get through a tiresome situation. This may be the hardest thing of all about Spelunky, and it's something that even roguelikes tend to offer more leeway towards; to regain health in most, the player need only find a monster-free room and rest a few dozen turns. I can't say if Spelunky's system really works; most games end far short of level 15, even for an experienced player, unless he gets a lucky break along the way. But then again, the action-oriented nature of the game, and relatively large number of empty spaces, means the player is more more able to avoid damage than in Rogue or its kin. It seems to be another case where the game is only slightly too hard.

Spelunking Along, Singing a Song

Yet surprisingly, these issues don't detract from its addictiveness too much. Overall, difficulty is only a little high considering the mood of game; that is to say, the game is often brutal yet fair. It's only when the flipside of that "often" comes in that the player is screwed over, and then it's usually masked well enough that he's not sure if it was his fault or not. And in a game where you're expected to die hundreds of times before you win; the fact that the game plays so quickly helps to counter the frustration this might otherwise cause.

Spelunky's generation system seems to work by filling in map spaces with sections of pre-generated level templates and then "roughening" them up a bit before inserting extra blocks, monsters, traps and treasure. It's a mechanism not used often in true roguelikes, but it seems to work rather well for a platformer. And it's good that Spelunky doesn't tame its level design too much as it generates its randomized levels.

Lots of commercial games that make use of random generation do that. In their efforts to ensure all areas are fairly completable, they also restrict a lot of interesting generation results. Those interesting juxtapositions and finding ways to overcome them, or even utilize them, are most of the fun to be had in Spelunky, and it turns out to be rather a lot of fun after all. This makes me rather anxious about my complaints above: in a rush to fix them, it would be easy to go overboard and rob Spelunky of its delicious challenge. This, really, is the biggest challenge to roguelike design: making it hard but fair. To thrust the knife at the player's throat, but to never touch him, relying on his own actions to push it in.

This is @Play's fiftieth post! Here's a listing of prior columns (thanks to the links page at, sorted by topic:

A View of the Field
Roguelikes and OD&D
More on Roguelikes and D&D

Learning to play:
Roguelike movement & implications

On specific games:
Pokemon Mystery Dungeon Blue & Red Rescue Team
ToeJam & Earl
Dungeon Crawl
Mysterious Dungeon series
Seven Day Quest
Mystery Dungeon: Shiren the Wanderer DS
Super Rogue
Izuna: Legend of the Unemployed Ninja
Vulture's Eye & Vulture's Claw
Spelunky (You are here.)

Roguelikes as stories:
Giant Eel Stories, Volume 1.
Giant Eel Stories, Volume 2
Storytelling in roguelikes

Taloon's Mystery Dungeon
Shiren the Wanderer SNES Part 1
Shiren the Wanderer SNES Part 2

Ways to die in Nethack
Metagame elements
Humor in Nethack
Quests in ADOM
Wishing in Nethack & spoilers in general
Shiren the Wanderer: Fei's Problems
On representing monsters as letters
Items (overview)

Nethack patches
Borg players
Dungeon generation algorithms
Game balance in Nethack
Homebrew Roguelikes on the Nintendo DS
The Nethack source code
Time and speed in roguelikes

devnull 2008 (10th anniversary)
devnull 2008 interview