Spelunky Html5

So I had some time on my hands this weekend and made major headway on porting the PC version of Spelunky to HTML5. You can play it here.

A lot of people don’t know this, but the original Spelunky was made in GameMaker, and almost a year ago, YoYo Games released GameMaker HTML5 (now GameMaker Studio). This lets you take a GameMaker game and compile it to JavaScript so that it runs in a modern web browser.

Hell is the secret fifth and final area of Spelunky HD, comprising levels 5-1 to 5-4. Here the player can make their way to the ruler of Hell found in 5-4; King Yama. Defeating King Yama will give the player the opportunity to complete the game the harder way and achieve the hard ending. Getting to Hell is not an easy thing to accomplish. One needs to obtain the four Egyptian artifacts from. And in some cases you will actually get two of the same item. Eg: jetpack and cape. Note: due to a Spelunky Xbox Live update this glitch no longer works. If one player dies, that player can blow the shopkeeper, giving the living player(s) the ability to pick up the shopkeeper for a small period each time the player(s) picks him up. Free cool games you can play at school not blocked on Unblocked Games 6666 Google Sites and don't forget to share with your friends about site. Spelunky Classic. This is the original freeware version of Spelunky that was released in 2009 and started it all. It's still free, so check it out! However, if you're looking for the HD reboot that was released in 2012, you can find that here.

In theory this should be a one-button process, but for a complex game like Spelunky it’s a bit harder.

  • Ripped out the entire sound system. It had an external dependency on a DLL, which clearly doesn’t play nice with HTML5
  • Fixed some bugs related to the compiler assuming the original programmer was being very careful with their GMScript.
    • In particular, in GMScript you can (though it is not recommended) do “foo.bar = baz” without checking to see if “foo” exists. It just fails silently. The compiler does not wrap this in a check to see if “foo” is defined, so JS complains when it’s not. (Note: this may not be an issue in GameMaker Studio. I’m using the last version of GM HTML5 before they switched to Studio.)
  • Repaired the rendering pipeline. For dark levels and a few other effects, the original game uses some draw modes that aren’t supported in GameMaker HTML5, so I had to take those out. I will eventually go in and reimplement them using globalCompositeOperation. For now, dark levels are not dark.
  • Made some horrible, wretched hacks for bugs I couldn’t track down. For instance, there was a bug that happened when your character spawned on the right-hand side of the level, so I hard-coded it so you only spawn on the left.
Spelunky html5 game

Spelunky Html5 Controls

The whole port took about three hours. I’m still working on it — I need to reimplement sound, redo all the custom graphical effects, and track down some collision/math issues that are a pain in the ass to reproduce. I also need to add persistence using LocalStorage (right now it doesn’t save your scores).Update Aug 3 2012: a million thanks to the YoYo Games team for taking my three-hour port and fixing a bunch of the bugs (sound! saving! better performance in general!) and polishing the hell out of the game. I mean: look at that art framing the game!