I am a very big newbie when it comes to optimization. In the current game I'm working on, I was able to optimize the function and shave off about 0.5% of the processor load, and this is about as “amazing” as I am.
My situation is this: I developed a physical heavy game in MonoTouch using an XNA cover library called ExEn, and I think it’s very difficult for me to get the game to reach the reproduced frame rate on iPhone4 (I don’t even want to think about iPhone3GS at this stage).
A decrease in performance almost certainly occurs in physics calculations, if I turn off physics, the frame rate drops sharply, if I turn off everything, rendering, input, sound and just leave physics at work at a speed of about 15 frames per second in conditions of intensive physics.
I used performance profiling tools, and this is what I got: http://i.imgur.com/FX25h.png The functions that deplete the most performance are either from the physics engine (Farseer) or the ExEn XNA shell functions that they called (especially Vector2.Max, Vector2.Min).
I looked at these functions, and I know wherever Farseer could pass values by reference to these functions, and not at the cost, so that this covers (and this is literally the only way I can think of. In the amount of operations like
return new Vector2(Max(v1.x, v2.x), Max(v1.y, v2.y))
Basically, I feel stuck in my limited ability and understand the code optimization. I’m not sure what options I have or if I have any options (maybe I just need to get into the fetal position and cry?). With LLVM enabled and embedded release, I get maybe 15 feet per second at best. I managed to bring the game to 30 frames per second, lowering physical accuracy, but this makes many levels simply unplayable, because the bodies intersect with each other and collapse onto themselves.
So my question is: is this a lost cause or is there something I can do to increase productivity?