World of Goo Stretches to Android* on x86

Introduction

World of Goo is a physics-based puzzle game by San Francisco company 2D Boy (a core team of former EA game developers Ron Carmel and Kyle Gabler).  Renowned for simple yet deep gameplay, World of Goo is set in a charming other-worldly setting with a high degree of polish. Among many awards World of Goo is in the Guinness Book of World Records as the highest rated game on iOS*. 

World of Goo was released on Windows* and WiiWare* in October 2008, with OS X* and Linux* versions following soon after. While its user base grew, an untapped market segment loomed: mobile. In April 2011 the game made its way to iOS, and was available on Android that November. Adding support for Intel® devices in was exceedingly simple and extended 2D Boy’s reach to the millions of users they have today.

The Mobile World of Yesteryear

2D Boy conquered all of their home entertainment targets by 2010, and wanted to find their next million customers. That year, they ported to iOS and largely because of the lesser power of that platform, they had to make some tough decisions to keep their game playable. Despite being just a few years ago, the current mobile landscape has changed significantly. The devices being targeted by 2D Boy in 2010 were less than half as powerful as today’s Intel-processor based systems. This performance challenge required skillful innovation in addition to consideration for the differences inherent in a shift to mobile.

Figure 1: Challenges loom overhead

Reworking the Textures for iOS

In the port to iOS, texture processing was a huge drain on the system. To minimize the rendering work, the polygons were batched in higher numbers to reduce the overall draw calls. 2D Boy used OpenGL* dynamic textures, which proved to be highly reusable due to multi-platform compliance. The textures did, however, need to be reduced, as reading large numbers of files from memory is a costly operation. Textures could need to be reloaded due to getting lost when the app resumes from a suspended state, which increases that cost. By arranging the textures into an “atlas,” a large unified texture from which individual parts are referenced by their location, the texture loading was sped up significantly. This approach has become the standard for mobile development.

This porting effort gained World of Goo another million downloads, but gaming didn't stop with iOS, and 2D Boy didn't stop looking for the next opportunity to reach even more users.

Figure 2: More users await!

On to Android

Compared to the intense optimization done for the initial jump to mobile (targeting iOS), taking the next step for Android devices required only minor changes. They tweaked the OpenGL context so things like the texture atlas weren’t lost when resuming from memory (you can find many similar articles about OpenGL on Android at Intel Developer Zone).

Once the game was ported to Android, compiling for Intel devices was as easy as adding a flag to the compilation script. With the power of Intel on mobile, the previous optimizations were more than sufficient to run smoothly. The steps to compile your app for Intel targets are as follows:

  1. In the <project root>/jni/ folder of your Android native application, create or open the file “Application.mk” (application-wide settings makefile)
  2. If the file has automatically been generated, there will be a variable called “APP_ABI” that defines target platforms for the build.  Most default builds will be for ARM* v7 devices by using “APP_ABI := armeabi-v7a”
  3. The two options for adding x86 support are either target multiple devices or create a build specifically for x86:
    1. To create a “fat binary” containing builds for multiple target platforms:
      1. Replace ‘APP_ABI := armeabi-v7a’ with ‘APP_ABI := all’ OR
      2. Replace ‘APP_ABI := armeabi-v7a’ with ‘APP_ABI := x86 armeabi-v7a’
         

       
    2. For a targeted x86 build, simply replace ‘APP_ABI := armeabi-v7a’ with ‘APP_ABI := x86’

The downside of using a fat binary is that the file is larger, which can be a concern for bulkier applications.  Once a user downloads the program, the operating system automatically selects the compatible binary section. If your app is already nearing the 50Mb limit, you can also build separate binaries for each, uploading them individually for the store to decide which a given user needs.

In the case of World of Goo, the fat binary "just worked" and ran smoothly, with the entire package still under 50 Mb. 

Note: If your build uses a custom tool chain, porting to x86 can be accomplished by executing your standard build sequence in the x86 folder instead of the ARM folder.

Figure 3: Bridging the gap

Making Mobile Worthwhile

By capitalizing on mobile segments and continuing to diversity until they reached their prime markets, 2D Boy is near (if not at) the top of many charts. While the efforts involved in porting a game to mobile are considerable, World of Goo is a prime example of how the work can pay for itself in the long run. If the game is already well-suited for a touch interface, there isn’t much to change for users to enjoy it on their phones. If the engine doesn’t use high-powered graphics, the mobile version won’t have to lose polish or risk becoming a battery hog. World of Goo was an ideal candidate for this and the job was well done, as is reflected by the rave reviews and numerous awards.

References

About the Author

Brad Hill is a Software Engineer at Intel in the Developer Relations Division. Brad investigates new technologies on Intel hardware and shares the best methods with software developers via the Intel® Developer Zone and at developer conferences. He is also the Engineering Director of Student Hackathons, running Code for Good hackathons at colleges and universities around the country.

Notices

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.

Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm

Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark* and MobileMark*, are measured using specific computer systems, components, software, operations, and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products.

Any software source code reprinted in this document is furnished under a software license and may only be used or copied in accordance with the terms of that license.

Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.

Copyright © 2014 Intel Corporation. All rights reserved.

*Other names and brands may be claimed as the property of others.