As my familiarity of Unity continued to grow and with steady progress being made on my 3D platforming game: Besus: Journey for Vitality, one night the thought to resurrect my Retro Runner project in Unity popped in to my head. My only hesitation came from how I would go about porting a project I started in GameMaker 8 to Unity 3D. After exploring the 2D functionality offered in Unity, I knew it could be done with relative ease and decided to pursue this new endeavor.
In order to get started with 2D in Unity, I downloaded the “official” 2d platformer tutorial/asset from the asset store to familiarize myself with 2D rigidbodies and Vector2’s. After taking a look at how everything worked, I stripped away what I didn’t need and ended up just using the Rigidbody2D forces being applied for movement and jumping. Even then, I only needed to apply a constant force to the player as horizontal force would always be applied (with the exception of slowing down while sliding). With the movement established I created a simple camera script which set the camera transform to the equivalent of the player transform (with an adjustable x-axis offset). Now that the core mechanics were in place, I moved on to getting the graphics portion of the game ported over.
Having worked with 3D modeling and 3D animating, the biggest obstacle in getting the game up and running in Unity would be animating the sprites. As anyone who has worked with sprites in Unity can attest to, this process is extremely simple and painless. I already had the sprite animation sheets made for GameMaker from the “I Wanna Be The Engine” starter kit I prototyped from in the original GameMaker version so now I just needed to import these in to Unity and create the animations from them. Creating the environments however was a whole other challenge; that is until I found Rotorz Tile System. Manually placing the various tiles (even using vertex snapping) was just too slow and tedious. Using Rotorz Tile System made this process as simple as it was in GameMaker (and RPG Maker for that matter). Best yet, individual tiles could be assigned 2D collision boxes, tags, and layers. The only drawback encountered here was editing multiple tiles (copy and paste) at a time as the brush can only paint one at a time. I had no luck in finding a way to edit/paint multiple tiles and searching online turned up no information about it; so it was a near-perfect tile solution. I made up for this by manually creating the background element sprites and placing them where needed.
I had functioning game mechanics, sprites, and tilesets; now I needed a HUD. Having begun working with NGUI in my Platformer project, I added the asset to this project and began working on the HUD for Retro Runner. The only elements that it would need to display would be the times (current and best) but showing a float value doesn’t do much good to a person. Thankfully Google and Unity can find answers 95% of the time and before long, I found how to convert the float to a human-readable time format. Next up was the pause menu and ironically, this proved to be the biggest challenge of all.
Starting with just a basic window that displayed ‘Pause’ upon pressing the ‘P’ key, I knew that wouldn’t be enough. After a few iterations I ended up allowing the player to restart from checkpoint (also available with a press of the ‘R’ key), restart the entire level, display the controls for the game, and finally a level select sub-menu. This all sounds quite simple (in theory) however after finally getting all of the window transitions and functionality working, I found out while testing the game in full-screen that too much dynamic text on screen at once breaks the entire HUD. Hours of tweaking later and everything played nicely; in both in-editor testing as well as full-screen play testing. In total, I would say it took around 10 hours to get it all up and running. Considering that the basic game mechanics took around half as much time, I can’t help but feel embarrassed that so much time was spent on menus.
Everything was in place and the only item left on the to-do list was creating more levels. I find this process more tedious than challenging so I often found myself getting distracted while working on a level. Eventually however I had completed the two that are included (in this release) so I finally got to go through the build process. This proved to be far more painless than I had anticipated; in-fact, it seemed almost too easy to be true. Naturally after the web-version was built, I found a few other (minor) bugs which needed to be fixed. A couple hours fixing these and I present to you: