Framerate?

Topics: Developer Forum, User Forum
Apr 9, 2009 at 12:38 PM
I was doing some thinking on framerate and milliseconds, and i was wondering if farseer needs to be run at 100 frames per second or can it be run slower (like say 60 frames per second) and what needs to be done to achieve this (beyond changing the target elapsed time).
Developer
Apr 10, 2009 at 6:51 PM
Biggest problem with lowering the frame rate is that more overlap can occur and can cause problems.

I am thinking I will write up the code to let the physics engine run independent of the frame rate. But don't hold your breath I have a ton of stuff on my plate right now.
Apr 11, 2009 at 5:19 AM
No pressure. I was just wondering if i could drop it to 60 to maybe give farseer (and my code) more time to work.....
Developer
Apr 12, 2009 at 6:41 AM
I'm pretty sure if you change the TargetElapsedTime to 16 and change the time multiplier given to the PhysicsSimulator to 0.016 instead of 0.001 then it should run at 60 FPS. Don't hold me to that because I don't have the code in front of me right now, but give it a try and let me know how it works.
Apr 12, 2009 at 8:48 AM
I'll try right now... *scurries off to test* 3 things: 1. You don't need to do anything to the multiplier fed in (i use the elapsed milliseconds times 0.001), 2. it works but it a little too twitchy for my game. 3. I have code that measures the update rate, and it's saying that there is something like 20000 updates a second. Puzzling...
Developer
Apr 13, 2009 at 3:24 AM
Yep, my bad leave the multiplier alone just change the TargetElapsedTime to 16. 20000 a sec? Is IsFixedTimeStep = true?

            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            IsFixedTimeStep = true;

Should look like this.

Apr 13, 2009 at 3:59 AM
Hmm.... i might have forgot that... perhaps that is the source of the twitchy physics objects?
May 3, 2009 at 2:03 AM
Is the problem that the farseer is running at 100 iterations per second or that silverlight is rendering the graphics too fast?  If it is just silverlight rendering too fast, you can change the MaxFrameRate.  I changed this between 60, 30, 20 and 15 in testing a game.  It makes a big difference on the CPU in full screen and a decent different on normal resolution.
May 3, 2009 at 2:43 AM
I use XNA, thanks for trying to help though. I got it straightened out. I forgot to specify that i actually wanted the fixed timestep!