Bit by bit: The Frag Castle Blog

Impactjs With Cocoonjs

Posted By John Bubriski, 31, December, 2012, in tech

If you haven’t heard, we completed v1 of our first game, Rock Kickass. We’re still ironing out the game mechanics and story so it’s only deployed to our website. We are also venturing into uncharted territory for us: App Stores! While we don’t have anything ready yet, we’ve started some preliminary work, testing the waters so to speak, for the options that we have.

What can we do?

Since Rock Kickass is a JavaScript / Canvas based game, our deployment story is a bit limited at the moment. Sure, we can pretty much wrap it up as-is and push it to the Windows8 Store, and to the lovely intarwebs, but we have zero mobile distribution channels.

To hit these markets we’ll need to use a wrapper that - ideally - will give us access to the native features and performance as well as nice-to-have features like leaderboards, social media gamification, monetization and other integrations.

Some of the tools we’ve found are:

Our first attempt

ImpactJS

CocoonJS

To start with, we’ve picked CocoonJS. I’d heard the Lost Decade Games guys talk about it before so it seemed as good a place to start as any. (FYI, we are not affiliated with CocoonJS, or ImpactJS)

According to Ludei:

CocoonJS is a platform that allows developers to deploy, accelerate, and monetize their JavaScript HTML5 games on the App store and Google Play.

So…. What does that mean?

The way it works is that you zip up your JS app and CocoonJS will act as a translation layer that converts canvas operations to native GPU calls on the respective platforms. There are two main services that they offer; their Launcher, and Cloud Compiler. The Launcher apps run on your android or iOS devices, will download your app via FTP and compile it on-the-fly. The Cloud Compiler is the real deal that does the same thing as the launcher, but the result is an APK for Android and an XCode project for iOS - yeah, you can’t get away from xcode if you want to make an iOS app.

The bad

Trying to get up and running with CocoonJS, I struggled a bit to find the links to their actual Cloud Compiler service located here (I would bookmark that!). Also, their documentation has the basics about how to use the service, but doesn’t appear to list detailed information about supported features and current issues with the platform. However, I was able to find some blog posts that talked about various features.

Ludei also claims that you can run your app with no changes. This is almost true. I had to tweak the way the canvas object gets initialized in order for RK to run. Also, I had a major issue that broke the ImpactJS font system. For some reason the ImpactJS font system garbles the text when it runs inside CocoonJS. I tried investigating the issue a little but I was unable to find the root cause. However, I was able to work around the issue using the ImpactJS native font plugin by quidmonkey.

The last knock against the service is that they are currently free, but their pricing structure has yet to be announced. Supposedly that will change in 2013.

The good

Despite the confusing website and sparse documentation, I was able to get a complete version of our game working with both their Launcher and Cloud Compiler! Like I said, we’re still working through this new tech but so far it is very impressive and the game performs well on an iPhone 5 and Nexus 7.

It is a wonderful feeling to see your app installed on your tablet, and be able to demo your game to your friends and family anytime, anywhere!

Can I try too?

If John can do, so can you! Lucky for your we’ve created an open source boilerplate project on GitHub for using ImpactJS with CocoonJS. Currently it contains a sample that demonstrates initialization, sound, touch input, and the font workaround. Please feel free to send us a pull request if you’re able to add more to the example or fix the font issue!

Time will tell

So the real question is whether or not CocoonJS is a viable solution for deploying our/your apps. Unfortunately, the verdict is still out on that one until we know more about pricing. Also, we haven’t actually deployed anything yet, so that is the real test! We’ll be sure to be you posted on any progress we make. Our goal is to ship in the next month or two, but make sure to follow us for periodic updates!

blog comments powered by Disqus