With win32 video driver, mouse movement is very sluggish #8658
Labels
needs triage
This issue needs further investigation before it becomes actionable
OS: Windows
This issue is related to a MS Windows problem
Version of OpenTTD
1.10.3 / 1.11.0-beta1
Expected result
Mouse movement of at least 30fps.
Actual result
Mouse movement of < 30fps.
Steps to reproduce
Start the game on a recent updated Windows.
Technical details
OpenTTD uses
Sleep(1)
to yield the process back to the OS when the gameloop was called before the next tick. It handles events, updates the mouse etc, and then does aSleep(1)
. In the old days, this yielded for a few ms. With recent update of Windows, it yields for 60+ms. This delay is so severe, that the game will miss its deadline for the next tick, but for me even worse: mouse movement feels really sluggish.It is most likely related to: https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/
This was found when fiddling with SDL2 on Windows. SDL sets the timer resolution to a much higher value (so lower ms), resulting in a much smoother mouse movement. So possibly we can borrow the solution there in our own codebase.
The text was updated successfully, but these errors were encountered: