October 5th, 2015

How Visual Studio gives Halfbrick ninja powers

For this post we welcome Nicholas Cornelius and Miguel Pastor from Halfbrick as guest authors on the Visual Studio Blog.

Halfbrick games, including Fruit Ninja and Jetpack Joyride, are released on multi platforms. To minimize per-platform overhead, our games are written primarily in C++ with only small portions of platform-specific code written in Java or Objective-C for Android and iOS, respectively. [Note: one can use 100% C++ on the Windows platform because it’s one of the supported languages for native app development, alongside C#, Visual Basic, and JavaScript—Ed.]

For us, it’s hugely important to minimize the time it takes for every develop-build-debug iteration. With most of the daily work happening in Visual Studio 2010 targeting Windows, however, we’ve have to contend with some big challenges. Fortunately, Visual Studio 2015 has made our process much more efficient as we’ll describe in this post.

Halfbrick development

Meeting challenges with Visual Studio 2010, ninja-style

Five years ago, Visual Studio 2010 didn’t have support for cross-platform development. To target Android, we first needed to create makefiles for the Android build system. That was tedious work, using an external process outside Visual Studio to compile for Android.

Tracking compiler errors was hard and we had to manually sync Visual Studio project files with Android makefiles. With more people joining the company and more projects kicking off, this process was impossible to scale.

With project deadlines looming, we decided to write a new Android target for Visual Studio 2010 using MSBuild. This was not an easy task because MSBuild information was scarce. It took three effort-months to complete.

Getting the building pipeline inside Visual Studio was only the beginning. Debugging was just as challenging. To debug a crash in Android, we had to rely on the old college-student standby: printf debugging. It worked, but it was slow and painful.

Because Android development was our highest priority, we decided to write a Visual Studio debugger extension for Android. Again, information was scarce and it was a big engineering task, taking three effort-months.

However, the benefits were invaluable. Engineers could test games on Android devices faster and more often and spend less time fixing crashes.

We continued improving our Android pipeline leading to faster iteration times, reduced the APK size by moving game assets to the SD card, only updating the .so files when C++ files were changed, and caching the java compilation.

It’s certainly been a long journey with Visual Studio 2010! But now we’re delighted that Visual Studio 2015 brings built-in supports for these requirements.

A New Era with Visual Studio 2015

First of all, Visual Studio 2015 had greatly improved compiling and linking times for C++ code. This makes a huge difference with a large codebase: faster iterations means higher productivity for our developers. [Details for C++ tooling improvements can be found in the Visual Studio 2015 Product Guide—Ed.]

The new memory profiling tool has also been very helpful for finding memory leaks. Previously, we had to write our own tool and write an external program to process the memory traces. Now it all works natively within Visual Studio—and it’s fast. If you haven’t tried it out already, consider this our invitation!

Memory profiling tool

Visual Studio 2015 cross-compiler support is excellent. We’re able to use the Clang and GCC toolchains to build native Android binaries:

Cross-compiler support for clang and gcc

Android debugger works seamlessly, and being in open source ensures constant improvements such as Java debugging.

Java debugging

MSBuild is also open source now, making the development of new platforms for Visual Studio a whole lot easier.

The Big Win: iOS cross-compiling support

A big win for Halfbrick with Visual Studio 2015 is iOS cross-compiling support. This means that with a Mac dev machine on the network, we can compile, deploy, and debug on iOS devices directly from within Visual Studio. In short, with Visual Studio 2015 we have a single environment in which we can develop, build, and debug our apps on Windows, Android, and iOS.

iOS cross-compiling support


[For more details, see
Visual C++ Cross-Platform Mobile on visualstudio.com and the Visual Studio 2015 Product Guide—Ed.]

In Closing

At Halfbrick we believe Visual Studio 2015 is the best IDE, and we’re beginning to use its features and capabilities on a daily basis. With issues around tools, debugging, and the overall development pipeline now a distant memory, our engineers are empowered to provide best-in-class support for Windows, Android, iOS. Microsoft is also embracing open source for the cross-compiling support, which allows us to be agile in finding solutions to make our games better.

In short, because we no longer need to struggle with the tooling, we can focus our development time all the more on improving the quality of our games and the enjoyment they deliver to Halfbrick customers.

 

clip_image008

Nicholas Cornelius is the Chief Marketing Officer for HalfBrick Studios and is a digital marketing specialist with more than 10 years experience across the finance, publishing, technology and gaming industries.

image

Miguel Angel Pastor is a senior engineer in Halfbrick Studios, game developer since 1998 with heavy experience across several areas,3d graphics, low level programming and optimization technologies.

Author

Visual Studio has been around since 1997 when it first released many of its programming tools in a bundle. Back then it came in 2 editions - Visual Studio Professional and Visual Studio Enterprise. Since then the family has expanded to include many more products, tools, and services.

0 comments

Discussion are closed.