Hi,
I’m experiencing severe input lag with vsync on.
Few things I noticed about it:
- Holding down more button causes the lag to increase.
- There’s more lag in full screen than in window mode.
- In windowed mode it can cause the mouse to travel far enough to leave the window. (suggesting something prevents it from re-centering)
You can experience it in the ninja snow war game or character demo. try looking around fast with your mouse, then try to hold down WASD (all of them) and look around fast again. You’ll notice it’s slightly more laggy.
In my game I experience extreme case of this lag which makes the game unplayable since it requires very responsive controls.
I noticed that when I enabled vsync and use SetMaxFps(60); the lag is greatly reduced and capped at a lower point (i.e. I don’t get extremely long freezes). It may suggest that there’s some sort of desync between input polling and updates.
Another thing that may cause it is lost mouse messages. I barely know anything about it but if the vsync busy polling doesn’t check for mouse messages, that could mean mouse messages are missed?
Another thing I noticed is that when I reduce the frame rate to something low such as 20-30, hold down any button and move the mouse, the mouse speed slows down and resets in intervals of few seconds.
I tested it and the values I get from input->GetMouseMoveX() and input->GetMouseMoveY() are the ones that scale down.
In windowed mode the mouse can leave the window when the mouse speed is slow enough.
Note that I don’t experience anything similar with other games, only when I use Urho3D.
What can cause this problem and how can it be fixed?
EDIT
Right now SDL2’s event queue is the main suspect.