Jump to content

  • Log In with Google      Sign In   
  • Create Account


Do I need a frame cap?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
18 replies to this topic

#1 parinho7   Members   -  Reputation: 213

Like
0Likes
Like

Posted 25 December 2012 - 08:18 PM

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!

Sponsor:

#2 frob   Moderators   -  Reputation: 18431

Like
3Likes
Like

Posted 25 December 2012 - 09:10 PM

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.
Check out my personal indie blog at bryanwagstaff.com.

#3 Sik_the_hedgehog   Crossbones+   -  Reputation: 1475

Like
0Likes
Like

Posted 26 December 2012 - 01:03 AM

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).


Edited by Sik_the_hedgehog, 26 December 2012 - 01:04 AM.

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.

#4 frob   Moderators   -  Reputation: 18431

Like
1Likes
Like

Posted 26 December 2012 - 01:51 AM

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
Check out my personal indie blog at bryanwagstaff.com.

#5 Zaoshi Kaba   Crossbones+   -  Reputation: 3453

Like
0Likes
Like

Posted 26 December 2012 - 01:57 AM

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

Edited by Zaoshi Kaba, 26 December 2012 - 01:57 AM.


#6 frob   Moderators   -  Reputation: 18431

Like
0Likes
Like

Posted 26 December 2012 - 02:21 AM

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.
Check out my personal indie blog at bryanwagstaff.com.

#7 ultramailman   Prime Members   -  Reputation: 1556

Like
1Likes
Like

Posted 26 December 2012 - 02:32 AM

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.

#8 Zaoshi Kaba   Crossbones+   -  Reputation: 3453

Like
0Likes
Like

Posted 26 December 2012 - 05:04 AM

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.



#9 Olof Hedman   Crossbones+   -  Reputation: 2619

Like
0Likes
Like

Posted 26 December 2012 - 06:02 AM



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

Edited by Olof Hedman, 26 December 2012 - 06:06 AM.


#10 SimonForsman   Crossbones+   -  Reputation: 5721

Like
1Likes
Like

Posted 26 December 2012 - 06:21 AM

<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.
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!

#11 Burnt_Fyr   Members   -  Reputation: 1190

Like
0Likes
Like

Posted 26 December 2012 - 09:14 AM

In response to Zaoshi Kaba;

 

It's no different then the engine in your car.... Good for about 100000 miles, assuming normal driving conditions. But if you have a tendency to keep the revs up at 8,000 your not going to get there and the possibility of major failure is greatly increased if the vehicle is redlining.



#12 Zaoshi Kaba   Crossbones+   -  Reputation: 3453

Like
-1Likes
Like

Posted 26 December 2012 - 10:40 AM

That's just usual deterioration. Everything wears down eventually and that's not software's (or in car's case fuel's/road's) fault. GPU was old and for unknown reasons it caught fire instead of downclocking. 

 

If you take old enough computer it'll have troubles playing high resolution movie, doesn't mean it's supposed to explode just because it works at 100%.



#13 Chad Smith   Members   -  Reputation: 1041

Like
0Likes
Like

Posted 26 December 2012 - 12:09 PM

That's just usual deterioration. Everything wears down eventually and that's not software's (or in car's case fuel's/road's) fault. GPU was old and for unknown reasons it caught fire instead of downclocking. 

 

If you take old enough computer it'll have troubles playing high resolution movie, doesn't mean it's supposed to explode just because it works at 100%.

The fact is that it has happened before.  While we would like to think that hardware and drivers are smart enough now to no longer do this it can still happen.

 

It has happened to me before also.  Without overclocking and with a GPU that was in good shape it did get overheated by a game that VSync turned off at the menu like was stated.  I remember seeing numerous of posts on the games forums about it.  The developers came out and released a patch for the issue.  Exactly like StarCraft 2.

 

Hell their are even 360 games (one that was released last year) that wold overheat certain driving wheels.  Game did not not have proper force feedback programmed and a couple users wheel went out because the game would overheat them.  I don't see this as any different than  GPU overheating.  The wheels hardware and drivers should be smart enough so this doesn't happen yet it still did happen.  Sadly this game never did release a patch on the 360 that fully fixed this issue.  Issue only happened on the 360 didn't happen on the PS3 version of the game.  

 

Though I feel this thread has gone off topic to more talking about hardware overheating.



#14 Satharis   Members   -  Reputation: 949

Like
0Likes
Like

Posted 26 December 2012 - 01:28 PM

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!

I would say it almost entirely depends on the game you have.

 

Normally you want to allow the user the option of turning vsync on, the only real reason for vsync is to prevent screen tearing(which arguably is not as big a problem as it once was.) Most games tend to leave it disabled at the start and let the user enable it if they require it.

 

Pros:

  • No tearing: Tearing is one of those issues where if you aren't seeing it, you don't care, but if you do see it, it completely wrecks the game. Thus having it at least available can be important, but keep in mind that if it doesn't occur then vsync is a total waste short of being nice to the video card.

Cons:

  • Frame capping: The problem with Vsync is that the video card literally has to wait for the monitor to finish a refresh before it can swap the buffers and display the new image, this works all fine and dandy if your video card is kicking out -over- 60 FPS, but if it dips below the video card will be stuck dropping down to a number like 30 FPS due to the way refresh rates work. A lot of people find wasting possibly half the frames they could create in a time period a big issue, especially if your monitor isn't subject to tearing!

 

Personally I don't at all agree with some of the other posters here that you should consider capping framerate simply due to the fact a user's hardware might overheat, I see that as a hardware flaw and problem more than a software one.

 

Does that mean you shouldn't take it into consideration? Of course not, there is something to be said about vsync being enabled on things like game menus, these places of course should be expected to render at a very high rate compared to being actually ingame, and enabling vsync or at least putting a frame cap on might be beneficial here.

 

But like I said, what it comes down to is what you think the behavior might be. Frankly I have not once in the last few years seen screen tearing on any game with vsync disabled, it is almost a moot issue to most people anymore, and why it is usually optional. But consequently if you were making pong or something you wouldn't need it running at 300 FPS either.

 

I'm sorry if I'm not really pointing to one option or the other, I definitely think if you don't want to give the players a choice to enable it or disable it then what you leave it "stuck" at is a matter of personal opinion and it comes down to if you are more worried about low FPS or screen tearing.


Edited by Satharis, 26 December 2012 - 01:31 PM.


#15 MrDaaark   Members   -  Reputation: 3535

Like
0Likes
Like

Posted 26 December 2012 - 03:09 PM

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 anyone's fault. But it's possible to add unnecessary wear and tear to things.

A lot of games use real time streaming. Some of those games keep it up at strange moments. Like in the menu screens between multiplayer rounds, the drive head is heard screeching back and forth reading off random spots on the disc. I had one game that played random video clips on the title screen, the creation/editor screens (which you could spend hours in), and anywhere else that wasn't the main game. It killed the machine.

Some of my PC games had SecuROM in it, and it would needlessly access my game discs at a very high rate. My drive would emit a high pitched squeal for the entire time I'd run those games. Eventually, my expensive, first gen, name brand CD burner that cost hundreds of dollars crapped out on me prematurely.

To have a menu screen(where people will often leave the game when they take a break) running uncapped, especially on screens that are only running 60 hz anyways, is highly irresponsible programming.

I have a game on my tablet that does the same. It makes the entire tablet heat up and stay hot the entire time it's running, and it's not actually doing anything. I can run netflix or youtube, or GTA 3 for hours and nothing happens. Tablet stays cool and responsive. But this crappy little app that just blits a few sprites is going to burn through my tablet. smile.png

You can always do un-needed wear and tear to someone's hardware by doing stupid things.

#16 Khatharr   Crossbones+   -  Reputation: 2775

Like
-1Likes
Like

Posted 26 December 2012 - 03:10 PM

It's something that hardware manufacturers should be getting yelled at for, but that's not the way consumers think and it's also not an optimal worldview. One of the keys to success in cases like this is to take responsibility rather than placing responsibility. If there's a potential problem with something that you're doing then solving the problem will get you a lot farther than passing the buck. It's not about who's at fault: it's about making things work.

 

Meanwhile, I'm sort of ambivalent about vsync: Typically I'm all for giving people control over what's going on, but in the case of allowing an end-user to disable vsync I'm a bit iffy since end-users tend to be of the mindset 'faster is better', even in cases where the truth is 'faster is the same or worse'. If your monitor is running at 60hz then a framerate of 5000 isn't going to give you smoother motion. Vsync'ing is a great way to avoid wasted work for the gpu, the cpu and etc. This means background apps/other threads/etc have more CPU time available and it also means you use less electricity, which isn't a huge deal on a PC but certainly can be on portable devices.

 

Just don't use it to set your framestep, lol.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#17 iMalc   Crossbones+   -  Reputation: 2253

Like
3Likes
Like

Posted 26 December 2012 - 04:19 PM

Personally I prefer to conserve those little electrons...

Think about how much power that little SC2 fix probably saved in Korea alone!
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

#18 dmreichard   Members   -  Reputation: 384

Like
0Likes
Like

Posted 26 December 2012 - 04:40 PM

Think about how much power that little SC2 fix probably saved in Korea alone!

 

+1 sir, that was pure gold.



#19 Khatharr   Crossbones+   -  Reputation: 2775

Like
1Likes
Like

Posted 26 December 2012 - 05:25 PM

Made me choke on my cheese crackers. laugh.png


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS