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

Threading with Farseer?

Topics: Developer Forum
Jan 8, 2010 at 4:28 PM

I'm using Farseer with WPF to drive a game with a lot of simple objects (~100) floating around on one static screen. There are 16 Sensors that they can collide with and stick to.

I'm getting killed right now on performance, the game is taking ~30% processor on my 3ghz machine. I think my sensors are firing off Collisions repeatedly, and I'm not sure how to slow it down more. I'm already filtering in the Collision Handler based on rules for the game.

I am thinking of running Farseer in a background thread, updating off a Threading.Timer instead of a DispatcherTimer. Then instead of manipulating my Visual objects directly, Farseer would update interim values, and then in BeforeRender (on the main thread) I would set the Visual objects' properties to these values.

Does this seem like a reasonable idea? Any other suggestions to improve performance? I've tried adjusting some of the parameters of the PhysicsSimulator, which are good to play with?


Thanks a lot for any advise.