Also, there are 540Hz displays.
Tying the input loop to the render loop is a totally arbitrary decision that the game industry is needlessly perpetuating.
You're right a game could be made that works that way. I'm not aware of one, but I don't have exhaustive knowledge and it wouldn't surprise me if examples exist, but that was not the question.
But a greenfield code shouldn't be perpetuating this mistake.
On most modern engines there is already a fixed-step that runs at a fixed speed to make physics calculation deterministic, so this independence is possible.
However, while it is technically possible to run the state updates at a higher frequency, this isn't done in practice because the rendering part wouldn't be able to consume that extra precision anyway.
That's mainly because the game state kinda needs to remain locked while: 1) Rendering a frame to avoid visual artifacts (eg: the character and its weapon are rendered at different places because the weapon started rendering after a state change), or even crashes (due to reading partially modified data); 2) while fixed step physics updates are being applied and 3) if there's any kind of work in different threads (common in high FPS games).
You could technically copy the game-state functional-style when it needs to be used, but the benefits would be minimal: input/state changes are extremely fast compared to anything else. Doing this "too early" can even cause input lag. So the simple solution is just to do state change it at the beginning of the while loop, at the last possible moment before this data is processed.
Source: worked professionally with games in a past life and been in a lot of those discussions!
You kind of understand how the game loop is tied to the refresh rate in games like this, though. Practicing "pixel perfect" jumps must be challenging if the engine updates aren't necessarily in sync with what goes on on screen. And in the really old days (when platformers were invented!) there was no real alternative to having the engine in sync with the screen.
There are many tick rates that happen at the same time in a game, but generally grabbing the latest input at the last possible moment before updating the camera position/rotation is the best way to reduce latency.
It doesn't matter if you're processing input at 1000hz if the rendered output is going to have 16ms of latency embedded in it. If you can render the game in 1ms then the image generated has 1ms of latency embedded in to it.
In a magical ideal world if you know how long a frame is going to take to render, you could schedule it to execute at a specific time to minimise input latency, but it introduces a lot of other problems like both being very vulnerable to jitter and also software scheduling is jittery.
Okay I think I follow this, but I think I'd frame it a little differently. I guess it makes more sense to me if I think about your statement as "the frame I'm seeing is only 2ms old, instead of 16.67ms old". I'm still not seeing the action for 16.67ms since the last frame I saw, but I'm seeing a frame that was produced _much_ more recently than 16.67ms ago.
Thanks for the explanation, it helps!
I used to play CS:Go at a pretty high level (MGE - LE depending on free time), putting me in the top 10%. Same with Overwatch.
Most of the time you're not dying in a clutch both pulling the trigger situation. You missed, they didn't, is what usually happens.
I never bothered with any of that stuff, it doesn't make a meaningful difference unless you're a top 1%.
But there's a huge number of people who play these games who THINK it does. The reason they're losing isn't because of 2ms command registrations, it's because they made a mistake and want to blame something else.
Note that this is only the case if you have vsync enabled. Without vsync you will see the action (or some reaction anyway) +2ms later instead of +16.67ms, just not the full frame. This will manifest as screen tearing though if the screen changes are big - though it is up to personal preference if it bothers you or not.
Personally i always disable vsync even my high refresh rate monitor as i like having the fastest feedback possible (i do not even run a desktop compositor because of that) and i do not mind screen tearing (though tearing is much less visible with a high refresh monitor than a 60Hz one).
In Counter-Strike, smoke grenades used to (and still do, to an extent) dip your FPS into a slideshow. You want to ensure your opponent can't exploit these things.
I used to do that until I switched to Wayland which forces vsync. It felt so unresponsive that I bought a 165hz display as a solution to that.
The reason is triple buffering:
> https://en.wikipedia.org/w/index.php?title=Multiple_bufferin...
I just quote the central relevant sentences of this section:
"For frames that are completed much faster than interval between refreshes, it is possible to replace a back buffers' frames with newer iterations multiple times before copying. This means frames may be written to the back buffer that are never used at all before being overwritten by successive frames."
Things have come a long way since then!
[E] Answered my own question elsewhere: the difference is the "freshness" of the frame. Higher frame rates mean the frame you do end up seeing was produced more recently than the last frame you actually saw
Why does the rate at which frames are rendered (by the GPU?) relate to the speed at which input is registered?
[E] Ah, I think another comment [1] up in a different branch of this thread answered this for me