Sign in to follow this  

Framerate regulation issues

This topic is 2818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all. I've got a strange situation. Basically, I'm using SFML (I've asked on their forums too, but maybe someone has the answer here). Using: VCpp 2008 express on WinXP machine. Basically, I want to regulate the FPS to be 60. SFML does have something that seems to work, but the thing is it isn't working right. Basically, the game will run at 34fps UNTIL a lot of bullets are on screen (usually 50 or so) and then it goes at a pretty steady 63-65fps. It makes little sense why updating more would run faster. I have tried doing another method which turns off framerate regulator and instead depends on a timer object that waits until the time is >= 0.0166 (1/60th of a second) and then goes on, which has the FPS stay at 60, but then the CPU goes to 50%... which is very bad. I'm wondering if anyone has any thoughts or proposals to this. Thanks.

Share this post


Link to post
Share on other sites
Like I said in your other thread, what does your profiler tell you is the reason?

Also, why do you care if the CPU goes to 50%? Is it not fullscreen? If it's fullscreen you should take 100% of the CPU unless minimized cause nothing else is happening.

-me

Share this post


Link to post
Share on other sites
Hi, I don't know what this "profiler" is.

One thing: A build made with debug mode has the opposite problem when too much is going on (which makes sense...)

Regarding CPU: The app is windowed (for now; I'd like to have an option for windowed if people are into that) and the high CPU can be a problem when a LOT of stuff goes on naturally.

This below is the problematic code though.


while (bGo)
{ float Time = frameClock.GetElapsedTime();
if (Time >= 0.0166f)
{ bGo = false;

}
}


However, adding a Sleep(1); to it seems to fix the CPU issues. I need to make the time itself be >= 0.01f instead to compensate though...

[Edited by - Sivak on April 1, 2010 10:13:32 PM]

Share this post


Link to post
Share on other sites

This topic is 2818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this