Spelunky and the City of Gold
This feature was originally published in PC Gamer UK in late 2009. It's about the free PC version of Spelunky, but applies equally to the recently released Xbox version. The City of Gold is not pictured, but I do detail how I got there.
I've found it. It's real. I must have stood at this mysterious door a hundred times before - with the Udjat Eye from the locked chest in the upper caves; with the Ankh of Resurrection bought at a Black Market so secret I had to blast through solid rock to find it; with a Psionic Staff prised from the cold dead hands of an eighteen foot Mummy; even with the elusive Hedjet of the ice caverns, a prize I literally died to obtain. Each time, it stayed shut. But now, at last, I've found the secret combination of secret artifacts that fits the secret lock on this secret door to the legendary City of Gold, and I'm going in.
I've been obsessed with Spelunky, a free ten megabyte platform game that runs at 320x240, for months. Addicted is the word we normally use, but it doesn't really apply to Spelunky: the game never tries to hook you with a dripfeed of back-pats or coddle you with a sense of constant progress. In fact, it sometimes seems to be telling you in no uncertain terms to go to hell. The tiniest slip kills you stone dead, there are no extra lives and no saving, ever. Get spiked by a trap you've never encountered before on the last level of the last world, and it's over. Start again from level one. I hate that kind of game. So why have I started again, 1,233 times?
It's pretty simple: the levels are random. Dangerously random. You might find unthinkable riches in the next chamber of these chunky caverns, or a giant yeti and three UFOs. You might find a damsel in need of rescue - buried in solid rock. You might find instant-death spikes on the only patch of ground you can drop to. Or you might find, as I once did, a crate on the first level that contains a goddamn Jetpack, the best item in the entire game and one that renders all jumping puzzles trivial.
So death might come suddenly, sometimes unfairly, but starting again puts you in a level just as fresh, weird and rich with possibilities as the next. I've started again 1,233 times, but that doesn't mean I've played the same first level 1,233 times. I've played 1,233 different level ones, and 1,200 level twos, and 1,000 level threes. And until now, zero Cities of Gold.
Can't get the staff
Getting here was hard in a sense of the word I wasn't previously familiar with. I can't think of anything else I've failed at 1,232 times not even punctuation. On one of my closest tries, I found myself on a precipice in the last world, with the Mummy's Psionic Death Staff and a damsel in distress.
Which to throw down, the staff or the girl? I can't carry both, but if I throw the girl down there and keep hold of the staff, she might land on some spikes. I throw the staff, take hold of the girl and drop down.
The staff, ineffably valuable, unthinkably powerful and the key to the legendary City of Gold, has landed on a Death Block. You can sort of tell that's not good news from the name. Death Blocks lurch terrifyingly in the direction of the nearest warm body, and a single touch of their spikes is instantly fatal. We've landed on a platform above, but avoiding the Death Block is going to be tricky with that Neanderthal running about below - sure would be nice to have some kind of Psionic Death Staff to take care of him.
Girl in hand, I leap over the block to come at it from the other side. It lurches upwards, the caveman runs underneath it, and at the same moment the staff falls off. Bonk! It knocks him out cold. Brilliant!
I set my ladyfriend down and snatch up the staff before the Neanderthal wakes. The Death Block slams down on the ground exactly between me and the girl, squishing the unconscious caveman to a soup. Ulp. Which warm body is it going to lurch for next?
It goes for me.
Fuuu(I run)uuu(it chases)uuu(I jump)uuu(there's a dart trap)uuu(it fires)uuu(and hits)uuuck!
The staff is flung from my hands and lands in a pit of lava. My body hits the ground just as the Death Block steamrolls over it, shredding me. It stops, then lurches back the other way to mince my companion.
Should have thrown the girl.
Spelunky's creator Derek Yu previously worked on swim-em-up Aquaria, which won the Independent Games Festival's grand prize in 2007. Yu knew he wanted to create a Roguelike - a genre named after the 1980 graphical adventure that randomly generated its dungeons, and made you start again after every death.
"Those two things make Roguelikes so fun and replayable," he says. "You get this great feeling of tension, knowing that each game you play is completely unique and unscripted."
But over the decades, Rogue's successors became richer RPGs and got more complicated. "Every key on the keyboard does something," says Yu, "and if you really want to succeed you need to have memorized a lot of those commands. " He wanted to combine what he liked about the genre with a simpler and more immediately fun template - namely, the platformer.
So Spelunky generates platformer levels by chaining together randomly selected room templates, following a zig-zagging path to the exit. The basic geography is never impossible to traverse, but the random placement of hazards means some sections can be ridiculously difficult.
The reason Spelunky can get away with this, never knowing if it's going to give you Death Blocks and Dart Traps or riches and women, is that it gives you the tools to get past anything. The bombs and ropes you start with are enough to blow through any wall, climb any height and kill any enemy. But with only four of each, and sixteen unpredictable levels to get through, you tend to conserve resources until you absolutely need them.
"With platformers and roguelikes at the forefront of my mind," Yu says, "the destructible blocks seemed like the last missing piece of whatever puzzle I was working on... The bombs and rope give the player a bit of insurance, in case things get a little too hairy."
So I've died 1,233 times, but I can only recall getting stuck once or twice, and both were avoidable. This system of potent but limited tools means the random threats never completely screw you over, but nor are they rendered irrelevant by letting you blast your way past them more than a few times.
Malled to death
Acquiring that Ankh of Resurrection was tough in itself. I found the randomly placed chest and the gold key that unlocks it in the first area, but didn't fully understand the artifact I found inside. When it started squeaking halfway through the jungle levels, I dismissed it as the screech of an aroused monkey. It must have been the fifth time I found it that I realised it was working as an arcane metal detector, blinking faster as I got closer to the hidden door of the Black Market. I set a bomb on the patch of ground where it squeaked fastest and stood back.
Spelunky has a boss, but its shopkeepers are its true villains. Their goods are so wildly desirable that just finding a shop is a thrill, but put one foot wrong on their premises and they'll shotgun you in the face. Even if you win that fight you're hounded for life: wanted posters turn every other vendor hostile, and one will camp at the level's exit waiting to kill you.
The Black Market has dozens of them. It's a level full of shops, with more superb equipment than you could ever afford. But out back, in a cave, one shoppy guards the most expensive item in the game: the Ankh. You can only afford it if you've scoured the early levels for jewels and gold, and you have to walk through all the other stores without blowing your fortune on their tempting goods.
I did both, and bought the Ankh. But the Black Market isn't a safe zone: it still has the odd creepy or crawly between you and the exit. I ducked a bat, splatted a spider, and whipped a frog. A red frog. An exploding frog. On someone's shop floor. It trembled, shook, and blew.
Twelve shopkeepers with shotguns, all instantly furious. I lasted a fraction of a second before the buckshot monsoon killed me - then respawned. I'd used up the Ankh of Resurrection in the very place I bought it, and it'd given me new life in a multistory shopping mall seething with the most violent and powerful enemies in the game.
Systems of surprise
Spelunky doesn't make anything easy, but it makes almost everything possible. You can pick up and throw anything that isn't an enemy, and even some things that are. I didn't know it at the time, but I could have scooped up that trembling frog and tossed it out of the store before it blew. Some players even use that as a tactic, a makeshift bomb to blast through walls or mine for gold.
"In roguelikes the developers pride themselves on making everything work the way it should," says Yu. "Why yes, I should be able to wield a cockatrice if I'm wearing gloves, and then use it to turn my enemies into stone! And yes, if I then overburden myself and fall over I should be stoned to death, too! It's amazing how surprised you can be at something working the way it should in a video game - we're so used to having barriers."
My favourite quirk of this system in Spelunky is that you can pick up the damsels you're supposed to be rescuing, and throw them as a weapon or bait. I still rescue them, of course - there's a 1 health point reward! - but they're tough enough to toss into a few deathtraps before you take them to safety. Dart guns only have one dart, so if I throw my ladyfriend ahead I can drop down safely after it's shot her. As the injured women run from me in tears, though, I sometimes wonder if I'm really the good guy.
The City of Gold
This time, it all went right. I found the Black Market, bought the Ankh, used it to obtain the Hedjet, combined the Hedjet with the Staff, and slotted the staff into the door. It fits. It opens. And at last, after God knows how many hours of trying, the door to the City of Gold is open, and I step through.
Spelunky is extremely low-res, but Yu's art works a lot of character into those pixels. The City of Gold is nothing like a city, but it's blaringly gold. Like the Black Market, it's not a safe zone: Mummies roam, tribesmen scamper, lava boils. But that's okay, I'm not here to explore. I'm here to blow it up.
As I've mentioned, Spelunky is fully destructible. And this is a city made of gold. The rubble from a blast here isn't just dust, it's gold dust. Sometimes with diamonds in it.
I bomb my way through this ancient legend like a human airstrike, then hoover up the glistering dirt greedily and walk out a millionaire.
On the next level, a Mummy breathes locusts in my face and I fall into a pit of lava.
Ah well, 1,234th time lucky.
The future is random
The randomisation is only half the reason Spelunky is so exciting. Amongst that chaos, there are so many handcrafted secrets, surprises and treasures that you never feel like you're done.
"Encountering special levels like snake pits, giant lakes, crashed spaceships, and sacrificial pits make it feel like you're having a real adventure," says Yu. "I just wanted the player to be excited about the possibilities: of the next room, then of the next level, then of the next area, and so on."
It works magnificently. Why don't more games randomise their levels, and use the time saved to work in enticing secrets like this? I asked Yu.
"Creative people have a hard time giving up control of their creations, and randomizing big swathes of your game is giving up a lot of control." That's truer than ever at a time when the safest monkeymakers tend to be tightly scripted cinematic experiences. But Yu doesn't accept it as a good enough excuse. "In game development, you are always giving up some of your control, whether it's to the random number generator or to the player. If you let the player crouch, you are also letting them teabag, whether you like it or not."
What if you tried to apply this kind of randomisation to a 3D game? "Instead of having a simple 2D grid, you could have levels that branched out in every direction. But that would also mean more things to think about - how to get from point A to point B would suddenly be a lot more complex."
Yu says another difficulty would be making randomised 3D spaces look convincing - "areas that looked reasonable and weren't just a bunch of boxes. In Spelunky I could get away with it, but in a Tomb Raider-type game you really couldn't. Not these days."
Someone will eventually solve this - Spelunky itself disproves the conventional wisdom that Roguelikes have to be ugly and impenetrable. But it probably won't be Yu. Spelunky's become so popular that Microsoft have signed up for a commercial Xbox Live version, with new content and a different art style, so he's working full time on that. Yu says it might come to PC, but he's also still developing the free version we already have. And he still rather likes an aborted prototype for the game that went on to become Spelunky; "a giant monster roguelike - each level was a city you got to stomp around in."
For now, Spelunky will remain a unique example of using an idea from the 80s, to make a game with graphics from the 90s, and give it a freshness unmatched by any platformer in the 2000s. It's a lesson in how to make a little content go an extremely long way, in a game that effectively lasts forever. Maybe developers won't pay attention to it, and in ten years time the only other games doing anything interesting with randomised spaces will still be made of ASCII characters. But I hope at least players give it a try, because it's more than a neat idea. It's a stupendously good game.
One year after this article was written, a randomly generated 3D game - Minecraft - sold its first million copies, and exploded into a global phenomenon. This year, the HD version of Spelunky won the Excellence in Design category at the Independent Games Festival. This week, it was released to universal praise on Xbox 360. The PC version is still free, and Yu says "there's a good chance" the HD one will come to PC.