Here’s a guest post from the developer of Autumn Dynasty on how they brought their real-time strategy game to BlackBerry 10. – written by Jeffrey Jiang (Executive Shaman, Touch Dimensions), edited by Justin Lee.

In the beginning…

The story began sometime in December 2012.That’s when Justin Lee, Application Development Consultant from BlackBerry, came to our offices to encourage us to port Autumn Dynasty, our flagship real-time strategy game, to the Blackberry 10 platform. This was not a high priority for us because we were using Ogre3D (an open source graphics engine) – which was not yet available on the BlackBerry 10 platform. The Ogre3D engine had to be tediously ported over before we were able to start working on it.

We were all astonished, amazed and surprised when Justin showed us the Ogre3D engine with the Ogre3D sample apps already working. The fact that it was completed just after the New Year stumped us all. That rate of efficiency was scary. Sometimes we have to be very careful of what we wish for.

Setting up the Environment…

Getting everything ready to start working on the BlackBerry was surprisingly easy. I downloaded the BlackBerry 10 Native SDK and followed the “Getting Started” documentation to set up my development environment. After that, I cloned the Ogre3D from the BlackBerry GitHub and followed the build instructions found inside BuildingOgre.txt to get the various libraries compiled and the sample Ogre3D app running on the BlackBerry Dev Alpha B device that Justin provided. It seemed like the easy part was over, but this also signified the arrival of the gargantuan task of porting the game over.

The porting begins…

Fortunately, we have a stripped down basic “Hello World” app for our game engine to ensure that the graphics, audio, and inputs work properly. That helped us isolate and test several components of Autumn Dynasty into a small manageable codebase with the least dependencies on each other. My plan was to get our “Hello World” app using our game engine compiled and running, fix the remaining issues, and then port the actual game over with all the fixes done.

Setting up the Game Project

Getting familiar with Momentics took a little bit of time because most of our development was done in Visual Studio. Setting up the game project in Momentics proved to be a bit of a challenge, especially with the various libraries and linking required. Based on my past experience porting several games across multiple platforms, I knew that the order of linking libraries were important. Not only that, I had to modify the code with #if defined (BLACKBERRY) code blocks for the portions that required BlackBerry specific code. I also had to compile the Boost library for BlackBerry 10 and link it to get the project running.

Upgrading to OpenGL ES 2.0

While setting up the game project, I realised that our game engine was using OpenGL ES 1.1, which was not supported in this version. However, it was easily rectified by switching to the OpenGL ES 2.0 renderer in Ogre3D with some updated code changes.

I immediately got a black screen when the app was deployed to the device. Nothing was being drawn! It took me some time to figure out that the fixed function pipeline was not available on OpenGL ES 2.0. Instead, another plugin, the RTSHADER system from Ogre3D, was used to successfully get our “Hello World” app working.

Getting Input Working

With visuals finally showing, it was time to handle the touch inputs. It was a pretty straightforward process. I polled for OS events using bps_get_event() and processed all the input events from there.

Getting Audio Working

In the iOS version, we had background music with 8 sound effects channels. OpenAL was used for the sound effects and AVAudioPlayer (the iOS audio class) for the background music. In order to get OpenAL working, I had to compile the OpenAL library for BlackBerry 10 and add that library into the project. For the background music, all I needed to do was to substitute AVAudioPlayer for mmr_play().

Cleaning Up and Compiling the Game

After some tweaking of our game engine and figuring out the several linking issues, I finally got our “Hello World” app running on the BlackBerry 10! All that remained was to create a new Momentics project for Autumn Dynasty, move all the source code and the modified source code from our test app, and build the project with the proper linking order.

There was a tense moment of silence while the code was compiled, and then linked. It then took several minutes to deploy the game into the BlackBerry Dev Alpha B device. Cheers of joy erupted when my colleagues saw the game in action. Finally, we succeeded! It was not without bugs and stability issues, but at least the game was running, with audio and touch too! We were all  excited to see Autumn Dynasty running for the first time on the BlackBerry 10.

The issues…

Despite getting the game running on the BlackBerry Dev Alpha B, there were several bugs and issues that needed to be fixed before it could be released for beta testing.

Fixing Color Order

It was immediately noticeable that something was not quite right with the game as the colours were off for several images. One of the dependency libraries for Ogre3D that was precompiled is the libFreeImage, which is used for loading png images. Because of the endianness of the BlackBerry 10, RED and BLUE colours were swapped. A simple recompilation of the libFreeImage by changing the FREEIMAGE_COLORORDER to use FREEIMAGE_COLORORDER_RGB instead of FREEIMAGE_COLORORDER_BGR fixed the issue. The changes were then submitted back to GitHub.

Slow Deployment

Another issue I had when developing for BlackBerry 10 was the slow deployment time. It took me about 10 minutes to deploy to the BlackBerry Dev Alpha B device as there was around 200MB worth of content. There were several solutions to do a delta deployment. However, I only looked into this much later as it wasn’t a big issue, just more of an annoyance.


Overall, it was a pleasant experience porting Autumn Dynasty to BlackBerry compared to other platforms. The performance and responsiveness on the device is great; the screen and graphics are stunningly sharp. There will always be lots of issues when porting a huge game like Autumn Dynasty, but with the amazing support from the BlackBerry Developer Relations team, we were able to resolve all the challenges and got Autumn Dynasty up and running on the platform in just a matter of weeks.

Summary Points

  • Have a stripped      down test app to individual components of the game engine
  • Order of linking      libraries were important
  • Use #if defined(BLACKBERRY) code      blocks for BlackBerry specific code
  • Use OpenGL ES 2.0      for graphics, bps_get_event() for input, OpenAL      and mmr_play() for music
  • Beware of      endianness and deployment time.

You can purchase Autumn Dynasty at the BlackBerry World.
Find out more information about porting your native app/game to BlackBerry 10.


See the original article here – 

Porting Autumn Dynasty from iOS to BlackBerry 10