This project has moved and is read-only. For the latest updates, please go here.

FP3.0 collision performance on Xbox

Sep 2, 2010 at 1:00 AM

Hello all,

I updated my game from 2.1 to 3.0, and mostly have things working as they should.   I started testing on Xbox, and I noticed something very strange, perhaps leading to my poor performance.  When I play on Windows and have the DebugView on, I see the collision numbers in the panel ranging from 0-1000ish.  On Xbox, the numbers are 1000-100000... should they not be the same?  If this is generating tens or even hundreds of thousands of contacts and controllers and such, that can't be good.

Sep 2, 2010 at 3:32 AM

i also have the same results on the 360, when i have more than 13 objects in contact it slows down alot.

Sep 2, 2010 at 7:39 PM

What do you mean by "collision numbers"? The debugview is split into 2 colums: Number of objects generated and timing. The number of contacts generated are right under "Bodies" in the left column. The number of generated contacts should be the same on PC and Xbox360.

Sep 3, 2010 at 7:29 PM
Edited Sep 3, 2010 at 7:33 PM

Ahh, ok, the left panel (bodies) is the same on both, I have around 50-100 objects in the world.  On Windows, the right panel values are 0-100's, while on xbox they are 0-10000's+.  What does this mean then?   The number of milliseconds that the controller, contact, etc methods are taking to execute per frame?

Sep 3, 2010 at 9:06 PM

The numbers (timing) are the number of ticks that it took to complete the subsystem of the engine (new contacts, controllers update and so on). Your PC is more powerful than the single core used on the Xbox360 and thus it takes less time to execute the code on PC.

Sep 3, 2010 at 11:20 PM

Any suggestions on how to improve the performance?  My game objects are already all pooled, and reinitialize the physics rather than remove and create bodies.  Do collision groups help with performance?  I currently use the UserData object to check what is colliding.  Perhaps threading of some sort as well?

Sep 3, 2010 at 11:28 PM

I've written a series of blogposts about optimization that you might want to take a look at: Performance Tips and Tricks Series

Farseer Physics Engine specific, you should use collision groups if you want filtering. The collision groups are evaluated already in the broadphase, so it should be a lot faster than using UserData after the narrow phase has happened.

Sep 3, 2010 at 11:38 PM

Thanks for the link, I will check that out.  Good to know about the collision groups, I will implement them immediately.