Fun Infused Games  |   Smooth Operator

  Home   |    Archive   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact and I will try and recover/find it.

Performance Testing an Xbox Live Indie Game
Date 2/22/2010    Tags XBLIG, XNA, Abduction Action!    (0)

When developing Xbox Live Indie Games, one thing you'll realize pretty quickly is that performance can vary greatly from PC to Xbox. For me, it is mainly with floating point calculations and garbage collection, where the Xbox comes across as severely underpowered (mind you, I don't do multithreading programming for simplicity's sake and the floating point bit would likely be different if I did). I touched on this a bit during my development on Nasty and felt it was important enough to mention a second time during development of Abduction Action!.

I mostly develop my XBLIGs on the PC (as I'm sure many other developers do too) with the occasional testing on the Xbox to make sure things work as they should. Recently they did not. Abduction Action! would run at a solid 60 fps and then mysteriously drop (for only a fraction of a second) into the low double-digits. This was not enough to make the game unplayable but enough to be noticeable and annoying.

When it comes to optimizing code, don't just haphazardly optimize area of your code without knowing if they're actually a bottleneck. No amount of speeding up one section of code is going to improve your game's performance if the bottleneck is elsewhere and falsely assuming a bottleneck can actual make things worse (more on that later). For these reasons, I turned to a few tools of the trade in order to deduce exactly where my (game related) problems lie.

The first tool I used was called "XNA Framework Remote Performance Monitor for Xbox 360" and comes installed with the XNA Game Studio. This is a nifty utility that allows you to monitor the performance of your game as it runs on your Xbox. Instructions how to do this can be found here. Running this utility showed me that as much as 13% of the Xbox's CPU was being devoted to garbage collection during the course of the main game (ideally this would be zero percent but realistically that won't happen). While this clearly told me there was a problem, it didn't tell me where that problem was coming from.

To address the garbage collection issues, I went through my code and removed ForEach loops that were on large collections and replaced them with standard For loops (ForEach loops create lots of garbage so these were an obvious improvement point). I additionally made sure reference type values were not being initialized and used as local variables in any of my update methods. If they were, I made them global variables for that class and just reused them when needed (thus preventing the garbage collection/overhead associated with creating and disposing of the objects during my gameplay loop.

While these improvements didn't resolve everything, they did cause a noticeable decrease in garbage collection. There is likely still more I can (and will) do but these where two fixes that were both easy and quick to accomplish.

Next I attempted to use the popular CLR Profiler and then the NProf profiler in order to further narrow down performance bottlenecks in my game. For reasons that I cannot explain (but will for now blame on Windows 7 incompatibilities), neither of these applications worked (respectively they didn't log anything and crashed when I tried to profile my game). This lead me to try a trial version of Red Gate's Performance Profiler.

Red Gate's Performance Profiler worked great... after running the profiler along with my game (on the PC), it generated a whole bunch of information. Most useful to me was a listing of all the different methods called in my game along with what percentage of time they were running in comparison to the rest of my program. From this data it was

This article has been view 1207 times.


No comments for this article.

Add Comments

Name *
  Name the animal in the picture below:

Comment *
Insert Cancel
Things To Click

Video Games (7)  Trivia or Die (3)  SQL (1)  iOS (3)  Game Dev (11)  Advise (14)  PC (1)  World of Chalk (2)  FIN (20)  Abduction Action! (27)  XBLIG (32)  Abduction Action (1)  Nastier (4) (18)  Absurd (2)  Volchaos (11)  Web (19)  Fin (1)  XNA (40)  Rant (50)  Cool (2)  Visual Studio (1)  Trivia Or Die (1)  Xbox (1)  C# (14)  Sports (11)  Design (2)  Development (13)  Hypership (28)  WP7 (8)  VolChaos (1)  Nasty (34)  Abdction Action! (1)