I’ve had a few people suggest I add frame rate limiting to my Snake game. I have Vsync off and IsFixedTimeStep off, which results in the game often running at 1000+ fps. So, on this topic I suppose I have a couple of questions.
One, can anyone explain to me why this is being requested? I get that the high frame rate is unnecessary, but what is it hurting. The game runs smooth as butter which is usually my only concern when playing (or developing) a game.
Second, if there is a good reason for me to limit frame rate, is there an easy way to do this in MonoGame aside from the aforementioned Vsync or IsFixedTimeStep options?
Thanks in advance
The only reason I know is to avoid tearing, which happens when the refresh rate isn’t sync’d with the monitor. I’m not sure if there are other reasons. Other than Vsync/IsFixedTiemStep, I’m not sure what other ways there are.
I’m curious as to how others respond
Energy consumption (battery drain on mobile) and heat dissipation. Depending on the game, noone likes when their GPU is running on 100% for no real reason to do so and hearing the GPU coolers running on full speed (and consuming up to several 100 watts per hour on the desktop). Personally I would roll my eyes if the GPU coolers coming on with a snake game
The question you should actually ask is not “why should you limit the FPS” … the question should be, “why you shouldn’t” or "why do your game has to run with a 1000 fps when the monitor where it is connected to can’t do more than 60/100/144 fps anyway.
Maybe also it’s possible that other processes could be running and limiting the number of updates/second would give them more time to do their thing.
Alright, so that makes sense for the why.
As for how, is the only option SynchronizeWithVerticalRetrace = true? Because as soon as I do that on a 60hz monitor I feel the input lag. It is very noticeable.
I’ve seen some games with a slider where you can set a custom frame rate cap, which seems like a different thing from vsync on/off. I can cap the game at 300fps while I have a 165hz monitor. This seems more like what I personally would be wanting to accomplish. I’m not sure if that’s a trivial or complicated task however.
Try this: set the TargetElapsedTime to (1000ms / 300) = .3.33ms with VSync off/IsFixedTimeStep on.