From iOS to Android – Collin Jackson on porting Spirits

Andreas Zecher Jul 18 2013

Last year we released Spirits on Google Play, which became our second most important platform. We caught up with Collin Jackson, the co-founder of Apportable to talk about the technical details behind the port, and why doing customer support in-house is so important.

Without giving away the "secret sauce", how did you port Spirits from iOS to Android?

We built a custom compiler (based on Clang) that compiles and runs Objective-C source code on Android. We also wrote our own implementation of the iOS APIs that Spirits and other iOS apps commonly use.

Many people think that we are converting Objective-C to Java or emulating iOS on Android -- this is not what we do! We are running the Objective-C code directly on Android using the Android NDK, which is why we are able to make our games perform as well on Android as they do on iOS.

We’ve recently released a free downloadable version of our platform called the Apportable SDK. The SDK makes our technology available to any iOS developer looking to get on Android without the hassle of rewriting his/her app.

Running Objective-C and supporting all iOS APIs correctly on Android, this seems a bit crazy at first glance. Is it?

Yes! It is very crazy, and we don't recommend that anyone else try it, unless they want to work at Apportable! In all seriousness, it is a huge technical challenge. We have had tremendous fun automating ourselves out of the way.

What was the most difficult and time-consuming part of porting Spirits?

In the case of Spirits in particular, we had to spend a substantial amount of time dealing with OpenGLES driver bugs on many different Android devices. We also had to improve our implementation of UIKit -- all of the menus you see in Spirits are made with UIKit, not OpenGLES! Happily, this is code that we’ve been able to reuse in our platform and SDK for powering many games and apps since Spirits.

You keep improving your software engine that ports iOS games to Android. How do you ensure new versions of your software don't introduce bugs or break functionality of other existing ports?

We’re always upgrading our platform to support the newest features on Android/iOS as well as fixing bugs and generally improving performance. As exciting as the prospect of perpetual growth is, we are also careful to make sure that the changes we introduce don’t destabilize games that have already been released to Android users. We keep the code powering the live games separate from the main development flow and only integrate changes that are necessary to fix technical issues or support new features that are specific to the game. Then, whenever an update is ready for release, we use a combination of our own and outsourced QA to make sure that the new version is compatible with a representative sample of Android hardware/firmware configurations. After release, we pay close attention to user reviews, analytics, and technical support requests to quickly catch any problems introduced by the update. We’ve built up a great deal of experience releasing various kinds of updates to games powered by Apportable and have developed a pretty good sense of what to watch out for.

What are the best and worst parts about developing for Android?

The worst part about developing for Android is undoubtedly the fragmentation. There are thousands of different Android devices, mostly all of which we now support, but that is only because we spent the time debugging device-specific issues. For example, many devices have their own opinion about what are called "lifecycle events" -- instances where the operating system forces the app’s behavior to change due to a particular trigger like pressing the device’s power button. If you don't handle all of these issues correctly, you can end up with bad situations, such as having a game's sounds playing while the screen is locked or the game is in the background. Our experience has exposed us to many of these troublesome idiosyncrasies, which we then fix and resolve in our platform.

The best part about developing for Android is interacting with the users. Android users really love the games our technology powers, and they are not shy about letting us know. Not only that, many users who encounter issues with a game on their device are happy to help resolve those issues, even going so far as to install special builds we send them to find out whether or not we've fixed the specific problem they are encountering. It's a real pleasure to help out such big fans of the games we work on.

How many different Android devices do you have available in your office for testing?

We currently have over 150 Android devices in our library representing around 15 different device manufacturers. The devices range from the original Motorola DROID handset of 2009 to the recent Nexus 10 tablet and Galaxy S4. Our inventory includes the most popular Android devices as well as those which are unusual in certain ways. Most of the devices are one-offs, but we also have 20 Nexus 7s -- they are great for development and popular among users.

When a customer has a problem installing Spirits on their Android device, Apportable is handling the customer support. Do you feel that doing it in-house allows you to see and fix problems quicker?

We offer end user technical support in our higher tier support plans, and there are definitely benefits for us. Bug reports from end users are our single biggest source of information about issues that could potentially affect all of the apps powered by our software. Once we fix an issue for a particular game, we can apply that fix to our platform and propagate it to other apps in development or maintenance.

Which ports are you most proud of? Not counting Spirits of course. :)

Osmos will always hold a special place in our collective heart, since it was the first game released on Android via our platform, but all of the other innovative games we’ve helped bring to the Humble Bundle and other stores are dear to us. We have more great indie games coming, too!

After the release of Spirits on Google Play you kept improving the port based on player feedback. In a marketplace with hundreds of different device models, is on-going development as important as getting version 1.0 out?

It is critically important to support apps once they’ve launched. If there is a major issue that affects a significant number of users, every day that the app is not updated can have a major affect on the game’s rating. We prioritize fixes for apps that have just launched or are currently being featured, but we also update apps to implement editorial feedback from Google and Amazon, or to add support for new APIs like Google Play Games Services and Amazon GameCircle.

Do you have a question or comment? Get in touch on Twitter.