SFML community forums
Help => System => Topic started by: sponsz on November 19, 2009, 05:00:41 pm
-
How would one go about using the clock function to smooth the FPS?
I was thinking of having it increment or decrement a delay loop, per tick, so that if the framerate increased beyond 60 FPS it would increase the delay by some proportionate amount, and if it fell below 60 FPS it would decrease the delay.
Thoughts? Is there a canonical way of doing this?
-
What's wrong with SetFramerateLimit ? ;)
-
Why thank you, good sir.
-
why do you want to limit your framerate? you should design your game to be framerate-independent. anyways, if your game uses almost no graphics resources (high framerate), I would recommend enabling VSync instead, as that also prevents tearing.
btw: great avatar
-
why do you want to limit your framerate? you should design your game to be framerate-independent. anyways, if your game uses almost no graphics resources (high framerate), I would recommend enabling VSync instead, as that also prevents tearing.
I think, in many situations both ways are equivalent. Since SFML provides a function to set the framerate, this is a very easy approach. Besides, a lot of things are easier to handle with a fixed framerate (for example object movement and collision)...
great avatar
Hey, I thought so, too. Reminds me of good old Tintin. :)
-
I think, in many situations both ways are equivalent. Since SFML provides a function to set the framerate, this is a very easy approach. Besides, a lot of things are easier to handle with a fixed framerate (for example object movement and collision)...
well, setting framerate via SetFramerateLimit is not particularly precise (so your game's speed will vary on different computers). the best solution is to use a fixed framerate internally, and interpolate for display (which is then framerate independent)
-
What about VSync + FrameRate + Delta time?
Vsync and FrameRate to make your application not to run too fast, and Delta time to keep your game speed if FPS goes under FrameRate.
-
What about VSync + FrameRate + Delta time?
Vsync and FrameRate to make your application not to run too fast, and Delta time to keep your game speed if FPS goes under FrameRate.
No need for framerate limiting with vsync, the framerate will automatically be limited to the monitor's refresh rate (usually 60 or 75 Hz)
-
well, setting framerate via SetFramerateLimit is not particularly precise (so your game's speed will vary on different computers).
Really? I thought SFML would calculate the frame duration and wait every frame until its time is up (by sf::Sleep()). Am I wrong? Or do you mean that the resolution of sf::Sleep() might be not too precise?
-
well, setting framerate via SetFramerateLimit is not particularly precise (so your game's speed will vary on different computers).
Really? I thought SFML would calculate the frame duration and wait every frame until its time is up (by sf::Sleep()). Am I wrong? Or do you mean that the resolution of sf::Sleep() might be not too precise?
I don't know why, but it's Windows related. I checked it.
Laurent will change the Windows timer function in SFML2 (he will implement the Ogre's one).
-
I don't know why, but it's Windows related. I checked it.
Laurent will change the Windows timer function in SFML2 (he will implement the Ogre's one).
By the way, I added 3 links to the corresponding task that provide patches for this issue.
So maybe you can get rid of it before I fix it in SFML ;)
-
Really? I thought SFML would calculate the frame duration and wait every frame until its time is up (by sf::Sleep()). Am I wrong? Or do you mean that the resolution of sf::Sleep() might be not too precise?
It's the resolution of Sleep which is usually around 10ms (but might be anywhere between 1 and 30ms depending on your windows version)
Btw this can be changed by calling timeBeginPeriod/timeEndPeriod