11 Nov Animations Are Evil, Performance Rules
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!
mipago
Posted at 14:13h, 13 Decemberthanks for your tutorials, I want to buy the book.
but I need to know, what is the real deal.
please tell me the price and content of the book
Derk
Posted at 16:59h, 13 DecemberHi Mipago,
You can find the book here on Amazon: http://www.amazon.com/Creating-Game-Art-iPhone-Unity/dp/0240815637/ref=sr_1_1?ie=UTF8&s=books&qid=1287013870&sr=8-1
There is a sneak peek and you can check out some reviews. Hope this helps!
Greets,
Derk
Alok Krishali
Posted at 19:18h, 23 JanuaryI am new in unity Game development…Yesterday a work has given to me..I have to optimize a sniper shoot game..that is for VR. So during game start some jurk is coming in game..When i saw unity profiler. It showed some hump in render..On detail i saw Occlusion Culling.. How to improve.. and optimize..Also tell me about how to apply static batching in unity game.