Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Protomancer

Pages: [1]
1
General / Re: SetFramerateLimit() problem and custom FPS regulation
« on: July 16, 2012, 06:05:59 pm »
Thanks for the quick response!
I didn't consider all the possible scenarios with this method. It works perfectly fine if your machine is powerful enough to run at FPSLimit all the time, but as you pointed out, on older machines that can't run at max speed all the time, it'd cause a whole lot of problems.
Thanks again for the input, I'll modify my program to take into account being run on older machines too.

2
General / SetFramerateLimit() problem and custom FPS regulation
« on: July 16, 2012, 05:04:04 pm »
Hello,

I've just recently come across a problem when using the the setFramerateLimit() function. It doesn't set the maximum framerate to the specified value, but rather to the nearest multiple of 50. Other times it sets it to a steady 66 or 57 when given a value of 60. Using vertical sync fixes the issue after 10 seconds of running, but this disables the option of using a custom framerate. I've seen another post where someone has encountered the same problem:
http://en.sfml-dev.org/forums/index.php?topic=8015.msg53582#msg53582
As a solution wasn't found, I made this post to ask about possible fixes. I measured the framerates with 1.0f / App.GetFrameTime(), and double checked with fraps. I really doubt hardware limitations have anything to do with it.
Some additional information: I'm using Visual C++ 2008 Express Edition with SFML 1.6, but the person in the other post was using SFMl 2.0 RC so I don't think the version is at fault. My graphics card is an nvidia Geforce GT 540m, I can provide other specs too if needed. Any input on the topic would be highly appreciated.

However, this is not the main reason I've made this post. As I couldn't realiably use SetFramerateLimit() to manage my fps, I've set up a custom system to manage the FPS of my program:
int main()  {

//Setting up rendering, input management, level manager etc.

sf::Clock RegulatorClock;

float FPSLimit = 60;
float FPSRegulator = FPSLimit;
float Offset = 0.02;

//main game loop
while (App.IsOpened())
{

if(RegulatorClock.GetElapsedTime() > (1.0f / FPSRegulator))
{
                        if ( 1.0 /App.GetFrameTime() < FPSLimit)
                                FPSRegulator += Offset;
                        if ( 1.0 /App.GetFrameTime() > FPSLimit)
                                FPSRegulator -= Offset;

//Everything else in here: Managing input, drawing, displaying, switching levels etc.


RegulatorClock.Reset();
}

}

return EXIT_SUCCES;
}

This method basically just checks every iteration where the current FPS rating is, and modifies it to keep it around FPSLimit.
My questions are these: are there any dangers using this method? Will there be any performance issues because of this? How reliable could it possibly be in the long run? Are there any problems with sf::Clock that would make this function incorrectly?

As i said above, any input would be highly appreciated.

Pages: [1]