Spelunky Html5

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. Spelunky is an indie action-adventure game with randomized levels that offer a new and challenging experience each time you play! Ported from GameMaker 8.1 to HTML5 with GameMaker: Studio. Original Spelunky was developed by Derek Yu, ported by Darius Kazemi (me). Unlockable or hidden rooms and levels that can be found in Spelunky Classic, and the method of unlocking them or accessing them from within the game. 1 Shortcut House 2 Challenge Rooms 2.1 Sun Room 2.2 Moon Room 2.3 Stars Room 2.4 Changing Room 3 Black Market 4 City of Gold 5 Footnotes To unlock a shortcut, reach the given tunnel two times, and the second time, pay the Tunnel Man the.

The level is made of 16 rooms in a 4x4 grid. There are 4 different basic room types:

  • 0: a side room that is not on the solution path
  • 1: a room that is guaranteed to have a left exit and a right exit
  • 2: a room that is guaranteed to have exits on the left, right, and bottom. If there's another '2' room above it, then it also is guaranteed a top exit
  • 3: a room that is guaranteed to have exists on the left, right, and top
  • While Spelunky does a great job of randomizing its levels, there are certain rooms that repeatedly appear. One of the best rooms to find is the snake pit. It’s a high pit that has green and blue snakes protecting a pile of rubies at the bottom. The rubies are nice but the real value here is.
  • Spelunky HTML5 is ported directly from the original Game Maker version, so the methods are exactly the same as in the original game. You get the sceptre by killing the mummy on floor 13 and picking it up.

The first thing it does is place a start room in the top row. Room type doesn't really affect the start rooms, as it's a special case, but generally speaking a start room is type 1 or 2.

Every time a room is placed, at first it is always a type 1 room (left/right).

Then it decides where to go next. It picks a (uniform distribution) random number from 1 to 5. On a 1 or 2, the solution path moves left. On a 3 or 4, the solution path moves right. On a 5, the path goes down. (If the solution path hits the edge of the screen, then it immediately drops down and switches its left/right direction.)

Now here's the thing: if we move left or right, that's all fine and dandy because we've placed down a room with guaranteed left/right exits. But if we've decided to move down, we need to change the room we're in! So the generator overrides the current room to be type 2 (which always has a bottom drop) and we're all good to move down now.

Once it's moved onto the next room, it asks whether the last room we placed was type 2 (bottom drop). If this is true, then this room HAS to be another type 2 bottom drop, or a type 3 upside-down T shape. Since types 2 and 3 have left/right exits, we can start the algorithm all over again.

If we are on the bottom row of room, and we try to drop, instead of dropping down, we place the exit room.

Now we have the entire solution path generated (what's in red above). The last thing we do is we add some random type 0 rooms to every grid space that is not on the solution path. These rooms don't have any guarantees of exits on ANY side, which is why you sometimes see them walled off.

HacksSpelunky Html5

If there are 3 or 4 type 0 rooms making a vertical line, then there is a chance that those rooms will become a snake pit. If we decide to make a snake pit, we put down, from top to bottom, a sequence of room type 7 8 9, or 7 8 8 9, depending on the depth of the snake pit we want. (You'll notice that snakes and jewels get placed manually at this point, since they're really part of the landscape and aren't randomly placed like most other enemies.)

Html5Spelunky Html5

That's it! In part 2 I show you how individual rooms get laid out (spikes, ladder/pit formations, etc).

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.

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

Spelunky Html5
  • 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 Github

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!