• 13
• 27
• 9
• 9
• 20

# Framerate regulation issues

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

## 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 on other sites

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 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]