MotoGP: the power of blu-tack

Originally posted to Shawn Hargreaves Blog on MSDN, Wednesday, February 4, 2009

Along with biros, brollies, and butties, blu-tack is a classic British product that remains largely unknown in America. A shame, because it is a great tool for testing and optimizing game code!

The wonderful thing about blu-tack is that you can stick pieces of it on your TV to mark specific locations on the screen.

This is invaluable when dealing with title safe areas. Want to be more accurate than just guessing where the limit is? Too lazy to modify your game code to display it? Just run this sample (which will display the safe area as an overlay) and mark the four corners with pieces of blu-tack. Voila! Now you can instantly see if any graphics go outside these bounds.

Another use is for profile analysis. Development builds of MotoGP included a simple profiler that timed how long each subsystem took to execute. The results were displayed as a bar along the top of the screen, with a different color per subsystem and time along the horizontal axis. Half the screen represented 1/60 of a second, so if the bar got too far to the right, that meant we had a performance problem. "Yikes!" someone might cry, "Over an inch and a half of yellow! What's gone wrong with the AI code?" (although it pains me to admit I have entirely forgotten which color went with each subsystem).

Blu-tack came into play when trying to speed up a troublesome piece of code:

This made it trivially easy to see how my changes were affecting performance, and to keep a record of previous results by accumulating multiple markers. By the end of an optimization session, my TV was usually covered with tiny pieces of blue gum.

Blog index   -   Back to my homepage