I have sucessfully used Farseer to develop one of my game using XNA. The game runs like a charm in Windows and WP7. I'm currently working on porting my game in IOS using Monotouch and Monogame. I've sucessfully compiled and used Farseer also over the
first version of my game ported over Monotouch and Monogame. All works fine except for performances. The game runs much more slower on the iPhone device. I did some code investigations and it seems that the major bottlenek is Farseer. It become really slow
when it has to manage more then 5-6 bodies with a single fixture attached (circle).
Reading the documentation I noticed that to tune Farseer i could change values from the Setting static class:
In order to get the most out of the engine, you should try and follow the guidelines below:
Sleeping enables you to have large number of bodies in the world. It can also increase the stability of the engine since small movements in a stack of bodies don’t spread in the stack. A sleeping body has little overhead, so enabling it is recommended.
Continuous Collision Detection prevents tunneling but at the cost of performance. If you don’t have problems with tunneling, you should disable CCD all together.
Minimize the number of position and velocity iterations
A high number of iterations makes the engine more stable at the cost of performance. You should tweak the values to fit your game.
The bad news is that if I change any value of that class, nothing seems to happend. I tryed to change values as follow:
- EnableDiagnostics = false
- VelocityIterations = 6
- PositionIterations = 2
- ContinuousPhysics = false
I tryed also with lower values like VelocityIterations = 1 but nothing seems to change....
Any hint or suggestions?