Porting the Android* Bullet Physics Engine to Intel® Architecture


Mobile games with stunning graphics and realistic physics are now possible due to the increasing compute power now available on mobile devices. Effects such as grenade explosions in shooter games and car drifts in racing simulators are provided by the physics engine, whose heart is physics simulation. Typically, physics simulation determines the performance of the game engine. A game’s success often depends on how fast and accurately the physics engine computes the physics model.

This article shows you how to build and port the Android version of the Bullet Physics engine to the Intel® Atom™ SoC-based platform.

Bullet Physics

The Bullet Physics Library is a real-time physics engine, used in many computer games, movies, 3D modeling systems, as a component of other game engines, and other applications [http://bulletphysics.org]. In mid-2011, a version that supports the Android OS (ARM NEON*-optimized) was released.

We first ran a Bullet Physics application on a Samsung Galaxy* Tab 3 10.1 with an ARM-based processor and measured 30 frames per second (FPS). We then ported the same Bullet Physics application to the x86 architecture. We ran the Bullet Physics application on the same Samsung Galaxy* Tab 3 10.1, now with an Intel® x86 processor and measured 60 FPS. We compared the performance of each using Intel® Graphics Performance Analyzers [http://software.intel.com/en-us/vcsource/tools/intel-gpa].

By porting applications to x86-architecture, developers get an additional frame time budget, increasing the calculation speed of physics in their game, so they can spend more time on either more realistic graphics or more movement in their games.


To build and port Bullet we need:

The whole process can be run on either Windows*, Linux* or Mac OS*; it does not differ fundamentally on Linux and Mac OS from the Windows effort. Test runs were performed on the Lenovo K900 and Samsung Galaxy* Tab 10.1 3. Both devices are based on Intel Atom processor Z2460.

A script that automatically performs all the actions described in this article is attached.


Build and run the sample application PfxApp_1_Simple under ARM as the first step.

Figure 1. Sample application PfxApp_1_Simple (device Samsung Galaxy* tab 3 10.1).

Then we’ll build the PfxLibrary library, the main component of the physics engine. To do this, go to the library project directory:


<BulletPhysics> is the path to the bullet-2.80-rev2531 folder. Open the Android.mk file in this directory and find and replace the declared variable, like so:

LOCAL_PATH := <BulletPhysics>\bullet-2.80-rev2531\Extras\PhysicsEffects

Next, open the console and navigate to:


Run the command:


Success! We built PfxLibrary for armeabi-v7a.

Let’s build the sample application. Navigate to the directory:


Open the Android.mk file and replace the declaration:

LOCAL_PATH := <BulletPhysics>\bullet-2.80-rev2531\Extras\PhysicsEffects

In the command prompt, change directories to the project folder:


Run the command:


We use Eclipse IDE to start the application. Import the project into Eclipse:

File => Import => Android => Existing Android Code Into Workspace => Browse… =>
<BulletPhysics>\bullet-2.80-rev2531\Extras\PhysicsEffects\project\Android\PfxApp_1_Simple\ =>
OK => Finish

Run the sample application. Click the right mouse button on the project icon and select Run As => Android Application, as shown in Figure 2.

Figure 2. Launching an application from Eclipse* IDE

The sample will run in translation mode.


Let’s port this sample PfxApp_1_Simple to x86. Begin with the core PfxLibrary library. Navigate to the project folder:


Open the Application.mk file and change this declaration:

APP_ABI := x86

Make these changes to the Android.mk file:

LOCAL_PATH := <BulletPhysics>\bullet-2.80-rev2531\Extras\PhysicsEffects

Remove the ARM NEON-optimized assembly files by deleting these lines from the LOCAL_SRC_FILES declaration list:

src/base_level/solver/pfx_constraint_row_solver_neon.cpp \

Rebuild the physics engine. In the command prompt, change the working directory:


Run ndk-build. We now have built the PfxLibrary for x86 architecture. Repeat these actions to port the sample application. Navigate to project directory:


Open the Application.mk file and replace the declaration:

APP_ABI := x86

Change variables in the Android.mk file:

LOCAL_PATH := \bullet-2.80-rev2531\Extras\PhysicsEffects
LOCAL_SRC_FILES := project/Android/PfxLibrary/obj/local/x86/libpfxlibrary.a

Remove these lines from LOCAL_SRC_FILES:

sample/test_ARM_NEON_performance/neon_dot_product.S \
sample/test_ARM_NEON_performance/neon_cross_product.S \
sample/test_ARM_NEON_performance/neon_matrix4_operator_multiply.S \
sample/test_ARM_NEON_performance/neon_matrix3_operator_multiply.S \
sample/test_ARM_NEON_performance/neon_orthoInverse_transform3.S \
sample/test_ARM_NEON_performance/neon_transform3_operator_multiply.S \
sample/test_ARM_NEON_performance/neon_transpose_matrix3.S \
sample/test_ARM_NEON_performance/test_neon_cross_product.cpp \
sample/test_ARM_NEON_performance/test_neon_dot_product.cpp \
sample/test_ARM_NEON_performance/test_neon_matrix3_operator_multiply.cpp \
sample/test_ARM_NEON_performance/test_neon_matrix4_operator_multiply.cpp \
sample/test_ARM_NEON_performance/test_neon_orthoInverse_transform3.cpp \
sample/test_ARM_NEON_performance/test_neon_transform3_operator_multiply.cpp \
sample/test_ARM_NEON_performance/test_neon_transpose_matrix3.cpp \

Change the working directory for the project folder:


Build the project using the ndk-build command, then run the sample on the device.

Use the APK Info application from Google Play to view supported architectures [https://play.google.com/store/apps/details?id=com.intelloware.apkinfo].

Figure 3. Screenshots of APK Info (device Lenovo K900)


This article provided step-by-step instructions for how to build and port the physics engine, Bullet Physics. The result of successfully porting the application to x86 architecture is a 2x speedup of the physics portion of the application and improved frame rate (FPS).

About the Authors

Ilya Krjukov (ilya.krjukov@intel.com) – Sr. Software Engineer

Denis Smirnov (denis.smirnov@intel.com) – Software Intern

Related Articles and Resources

  • Porting Low-Level Parts of Android* Native Applications to Intel® Architecture-based Platforms
  • Intel for Android* Developers Learning Series #7: Creating and Porting NDK-based Android* Applications for Intel® Architecture
  • Creating and Porting NDK based Android* Apps for IA
  • Porting OpenGL* Games to Android* on Intel® Atom™ Processors (part 1)
  • Porting OpenGL* Games to Android* on Intel® Atom™ Processors (part 2)

Intel, the Intel logo, and Atom 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.

For more complete information about compiler optimizations, see our Optimization Notice.