Devilutionx: Mouse lag on Linux

Created on 27 May 2020  Â·  9Comments  Â·  Source: diasurgical/devilutionX

Hello,

I am used to play Diablo 1.09 on my Windows PC, I tried devilutionX on my Linux laptop and I'm noticing lags on the mouse cursor - the mouse cursor does not go instantly to where I'm moving it, there is what appears to be 100 ms delay or perhaps even 200 ms, something on that range.

I don't know if it's an issue with my laptop or if it's an issue with Linux builds in general, or just devilutionX

My CPU is Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz

Did anyone else using Linux experience something similar?

All 9 comments

Please detail your Linux setup (are you using wayland, what SDL version etc), on a default Ubuntu 18.04 installation we do not see this issue.

I am running Ubuntu 18.04.4 ; I followed the instructions under the "build from source" section so I guess it must be SDL2? I don't think I'm using wayland

I've just run Diablo on Windows again to figure out the difference, i think i know what happens

On the Windows Diablo 1.09, when you move fast the cursor, the game doesn't display the mouse all the way - the pointer will "teleport" (kinda) and perhaps skip some frames? I don't know exactly what happens on the technical side, but i don't see the mouse pointer "moving" to a position. For instance, if I move the mouse pointer on a fast circle, i'll get to see maybe 8 mouse pointer positions before the circle is complete?

On devilutionX on Linux it looks like the mouse pointer is always rendered, perhaps there is too many mouse positions to render and the game starts to have troubles catching up to where the actual mouse pointer is?

Or perhaps it's a byproduct of the increased framerate, which makes it look like it lags compared to the original version, when in fact it doesn't?

This intrigues me, I might try to have a look at the code when I have some time

1.09 runs at 20hz, DevilutionX runs as monitor refresh rate. On GOG you will see a lot of people complain that the original has a laggy mouse, due to the lowe fps. You seem to have the opposite perception...

I'm going to close this as I cannot replicate it on Ubuntu 18.04 using AMD/Nvida/Intel GPU, and it sounds more like a perceptual difference than actual lag.

For further testing, I suggest you try running the game in window mode, disable mouse grab in the .ini and try and move the mouse across the window both in the main menu and in-game and see if there is any difference and if the mouse moves the same as on you desktop. You can also enable the FPS counter in game with -f

If you build from source you probably build a debug version, you might want to either download a prebuild release or make a release build (see CMake options).

I've tried to make a release build, to no avail. Same for window mode. I could not find any .ini file in the build folder, nor in the parent folder.

Here is a video i uploaded that shows the lag. You might want to switch to x0.25 playback speed

https://www.youtube.com/watch?v=9ElIU9zO_Lc

You can hear the sound of the mouse moving before the cursor actually moves.

Later tonight I can send you the same video, but on a Windows machine to compare ; I play a lot of Diablo these days and I noticed this immediately after firing devilutionX, I'm pretty sure it's not just a perceptual difference, though I do not know why I am (apparently) the only one experiencing it.

PS : this is the same kind of video, but done on my Gnome environment instead, without Diablo
https://www.youtube.com/watch?v=1dHzj5DDYdY

You can see there is little to no lag there, as opposed to the Diablo recording

Did you try downloading a release build instead? The location of save games and ini file is detailed in the Readme accompanied with the releases. In the release note, you will also see that you can change full-screen mode by hitting alt enter.
Please try the official release to exclude this from being related to the build process. I also suggest that you try the Windows release to compare it there.
Also please show the FPS that the game is running at.

Hello,

I spent a bit of time today to figure out, I was able to find out the cause - it's line 119 on SourceX/display.cpp

renderer = SDL_CreateRenderer(ghMainWnd, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);

If I remove the SDL_RENDERED_PRESENTVSYNC flag, I do not get any mouse lag anymore

renderer = SDL_CreateRenderer(ghMainWnd, -1, SDL_RENDERER_ACCELERATED);

I found that issue in a Stackoverflow thread: https://stackoverflow.com/questions/25173495/c-sdl2-get-mouse-coordinates-without-delay

If you want I can do some recordings (like I did in my previous video) of me moving the mouse, but I think it's fine now with that change.

What do you think about it?

@sixcy you might want to test this PR https://github.com/diasurgical/devilutionX/pull/783 as it solves the issue for someone that reported having the same issue on Windows. You will have to switch VSync mode via diablo.ini.

Yes that should work - I already tested it internally by manually removing
the SDL vsync flag and it solved the issue.

I wanted to make a PR similar to the one that has just been opened but
lacked time - it's great news that this PR is being worked on :)

On Wed, 2 Sep 2020, 02:50 Anders Jenbo, notifications@github.com wrote:

@sixcy https://github.com/sixcy you might want to test this PR #783
https://github.com/diasurgical/devilutionX/pull/783 as it solves the
issue for someone that reported having the same issue on Windows. You will
have to switch VSync mode via diablo.ini.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/diasurgical/devilutionX/issues/745#issuecomment-685212422,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABPAYLQFH3WKJVAKVAWFDCLSDWJFPANCNFSM4NMOCUXA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baszczewski picture baszczewski  Â·  15Comments

predator8bit picture predator8bit  Â·  21Comments

Tmkrth picture Tmkrth  Â·  25Comments

ctrl-meta-f picture ctrl-meta-f  Â·  30Comments

cain05 picture cain05  Â·  18Comments