DOL Quickie – Rotation Performance

DOL Quickies can be read easily out of order. They will often discuss performance or unique ways to handle problems. The first quickie discusses C2 Rotation Behaviour and it’s effect on performance. This is a small post. One of the major designs for DOL is run on mobiles. Including being playable on my A500(Tegra2) for now. I may not hold to this in the future. However one of the simple eye candy was a simple rotating background. For anyone who has tried the demo you will have seen this. Well this was achieved by a large sprite with the Rotation behaviour. And I am kinda surprised, but I shouldn’t have been. Doing trig mathematics is expensive, doing trig every tick hurts performance. We can just ignore this on PC. However weaker devices are another matter. We need to avoid trig or use trig only at required intervals. Rotation uses a lot of trig. So here are the tests on performance. Control where nothing is rotated, Rotation Behaviour(1angle/sec), EveryTick and TimerBehaviour. Control(Nothing): 60FPS, 10%CPU Rotation:                    30FPS,   45%CPU EveryTick(0.033):  60FPS, 22%-30%(25) Timer(0.033):           60FPS, 22%-30%(25) Rotation calculates everytick doing trig mathematics. It’s too expensive. Best to avoid Rotation if you plan on hardware from -2012.  Lesson.  Don’t use Rotation Behaviour for mobile. It’s too expensive.

Leave a Reply