Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
478 stars 77 forks source link

Mouse Input Lag #1156

Open Richard-L opened 4 years ago

Richard-L commented 4 years ago

Experiencing mild mouse input lag which is quite offputting.

What is the mouse polling rate in RttR? It should be 125hz minimum.

v191223 nightly

Flamefire commented 4 years ago

We are using SDL with push events so we have no real influence over that. However it is limited by the refresh rate/FPS as real updates are coupled with frames.

BTW: Out of interest: Why 125Hz when there are only 60FPS (or so)? You wouldn't notice every second update at all...

Richard-L commented 4 years ago

Thanks for getting back.

125hz mean 8ms input lag that are then "draped" onto the 60fps. It's usually fine, but 1000hz even cheap mice can do if the OS allows it. Back in the day with WinXP and even Win7 this was much easier to adjust. With a higher polling rate, the game benefits even with lower FPS.

My feeling is RttR is currently at ~80hz which is too low.

These things make a big difference in competitive gaming, which is an aspect of RttR MP.

Richard-L commented 4 years ago

I had a dynamic framerate limiter set before. If disabled the responsiveness is noticeably better, albeit not good.

Spikeone commented 4 years ago

Well, using his mouse HZ Tester, I got 500Hz and it is working great

Richard-L commented 4 years ago

But that's only with your mouse?

@Flamefire perhaps can you elaborate on how push based works? Is there no polling at some point checking whether a new push exists?

Flamefire commented 4 years ago

It basically is:

while True:
    while(any-event-found):
        update_state(event) (e.g. move cursor)
    draw()

Event queueing is handled by SDL which usually uses Windows messages (WM_MOUSEMOVE), so whatever the OS gives us is used, then the current state is drawn. We probably can't influence this. I can imagine there is some cut-off point, otherwise the inner loop would run forever if you constantly move the mouse.

Make sure you use SDL2 as your videodriver in RttR (see settings screen), which might have already improved this.

Spikeone commented 4 years ago

@Richard-L Did you try SDL2?

Richard-L commented 4 years ago

Yeah but it didn't change anything. Only the frame rate limiter had a significant effect, as mentioned above. You'd think that more frames rendered mean the moment it draws your mouse position is more precise, thus I had it disabled.

With the frame rate limited the responsiveness is much better.