Do I need a frame cap?

Started by
17 comments, last by Khatharr 11 years, 3 months ago
I am completing some beginner projects with c++ and SDL and I've read most of the lazy foo and sdltutorials. Up until now I used "frame independent movement" (as one of the tutorials explains) in the games I've made. Searching around I saw that the code in many tutorials uses regulated frame rate (using SDL_Delay). I was thinking witch method is better? Since with "frame independent" the program can run in my pc at about 175 fps isn't it better to just leave it uncapped?

I am in a learning process right now and I'd like to learn from people here on this matter. Thanks in advance!
Advertisement
It depends.

Many games will leave v-sync on, so flipping buffers will block, which results in a natural capping.

Since you are a beginner in the For Beginner's forum I'll explain in a bit more detail. The video card accumulates all the rendering commands and buffers them. They are not actually shown to the user until the display is swapped. By default, that swap takes place during the v-sync, the time it would take for an older CRT beam to go from the bottom of the screen to the top of the screen. Usually you see that on newer LCDs as 60Hz, 75Hz, 120Hz, or some other value. If you use the default your game will naturally pause every frame waiting for the v-sync event. Flipping display buffers to present the new screen to the user will block -- meaning it puts your app to sleep for a moment -- until that time has passed. It serves as a natural way to throttle the game on fast machines.

If you turn v-sync off you will need to take extra steps to ensure you don't accidentally burn out the player's video card or CPU, both of which have happened with badly-developed games.

Wait a second...

If you turn v-sync off you will need to take extra steps to ensure you don't accidentally burn out the player's video card or CPU, both of which have happened with badly-developed games.

What kind of hardware was that? The hardware should slow down in the worst case (due to running out of processing time) o_O That looks more like faulty hardware or hardware not running under the proper conditions or something like that.

Back on-topic: it depends. A fixed framestep is much easier to handle, but you can't go beyond its speed and if it slows down you need to start applying frameskip. A variable framestep is supposed to be able any framerate but it's much harder to handle, especially if you want to handle situations that happen in the middle of two frames that would affect what happens later (e.g. collision of two objects).

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
Wait a second...



If you turn v-sync off you will need to take extra steps to ensure you don't accidentally burn out the player's video card or CPU, both of which have happened with badly-developed games.


What kind of hardware was that? The hardware should slow down in the worst case (due to running out of processing time) o_O That looks more like faulty hardware or hardware not running under the proper conditions or something like that.
You see it every few years on major games.

Starcraft 2 had v-sync disabled on their main menus with no delay in place. It burned out quite a few cards. http://www.gameinformer.com/b/news/archive/2010/07/28/blizzard-confirms-starcraft-ii-overheating-bug.aspx
It's not game's fault if you have dusty graphics card or overclock it till it fries. That's not even a bug.
It's not game's fault if you have dusty graphics card or overclock it till it fries. That's not even a bug.
The cards did not need to be overclocked, nor did it require dust. As for it not being a bug, Blizzard issued a software update that fixed it.

Starcraft 2 was not the only game to do it, a few seconds on google finds a rather long list of games that have a tendency to overheat the hardware.

The point is that caution is warranted. I'm among the people who have accidentally fried hardware, and many times have triggered overheating warnings on my machines -- and notably, I don't overclock. Turning off v-sync to get higher framerate has risks and probably shouldn't be encouraged in beginners.
Have a look at this: http://gafferongames.com/game-physics/fix-your-timestep/
I am still trying to understand it, but it seems to be arguing that fixed timestep/frame cap is good.
It's not game's fault if you have dusty graphics card or overclock it till it fries. That's not even a bug.
The cards did not need to be overclocked, nor did it require dust.

So you're basically saying it's normal that GPU is unable to operate at full power?

Following your logic Prime95 supposed to overheat and fry CPU as well. That's NOT normal, it's hardware/user issue, not software.



It's not game's fault if you have dusty graphics card or overclock it till it fries. That's not even a bug.

The cards did not need to be overclocked, nor did it require dust.
So you're basically saying it's normal that GPU is unable to operate at full power?
Following your logic Prime95 supposed to overheat and fry CPU as well. That's NOT normal, it's hardware/user issue, not software.
Graphics cards are pretty complex pieces of hardware, and they are engineered to survive "normal" operation, but swapping buffers 500-1000 times per second with a very simple scene, which can happen in menues that is not capped is not really "normal operation".
I imagine it puts a lot of stress on small parts of the hardware and create hotspots.
One could argue that the hardware or the drivers should be smart enough to not do things like that, but obviously they aren't.

I remember my old card starting to emit a high pitch noise (not from the fans) when the fps got above 200-300 or so... didn't dare to run it long like that.

I wouldn't call it normal, but it's the reality...
<blockquote class="ipsBlockquote" data-author="Olof Hedman" data-cid="5014385"><p><br /></p><blockquote class="ipsBlockquote" data-author="Zaoshi Kaba" data-cid="5014378"><p><br /></p><blockquote class="ipsBlockquote" data-author="frob" data-cid="5014357"><p><br /></p><blockquote class="ipsBlockquote" data-author="Zaoshi Kaba" data-cid="5014353"><p><br />It's not game's fault if you have dusty graphics card or overclock it till it fries. That's not even a bug.</p></blockquote>The cards did not need to be overclocked, nor did it require dust.<p><br /></p></blockquote>So you're basically saying it's normal that GPU is unable to operate at full power?<br />Following your logic Prime95 supposed to overheat and fry CPU as well. That's NOT normal, it's hardware/user issue, not software.<p><br /></p></blockquote>Graphics cards are pretty complex pieces of hardware, and they are engineered to survive "normal" operation, but swapping buffers 500-1000 times per second with a very simple scene, which can happen in menues that is not capped is not really "normal operation".<br />I imagine it puts a lot of stress on small parts of the hardware and create hotspots.<br />One could argue that the hardware or the drivers should be smart enough to not do things like that, but obviously they aren't.<br /><br />I remember my old card starting to emit a high pitch noise (not from the fans) when the fps got above 200-300 or so... didn't dare to run it long like that.<br /><br />I wouldn't call it normal, but it's the reality...<br />&nbsp;<br /><p><br /></p></blockquote><br />Thats pretty bad, this would mean that it is still possible to write a virus that damages the users hardware. (a practice that should have died with DOS). It is most definitly a driver bug/flaw and while we should work around those for the sake of our users we shouldn't be held responsible for them.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

This topic is closed to new replies.

Advertisement