Sunday, January 15, 2012

Current and future work on BlastZone 2

Welcome to another blog entry for BlastZone 2!  In this entry, I will go over some of the future plans for BlastZone 2 and my game development work in general.

As of the time of this writing, the latest v1.10.2 free update for the iOS version has been released, and the feedback has been great!  People really like the new relative touch control scheme and auto-fire option and achievements support.

The new relative touch iOS control scheme with movement cursor
Also, I recently completed the iOS 4.x compatibility update which will help bring BlastZone 2 to a much broader group of iOS users.  When I started working on the iOS version, I made sure I updated to the latest Apple development tools.  However, doing this created several dependencies on the latest iOS 5 and broke compatibility with iOS 4 and earlier.  For the initial release, I decided to require iOS 5 to play the game, as I briefly attempted to backport the code to iOS 4 and things broke apart rather quickly.  I didn't want to risk a broken game or buggy release.  However, this time I've spent a lot of extra time researching the differences between iOS versions from a technical perspective.

I've had to completely rewrite the OpenGL ES initialization code in a much more advanced way for it to work across multiple iOS versions. The iOS 5 development tools had some convenient built-in infrastructure that allowed me to complete the initial version quicker, but this broke compatibility with previous iOS versions so it wasn't a good long term solution.  I've also had to write code to enable certain features for people with higher iOS versions while maintaining compatibility with earlier versions.  I've tested and confirmed the new update to work for all iOS versions including 4.0 and above.

Since the compatibility update is done and waiting on Apple to push to the App Store, I have already moved onto the multiplayer update.  This one will take a bit longer than the previous updates as I have to port over all the PC multiplayer code and do the iOS Game Center integration for it.  Game Center is a great platform to develop support for server lists, friend challenges, and match making.  This will all help foster a great multiplayer community and help grow popularity for the game.  I will also be looking into bluetooth ad-hoc support.

I've done a lot of research for iOS multiplayer so far and it will be an interesting challenge for me.  I got the PC online multiplayer support to run very fast through some CPU-intensive delta detection and bit-level compression algorithms.  I was able to offset the additional CPU load by making the PC implementation multithreaded.  For iOS, I will be able to leverage a decent amount of multithreading, but the problem is only the latest iPhone 4S and iPad 2 have a multicore CPU to benefit from from that kind of design.  Crunching this down to perform well on the iPhone 3GS for example will be an interesting task, but if I make big efficiency improvements like I did for several other areas of the game, I will definitely release a patch for the PC version with them as well.

From there, I will move onto researching other platforms to port BlastZone 2 to.  First on the list will be Android.  I've been getting a lot of demand for an Android version and I did a lot of research on a possible Android version back in September of 2010.  The idea back then was to develop simultaneously on Android and PC, but I was having problems getting C++ code to compile at all.  I started spinning my wheels at that point, so I decided to refocus on the PC version and revisit Android later on.  It turned out compiling C++ code on iOS was much easier, so that's why I put off Android support a bit more.  Through all this, I can confirm that I will put effort into an Android version in the future, but I can't guarantee it will be released for the platform at this point.

I have ideas for entire new games in the future as well.  Some of these games are smaller in scope, and others are larger in gameplay scope, but will take significantly less time to develop due to their design.  Either way, I will be reusing a lot of code from the current BlastZone 2 game engine, so there won't be any more 5 year long development cycles.

The future looks exciting and I can't wait to get more content and updates out for everyone to enjoy!  I am totally committed to releasing all of these BlastZone 2 updates for free!  So keep the feedback coming and I'll be happy to comply!

Tuesday, January 3, 2012

BlastZone 2 Makes its way to iOS!

Once I accomplished all the goals I set out to do for the PC version post release, I decided to start working on the iOS port for the game in November '11.  A year prior, I had already done a lot of work on an alternate render path for OpenGL ES, which is used for graphics programming on mobile devices.  Since the PC version uses the desktop version of OpenGL, this transition doesn't require replacing all the graphics code.  There were other systems I had to rebuild to work on iOS, such as the sound and input systems, but they are much smaller than the rendering system.

** This section gets a bit technical if you're curious **

Most of the OpenGL commands that aren't available for mobile devices I was able to replace with generic code that works on both the mobile and desktop versions of the game.  However, there is one big feature of desktop OpenGL that I didn't want to remove for the mobile version, which is why I built the engine to have two render paths.  The PC version of BlastZone 2 renders most of the graphics using something called a "Display List", which is very fast to draw even on slow computers, which allows me to add more detail to the game without slowdowns.  This method of drawing can only be used in specific circumstances effectively, but BlastZone 2 just happens to be the perfect game for this.  Virtually every model in the game is perfect for this method of drawing, such as airplanes, space ships, and terrain.  The types of models that are bad for this drawing method are more animated ones, such as people and animals.  Instead of Display Lists, OpenGL ES has to fall back to using Vertex Buffer Objects(VBOs) to speed up rendering.  While the speed of this method is respectable, the main reason I assume this was favored is because it can be used for any model type and isn't restrained by favoring specific types of models over others.  However, VBO's are much slower to render than Display Lists, and are roughly half the speed during my tests on the PC version.  Having a slower device that uses a slower rendering method really compounds performance issues, so it was an uphill battle to bring performance up to where I wanted it.  I put a lot of optimization work into the VBO render path for the game and had really tangible results doing so, but it never cought up to the performance of the Display List render path.

** End technical jargon **


When I finally got the game to compile and run on the device, it was a huge moment for me.  While the game was only chugging along at around 5 to 6 frames per second, it was so incredible to see my creation running on such a tiny device that can fit in your pocket.  Up to now I was only used to seeing BlastZone 2 run on a big desktop pc or a laptop.


BlastZone 2 up and running on the iPhone for the first time!


As an engineer, developing for iOS is an interesting and fun problem to solve.  I had to squeeze my existing game into a device that has much less memory and processing power by figuring out a lot of slick optimization techniques, pushing my programming abilities to the limits.  I had to do this while getting the same amount of work done in the end and keeping the game looking almost identical to the PC version.  Fortunately, all iOS devices use a PowerVR graphics chip that supports a very efficient texture compression technique that worked really well crunching down memory requirements without affecting image quality.

The other big goal I was shooting for was crunching the app download down to 20mb so it can be downloaded over a 3G connection and therefore more accessible to my audience.  It was tough, but I managed to do that as well, compressing down the audio and textures without a noticable difference to the player.

All the above helped a lot, but it still wasn't enough to get the performance to a level I wanted.  I had to fall back to reducing geometry complexity as an easy speedup.  I managed to do this in an intelligent way, and with the smaller screen of the iPhone, the game looks almost exactly the same as the PC version.  This brings the graphics fidelity to be very close to some of the best looking games on the platform, which really helps BlastZone 2 stand out on the Apple app store.

Working with iOS gave some great opportunities for adding new control schemes to the game.  The first control scheme I implemented used a virtual d-pad that mimicked how a PC controller or keyboard would play.  From there, I added an accelerometer tilt control option to give an intuitive way to control the ship without having the touch the screen and cover the gameplay. The third control option I implemented was a direct touch control, which moves the ship to your finger, giving the player much more direct and precise positioning not possible on other platforms.

iOS version shaping up really well!
The iOS development had one other good side effect.  I had to put a lot of work into optimizing the performance and memory usage to help the game run acceptably on the iPhone.  Since the game uses a unified code base, I was able to easily bring those optimizations to the PC version, reducing the minimum specs even more without any loss in quality.  I was even able to get the game running at full detail at 60 fps on a netbook which is quite an accomplishment.

Overall, it took about a month and a half to complete the initial port of BlastZone 2 to iOS, which greatly exceeded my expectations.  There were two main reasons for this.  The iOS development environment is very  friendly to C++ development, which integrates seamlessly into the Objective-C based development kit.  Secondly, as I mentioned earlier, iOS uses OpenGL ES to render 3D content, which is very similar to the desktop OpenGL the PC version was written in, but with several functions removed.

Even though the iOS port was done rather quickly, this was at the expense of a few features to get it done in time for the holidays.  The main functionality missing was Apple Game Center integration, which most of the upscale iOS releases do have.  I was able to release an update soon after release to add basic Game Center support and leaderboards since these didn't require much code and I could reuse much of the leaderboard code from the PC version.  At the time of this blog entry writing, I am researching and will begin porting over online multiplayer support very soon.  Online multiplayer support will be a killer feature for BlastZone 2, as its very rare for an iOS side scrolling shooter to have it.  The big advantage I have is that I already wrote all the core logic to get online multiplayer working from the PC version.  The main task now is to integrate it into the Apple Game Center and have Ad-Hoc support at the same time for really low latency play.

BlastZone 2 shortly before the iOS release

Initial reactions and feedback have been very positive and download rates have been great, but I quickly got a list of features people were looking for to improve popularity of the game.  The main control scheme people wanted for an iOS side scrolling shooter is relative touch, which allows the user to move the ship around the screen by the relative touch movement on any part of the screen so this ship doesn't get covered.  Also, people wanted an auto-fire option.  Thankfully, these features were fairly quick to implement.  At the time of this writing, these new input features have been completed along with Achievements support and I'm excited to ship the update out to my audience.

I hope you enjoyed reading about my experiences with the iOS version of BlastZone 2.  Its been a very exciting process and release for me, and the feedback has been incredible!  Downloads and sales have already far surpassed the PC version and I can't wait to ship more updates and features for the game!  As it turns out, BlastZone 2 is very well suited to the iOS platform!

In my next entry, I will detail the future of BlastZone 2 both for the iOS and PC versions along with the other directions the game may take.  See you next time!