Cross Platform 2D Games DevelopmentPosted by: Aamir Ibrahim
2nd July 2013
In the early days of the smartphone race, Apple’s iOS reigned supreme as the iPhone had the lion’s share of the smartphone market. iOS was the development platform of choice for mobile game developers in those days with the majority of mobile games being developed as native iOS apps.
However, with the increase in usage of Android, the equation has changed considerably. Today Android is the world’s leading mobile operating system, accounting for 75% of global smartphone sales in Q1 2013, according to the IDC.
These days mobile game developers must focus on both platforms in order to remain competitive. According to the IDC, Android & iOS combined accounted for 92.3% of all smartphone OS shipments in the First Quarter of 2013 (IDC). Given that each of them has its own range of phones and tablets, with multiple screens and operating system versions; it is no longer feasible to develop games as native apps, as that restricts them to a particular platform. In order to gain maximum market share, while remaining cost effective, it is essential for developers to ensure that their mobile games run on both platforms and their myriad devices.
The Drawback of ‘Native’ Games
Going ‘native’ places several limitations upon the game. For starters, the development cost is higher, as the amount of efforts required in design and development and the expenses involved in maintaining and updating native games on multiple platforms are substantial.
Cross platform support is another limitation, as it’s harder to port native games to other platforms due to the architectural differences between each platform. Native games have to be redesigned and coded from the ground up in order to be successfully ported – an expensive proposition for any developer, considering the efforts involved.
We experienced this first hand when we tried to port our smash hit native Android 2D game Candy Monster (developed on AndEngine) to iOS. When we estimated the efforts involved in the process, we discovered that the cost would be too high for the exercise to be feasible; as the entire game had to be recoded and retested for iOS. A key contributing factor to this high cost was the need for Objective C developers, who typically cost a lot more than Android developers.
A few months down the road, we faced a similar problem when we tried to port our native iPhone 2D game Air Viking (developed on Cocos2D) to Android. Here again, the amount of efforts and costs involved in redesigning the entire game in Android, made the project unfeasible.
Cross Platform – Myth or Reality?
These problems pushed us towards considering cross platform development, as that would enables you to code the game once and deploy it on multiple platforms, without going through the painful process of porting. When we started looking into this idea, we found that there were already a number of tools available that facilitate the development of cross platform 2D games. These include:
- Adobe AIR + STARLING
- Unity 3D (using some 2D packages)
Corona is a popular choice amongst 2D games developers. It offers wide cross platform support (including iOS, Android, Amazon and Nook) and allows the use of industry standards such as OpenGL, OpenAL, Google Maps, Box2D, Facebook, Game Center & in-app purchases in the game’s development. The Corona API is also easy to use and makes tasks like animating objects, creating UI widgets or enabling physics a breeze, by requiring minimal coding. It also comes with a nifty built-in simulator that allows you to view the impact of code changes on the fly. The platform also boasts a number of famous titles in its portfolio like Major Magnet, Shaq, Freeze! and Sparky the Shark.
Unity is another popular option for cross platform games development. However we found that it is more suitable for 3D games development (more on this in a follow-up post) and is not really the best choice for 2D mobile games development.
Next we looked at the Starling framework, which is an open source engine for FLASH. It’s basically an ActionScript 3 2D framework developed on top of the Stage3D APIs and is available for the desktop in Adobe Flash Player 11 and Adobe AIR 3. The great thing about Starling is that it is specifically designed for 2D games development and allows you to write fast GPU accelerated apps without having to touch the low-level Stage3D APIs. This ease of use and the extensive cross platform support offered by Adobe AIR makes it a very popular choice for 2D games development
mobile & web-based game developers. Some of the most popular games to date have been built on the Adobe Air platform such as Angry Birds Facebook, Farmville 2, Super Hexagon, Song Pop and Machinarium to name a few.
Our sister company, SecretBuilders, has also used the Adobe Air platform extensively in the development of their mobile games. In fact, all of their mobile games have been developed using Adobe Air, including fun-filled titles such as Sherlock Holmes, Fashion Superstar, Snow White, Dr. Jekyll, The Wizard of Oz and Puppy Run Free; all of which are available on both iOS and Android, thanks to Adobe Air.
Adobe AIR and Starling – 2D dreams come true
From all of the tools mentioned above, we found the combination of Starling & Adobe Air to be most suitable for cross platform 2D games development, due to the following reasons:
- Starling uses the same concepts as Cocos2D and AndEngine thus our Android and iOS developers, who had worked on these two platforms, were easily able to adapt themselves to this new framework.
- Starling also provides wide cross platform support, which not only includes mobile but desktop and web browsers as well.
- Starling also enables you to write fast GPU accelerated applications without requiring the use of low level Stage3D APIs
- Starling allows for rapid application development, as you only need to write the code once and can deploy it on all platforms (android, iOS, web, etc.), since the developed game can be exported directly to the desired platform as a native app (APK for Android, IPA for iOS, etc.). For example, when we decided to port a board game we had developed for Facebook using Adobe Air/STARLING, to the iPad, we were able to utilize the same code that we had written for Facebook, for the iPad as well, with all the functionality working. All we had to do was minor UI tweaking which only required 2 weeks of work after which, the same game ran perfectly on the iPad as well.
- Starling offers excellent features for adding physics, particle effects and textures to 2D games and also supports blend modes and tweens for adding special effects and animations, and multi-touch gestures and bitmap fonts.
- Developing on Starling enables automatic support for multiple display resolutions in the developed game, as Starling features Display Resolution Awareness and will choose the optimal set of textures in the game at run-time, depending on the device display being used.
- Both Adobe Air & Starling offer substantial extensibility support, allowing developers to write custom display objects, plug in their own fragment and vertex shaders, or integrate native features like Game Center and IAP (using native extensions) or third party Ad SDKs.
- Both platforms also facilitate easy source code management, via the use of hierarchical display trees and a powerful event system
The following is a great tutorial on the Starling framework by Hemanth Sharma, to help get you started.
Using the Starling and Adobe Air combination has helped us immensely in cross platform games development. Given the proliferation of Android nowadays, almost all our clients want their games to support both iOS and Android, with some even requiring the game to run on Facebook as well. Using frameworks like Starling, we have been able to deliver on these cross platform requirements while cutting development efforts and costs by 40% to 60%. Moreover, the games developed via these frameworks run as native apps on the platform in question, with full support for hardware acceleration. There is no dip in performance at all, contrary to the common misconception about cross platform development.
Given these benefits, we believe that cross platform is the best approach for mobile game development and the most cost effective strategy for companies looking to get a quick foothold in the mobile games market.
Folio3 provides cross platform games development services for iOS, Android and the Web. If you are interested in hiring us for your project or would like to know more about our games development services, please contact us at firstname.lastname@example.org.