Category: WebGL

Post Mortem – Solar Rocket

Posted by – June 27, 2014

feature

Post Mortem about the IOS / Android Game, Solar Rocket

Tools used: Unity3D, Photoshop, webgl

Time spent: 1 Week

Status: Just released to Google Play Store – Solar Rocket

Introduction

This was supposed to be a quick first project – getting my feet wet, so to speak. The main mission here was to get myself acquainted with the process of publishing an app to Google Play and the Apple Appstore.

I chose to make a simple arcade game where you have to navigate a rocket past asteroids and devious alien-laser-shooting-spaceships  to leave the solar system (and essentially keep going until you die).

Original? Hardly. But a good entry project :)

Why is it a good entry project

  1. Because i figured i could accomplish the required logic fairly fast.
  2. It didn’t require me to draw any sprite animation frames (besides an explosion and some exhaust flames and those are easy!)- which is a big deal since i do my own artwork, and not only does having to do animation take a shit load of time, i am also not very good at it.

Initially the plan was to use webgl wrapped in a native application to accomplish cross platform compatibility, but that became unreasonable halfway through the project, and i ended up switching to unity and starting from scratch 3 days in.

What went wrong – webgl woes.

So, as mentioned, my initial idea was to make the game using the webgl context of HTML5 canvas. My main reason being that i come into this from years of experience working on web applications, so naturally in combination with the prospect of easy cross platform compatibility, webgl appeared to be an attractive solution. I would write the game in webgl and then wrap it a native android / ios app so i could put it in their respective app stores.

Everything was well, and on the end of the second day i had a prototype of the game that was about 75% finished, it was performing reasonably enough on my HTC One – it wasn’t completely smooth but hovered somewhere in the 40-50fps range – that i decided it was time to start looking into packaging it for appstore release.

Android studio here i come. Getting the javascript files to load in their WebView element was easy enough.

First test – well that’s odd, this looks like its running at 10fps.

Thirty minutes of google-fu later it turns out that Google had introduced a new webview in KitKat 4.4.2 based on chromium that’s actually much faster than their old webview – however, for whichever reason they did not enable hardware acceleration for the canvas element, so my precious webgl game was wheezing really bad while running up a hill.

So not only was KitKat 4.4.2 completely fucked, but turns out there is actually quite a few web relative performance issues spread out through the various android versions throughout jellybean and kitkat (note: i didn’t actually test this, just quoting what i read on various more or less reliable websites in my search for a solution)

Queue CoocoonJS

So turns out there is this nifty solution called CoocoonJs which is a cloud based compiling service that will take your webgl/html5 game, render it in their customized webview – which is supposedly fast on all android versions >4 – and compile it all into a package you can then comfortably add to the app store.

Sounds pretty good, and after fiddling for a couple minutes  getting my code to play nice with their webview, i was ready for compilation baby.

Only i never actually got to the point.

There were a couple things which caused me to ponder long enough …

  1. They require a premium account in order for you show any ads in your game – which is setup through their API
  2. You don’t get the android project, but the final apk package.
  3. For some reason i felt really hesitant having to rely on this just to get my webgl working properly.
  4. Not sure how i feel about uploading all my shit to their service.
  5. I couldn’t get their canvas+ solution working at all (needed for IOS release) (it refused to load .gif files, changed them to pngs which made the whole app 10 times larger, and then it loaded the images but distorted and glitching)

… to be hit by this:

YO IOS got webgl?

Oh IOS doesnt even support webgl in their native webview right now. It’s planned for IOS8 tho, so rejoice.

At this point i was in full rage mode and decided to go to bed.

The next day i decided to give unity3D a shot. Things took a turn for the better.

What went right – Unity

So Unity. Before we get to the light at the end of the tunnel, there is still a couple issues:

  1. I don’t know C# and their javascript implementation looks quite different then what i am used to from web development.
  2. I don’t know C#
  3. I had 4 days left of the time i allotted myself for this project.

Daunting? A bit. Regardless seeing as webgl probably still needed a good year to be properly supported across a reasonable device range, unity – with its build to all platforms goodness – seemed like a good alternative route.

After a few frustrating hours of initial learning curve extravaganza i was well on my way, picking up C# on the way.

3 days later the game was published to Google Play Prod :)

What went right – Sounds

Sounds are a plenty in the Unity Asset Store as well as at sounddogs.com. In addition to that it also happened to be that one of my close friends had made an old soundtrack years ago (1999?) that seemed to fit surprisingly well.

So not only did the game end up with sound effects but also with a track of background music. Unexpected!

What went soso - Graphics

I am happy with the way the visuals of the game turned out, but in the end i was too slow to meet my deadline, so the game over screen looks rather horrendous :) At least i had time to make some funny graphics that were displayed depending on what killed you

.gameover-aliengameover-asteroid

Also i do like the way Jupiter looks when you fly past it.

jupiter-fly-over

To be determined – Difficulty

I have yet to see whether the difficulty is tuned right. Im not sure. I want the game to be challenging, leaving the solar system by going past Pluto should be earned by skilled “piloting”, but i am scared that it is a bit too hard even early on.

Right now getting to Jupiter seems fairly difficult.

To be determined – Google Play Services

So the whole idea of using google play services to provide leaderboards and achievements sounds very neat. Implementing it is also straightforward. However i did find it laggy at times – eg. unlocking an achievement would lag the whole game for a split second. Which is kind of annoying in any game, but in this kind of genre a split second lag can kill you especially when you are further in and difficulty is higher.

It might be worth it to implement an in house leaderboard / achievement system instead, doesn’t seem like it would take too long. Are there any other benefits to integrating google play services? I haven’t looked.

Closing Thoughts

All in all i am happy with the final result. I will probably stick to unity for a bit, i quite like it. My heart still beats for webgl as well, but i feel like it might not be quite where it needs to be yet.

I was impressed with the way the Google Developer Console was set up, it seems very well integrated, from allowing to set up alpha / beta testing for your app (through google play store) to error reporting for crashes and application-not-responding errors.

Next i need to figure out how to build for IOS and windows phones. Then i need to look into marketing options. As of this writing the game has been released for 12 hours without any downloads. Which was to be expected, as there is a ton of competition, with lots and lots of new apps entering the playingfield daily

Expect further updates on how the game is doing and what i am doing to get the word out in the future.

Thanks for reading :)

Posts about Solar Rocket