Slow Cleanup Problems

Topics: Developer Forum, User Forum
Mar 21, 2010 at 10:48 PM

For lack of a better description, I have "done something" to my code which has dramatically slowed things down (i.e., 4 FPS or so).  I tracked the problem to being within the farseer engine, though I'm sure it's due to my misuse of it.  It's now handling even a very small number of objects in the PhysicsSimulator incredibly slowly.  The simulatorview is showing a "clean up" time of around 15-30.  I wonder if anyone has thoughts on approaches to diagnosing the problem (or likely mistakes that may have caused it).  It was handling the same numbers of geometries and bodies with no problem before.  Any suggestions would be extremely welcome (or questions for me that may help diagnose).

Incidentally, since this is my first post on the farseer forum, I should mention I'm thoroughly impressed by this beautiful engine (on every day but today).

Mar 23, 2010 at 3:13 AM

Some additional information:  When I switch to "isFixedTimeStep = false," things operate blazing fast in the physics engine.  My understanding is that Farseer is supposed to be run in fixedtimestep, so I don't want this on, but it's still interesting that when it's on farseer is able to fly, but when it's off, it takes 3 seconds to perform an update.  I've gone through the demo tutorials looking for some setting (anywhere) that I might be able to tweak to find this, but to no avail.  Incidentally, the problem is significally less bad (though still a problem) when the game is run from a PC

So again, the riddle continues... what type of problem does it sound like I am describing? 

I apologize if this would be considered bumping my thread.  Hoping the additional information leads to a solution and I've really scavenged the forum for this, so if a solution comes out, it may be helpful to others.

Developer
Mar 23, 2010 at 4:38 PM

If your using Farseer's demo frame rate of 100 fps but taking longer then 10ms to update and draw everything your game will crawl at 1 - 5 fps. An easy way to fix this is to change your TargetElapsedTime to some higher value. I would try 16 first and then possibly higher if it's still lagging.

Let me know if this helps.

Mar 24, 2010 at 3:56 AM

Worked beautifully.  Thanks Matt.