Profile Image

Nir Yomtov

An ever-so-curious Game Developer with a passion for creating polished experiences_
Interested in Gameplay & Graphics Programming, A.I, UI/UX and the way they all tie together to form experiences that leave a lasting impression

Spelunky Remake

Github repository

Download Build

  • C++
  • OpenGL
  • SDL
  • Photoshop
Key Takeaways (What have I learned?)

Research Into Spleunky's File Formats

In order to extract the assets from the original game, I delved into fan forums and did research in order to find the tools and knowledge required to reverse engineer Spelunky's file formats.

Overcoming Spelunky's Procedural Level Generation

Spelunky is known for its procedural level generation, however, when developing this remake I wanted to force the original game to generate the same level from a set seed for testing purposes - so I could make sure my remake was faithful to the original game as I polish my features. After some research I came across an open source tool that helped me solve that problem called Frozlunky.

Using Prime Numbers to A Solve Tile Generation Challenge

I ran into an interesting problem during level generation while working on the WoodTile Class, a tile type that changes its sprite based on the number of exact number and position of 4 other adjacent tiles. Following the C++ guidelines, I wasn't out to prematurely optimize, but after realizing there were 16 different possible combinations (4 immediate adjacent tiles, each can be present or not - 2^4 = 16), I knew there had to be a smarter solution instead of coding each possibility by hand, this was especially important as I wanted to keep my level files simple, and not specify a specific sprite but only the tile type.

By assigning a unique prime to each direction where an adjacent tile could be and then multiplying them together, I created a unique product for any combination of adjacent tiles. This made it easy to map specific combinations to specific sprites. For instance, if you there were two adjacent tiles both to the left (prime 3) and to the right (prime 7), the unique product would 21, and this product was used as a key in an std::map containing sprites to determine which sprite to draw.

Loading Files, Lambas & Algorithms

I learned how to use std::ifstream & std::ofstream to read and write files, for my level data. Throughout the project, I also made use of sort and find algorithms from the standard library and used lambda functions as predicates.

Next Steps (Given the chance, what would I improve?)

Arrow trap & Spike trap tiles

These are two tile types that add a lot more strategy to the way you have to navigate the levels. The game would feel a lot more complete with them included, and create more chaotic & hilarious situations when you get hit by an arrow or an enemy and start a domino effect of triggering traps.

Usable Items

Apart from the already implemented pickups, I would like to implement items you can pick up, just like in the original game. These can be weapons, jetpacks or even decorative items like rocks that can be used to trigger traps.

Bombs & Dynamic Destruction

One of the key features of Spelunky and certianly one of the most satisfying gameplay mechanics are the bombs & the dynamic destruction of the level tiles. Having 5 courses per semester we only had so much time to work on each project, so this was originally out of scope.

Networking & Battle-Royle Multiplayer

Finally, instead of recreating the rest of the original game, I would like to add networking over UDP using RakNet - and then see how far I can take it by attempting to create a Battle Royale mode with up to 99 players, in the same fashion of Tetris 99.