While working at our upcoming game Momo, I am keeping a close eye on performance. It needs to run smoothly (60fps) on an iPhone 3GS, and that is a constant challenge.

While its great to develop for mobile platforms, it can get tricky when you don’t obey the Golden Performance Rules of Lukas. ;)

There are a some simple rules like:

  • Forget about pixellights, too expensive (although the new hardware is looking promising!)
  • Keep your drawcall count low as graphic state changes are cpu expensive
  • Mark objects that don’t move as static
  • If they move, try to keep ‘em below 300 vertices, it will then be dynamicly batched
  • Don’t instantiate or destroy objects in runtime as memory is slow and it will create hiccups
  • Don’t alpha reject pixels on iOS devices because its slow on tile based rendering, use alpha blend instead
  • Don’t talk about polygon count but vertex count
  • Don’t rely on the 3D modelings package for your total vertex count, use the 3D engine instead as a number of things can influence this number
  • Don’t non-uniform scale your objects in an animation as they won’t be batched

On this last one I have a good example, with some pictures. (yay pictures!)

So here we have a nice cracked rock

In the game it will crack and fall apart

But wait, 2 drawcalls?

The complete asset is only 176 vertices and it should batch! Well it is batched, partially. Lets investigate it. The rock consists of 6 pieces. All using the same material? Check. All under 300 vertices? Check. All scales are uniform? Check. Or is it? Well on start it is but in the animation one of the rocks is slightly scaled in the x and y axis.

Okay, so walk to the artist, I tell him, he frowns, I explain, he frowns, he fixes, all happy.

At the bottomline: performance isn’t only a programmers thing anymore. For mobile, a lot depends on how game assets are created, you can’t get away with sloppyness anymore.

Oh and by the way, if you are an artist and you want to go up a few levels, please please please read the book Creating 3D Game Art for the iPhone with Unity. It will make your and my life a lot easier. It has been written by and for the game artist but even I enjoyed reading it!