Alternate title : If you have a gaming mice and you play with VSync.. you are an idiot
DISCLAIMER You may (and should) know most of this stuff already. This is more of a “did you know” than a “Look what incredibly discovery I found”. To this day, there are people who say framerate doesn’t influence input lag, and people saying that their fast-paced game will be cool and popular and competitive even if it runs at 29.97 FPS. If you are one of those guys, welcome to the real and ugly world of input latency.
Our eyes are.. weird. Some people say that we only perceive 30FPS.. ish. It’s not really true, and there is not a real final number, as our central and peripheral vision are different (for example, it’ll take half the time to notice something that appeared on the edge of your vision than something that appeared in front of you). I’m not going to talk about that, there are already tons of resources that explore 60 vs 30 FPS, like this article or this website.
Today we’ll talk about getting the most high framerate for another reason: Input latency. First of all, though, let’s explore Hardware latency.
Every input device has latency, this is due to the fact that every time you move your mouse or press your key, the device has to figure out what has been done, how much and has to process all that in a way that the computer can then read and interpret. Then there is communication, the data must be sent over an interface, the computer has to receive that information, send it over to the CPU, the CPU has to halt what it was doing and read and parse everything.
All of this take time, of course.
So what numbers are we talking of?
Technically, everything today is USB, there has been an argument about PS/2 vs USB because of really fair reasons, which I wanted to talk about but that’d take half of the article to describe in detail.. maybe another time, uh?
Long story short, USB is not Interrupt-driven.
This means that the device doesn’t send signals to the PC directly, it has to record every keypress or mouse movement or whatever into its own memory and once in a while the PC will send a signal “give me everything that has been recorded ‘til the last time I contacted you” and the device will send all the info as reply. This is called Polling. This also mean that your latency doesn’t depend on how much the device takes to register the signal, but on how frequently the PC asks for what happened. The default polling rate on most OSs is set to 125Hz, this means the input lag is ~8ms.
The USB polling rate can be overclocked, in fact, most gaming mice software will actually overclock the USB polling rate for the mouse itself to 1000Hz in order to achieve a 1ms lag window.
If you are now thinking about overclocking the polling rate for your USB gamepad or mouse, be careful: gaming mices are well built and expensive, they are designed to work at 1000Hz. Most other devices aren’t, and overclocking might damage them.
So.. is 8ms even noticeable? It “kinda” is.. it’s not noticeable when looking directly at lights getting lit and unlit, but it’s noticeable when playing very fast paced games like hard music games and Arena FPSs.
Oh by the way, touch controls on smartphone are absolutely worthless, those take like ~100ms only to be registered by the hardware. It’s not as bad as the first kinect (~270ms) but it’s almost twice as much as the Wiimote (~60ms).
So that was Hardware lag, not everyone has gaming equipment, so 8ms is average.
It’d be nice if it stopped there, though. We’ll quickly see how framerate is actually way worse than that, and the USB polling lag will become more than negligible in a 30/60 FPS game.
Most games grab input at rendertime, we have this huge while(1) loop that keeps running and does all the logic and then renders a frame to show on screen. This means that the more loops we do, the more often we take input. This is why I find Super Hexagon with vsync enabled unplayable. VSync is the enemy of low input latency.
To explain why, here’s a little history on VSync:
Our screens have refresh rate, it means that at every once in a while (60 times a second for most monitors) they’ll ask the GPU to send it its video memory so it will update the screen with the newer data.
If your game is going lower than the refresh rate, everything is fine.. what if the game is going really faster than that, though? The videocard will be copying the new frames to the video memory very often, and the monitor might ask for video memory right when the GPU has only finished copying the new frame halfway or so, resulting in a screen that’s half a frame and half the previous one. This is called tearing.
To solve this issue, VSync was invented, which says “Just limit the framerate to the monitor refresh rate”, so if the monitor goes at 60Hz, your framerate will be at most 60 FPS.
The downside is that because of that, your main loop will block to ensure that your game doesn’t go faster than that, and with that all the logic goes slower as well.. input included.
Let’s calculate how input lag we get, then: 60Hz is 1/60s: 16.67ms.. that’s a lot, if we compare it to the “troubling 8ms” that people complain about when talking “why we use gaming mices”!
On consoles, where the “standard” for games is 30FPS, Software Input lag is 33.34ms (which is even worsened than the fact that most console gamepads are now wireless, so around 16ms of hardware lag).
So please, switch to Triple Buffering if you can, it requires more VRAM but eliminates the problem in the best way and without sacrificing framerate.
This is why I advocate for >60 FPS, it’s not that I have a 120Hz monitor and think my eyes are better than everyone elses, it’s that I absolutely can’t stand input lag.
Pretty important thing to notice before I finish: don’t expect the 16.67ms software lag to overlap the 8ms hardware lag.. they’re added, this is why a gaming mice performs better even on a vsynched game.
Make fast games, please.