Jump to content

[41.65] [Linux] Keyboard inputs sometimes will not register. (fixed! at least in my case. posted my solution)


eternal_zomboid

Recommended Posts

  • 41.65
  • Singleplayer & multiplayer.
  • N/A
  • No.
  • Reproduction steps:
    1. Install game on a machine running Linux.
      • As far as I know, this can be observed on Manjaro Linux & Linux Mint.
      • I imagine there's a high chance it will happen on other distros too.
    2. Play game, any mode...
    3. Observe keyboard inputs not registering at times.
      • Typically aforementioned issue will occur when pressing more than one key at a time, for example (but not limited to) when walking & changing direction/running.
      • I should mention that I play a lot of games on my Manjaro desktop, I've never had any sort of input troubles like this with anything.

 

Further, after a Google search I found a post on /r/projectzomboid where the user "wolf2d" describes the same exact problem, maybe a bit better than I can. They are the Linux Mint user.
For the sake of convenience I have attached their post in a quote.


"Is anyone having troubles with keyboard input since 41.60?"

Quote

 

Since the last update, there I have had some problems with keyboard input: in particular, sometimes when I press more than one key at the same time quickly, some key presses are not registered. For example

i'm standing still, I decide to head north, so I press W and D at the same time, but my guy starts going North-East (as if only D was pressed) or north-west (as if only W was pressed). This is fixed when I release both keys and press them again

walking backwards facing zombies, I turn direction and start sprinting, my guy changes direction but does not sprint, as if shift was not pressed, or changes direction but stands still until I release and press the keys again

This seems to happen independently of walking/running/driving, but it seems to happen more often when changing animation, so when I start sprinting for example, or change direction of movement.

Operating system is Linux Mint 20.1 (based on Ubuntu 20)

 

 

Would love it if this could get fixed, I love this game but man, keyboard input troubles do not help me survive! It's the exact opposite!

Thanks guys. :ugeek:

Edited by eternal_zomboid
Link to comment
Share on other sites

I actually have the same issue

One thing I have not tried is if this has anything to do with "auto repeat"
 

The output I get from

xset -q | grep "repeat"


 

  auto repeat:  on    key click percent:  0    LED mask:  00000002
  auto repeat delay:  500    repeat rate:  33
  auto repeating keys:  00ffffffdffffbbf


I randomly found this via https://www.reddit.com/r/linux_gaming/comments/s4c8dc/why_is_it_that_when_i_press_and_hold_multiple/ (for minecraft) which someone linked to this old minecraft bug https://bugs.mojang.com/browse/MC-122421

 

If I recall correctly PZ uses Java (like minecraft) and perhaps also LWJGL (like minecraft) - so perhaps there is an issue in a library somewhere? No clue to be honest.

The reason why I'm not sure that these are the same issues is because I can hardly reproduce the issue on PZ at will, so I'm not convinced this is caused by the auto repeat setting (but who knows)
 

I suppose next time I encounter that bug I just could keep pressing and "estimate" the time it took for the keypress to be detected and then change the auto repeat delay to something like 5000 (via "xset r rate 5000") and observe if it took way longer for the keypress to be registered.


I've also already made a post back in October already https://steamcommunity.com/app/108600/discussions/6/3086646248543878577/

 

Link to comment
Share on other sites

58 minutes ago, EngineOfDarkness said:

-snip-

 

Thanks for those links, they were really insightful. I'll keep reading what I can.

Also amazed I didn't find your post from October.

 

There's also an interesting comment in projectzomboid.sh, three times.

# XMODIFIERS is cleared here to prevent SCIM screwing up keyboard input

spacer.png

 

So... It seems that something was done to aid keyboard inputs. I dunno. I'll keep trying.

Link to comment
Share on other sites

There is some rythm type game where this also seems to happen https://github.com/chrislo27/PolyrhythmMania/issues/24

 

The dev there (at least for his/her game) also uses as a workaround https://github.com/chrislo27/PolyrhythmMania/issues/24#issuecomment-913897628

 

XMODIFIERS="@im=null"

 

The bug itself seems to happen in glfw if I understand correctly https://github.com/glfw/glfw/issues/1112

 

Ultimatively TIS has to update lwjgl or whatever they use IF this is actually causing the issue here.

Link to comment
Share on other sites

I'm able to move around without any kind of problems when I set the repeat delay really low with

xset r rate <really-low-value>

Low value being anything less than 10 & above zero.

But this makes typing actual words in-game impossible, for example "shotgun" on the map becomes "sssshhhhhoooootttttgggguuuuunnnn" which admittedly is kinda funny out of context, like my character just can't contain their excitement.

I haven't tried turning repeat off yet, I don't think. I'll give it a try though later just in case.

Edit: that doesn't work, at all

 

Also, as suggested setting XMODIFIERS to "@im=null" like below:

XMODIFIERS="@im=null"

Before the game is launched doesn't seem to totally fix the problem.

Edited by eternal_zomboid
Link to comment
Share on other sites

I take back my last post. At least somewhat.

The issue seems no longer present in my case, after I read up more & made a tiny change to projectzomboid.sh.

To preface what I done, I saw plenty online of people exporting XMODIFIERS in the environment before launching applications or games, then setting it back to the prior value when the thing was finished or terminated. Instead of just setting it like "XMODIFIERS=...".

 

So at execution of the game, I've got this

prev_XMOD=$XMODIFIERS
...
echo "64-bit java detected"
...
# XMODIFIERS is cleared here to prevent SCIM screwing up keyboard input
export XMODIFIERS="@im=null"
LD_PRELOAD="${LD_PRELOAD}:${JSIG}:libPZXInitThreads64.so" ./ProjectZomboid64 "$@" >"${LOGFILE}"
export XMODIFIERS=$prev_XMOD

Same goes for 32-bit or the Java part of projectzomboid.sh at the bottom.

Turns out exporting it must be really important, or key input is still glitchy. Not sure if it can be exported to just an empty string, haven't tried that, I'm just happy my input isn't weird.

 

Should anyone want, here's a link to an unlisted pastebin of my projectzomboid.sh. I've also made it launch the game with gamemoderun if its present on the machine.

Password for the pastebin is NZTcZDvaXv

Link to comment
Share on other sites

  • eternal_zomboid changed the title to [41.65] [Linux] Keyboard inputs sometimes will not register. (fixed! at least in my case. posted my solution)
  • 3 months later...

This is still an issue with 41.69 - kind of hoped some steam deck improvements might have fixed it as a side effect.

The workaround mentioned in the previous posts still works though.

 

Is there anything any of us linux users can provide to get this fixed properly?

 

----

Edit:


Perhaps I found an alternative way of fixing it on Linux - no clue since I would have to play a few hours to see if it occurs anymore without having the workaround set.

So I went to https://www.lwjgl.org/browse/release/3.3.1 and downloaded https://build.lwjgl.org/release/3.3.1/lwjgl-3.3.1.zip

 

After that I extracted the following files from the .zip to some temporary folder
 

/lwjgl/lwjgl.jar
/lwjgl/lwjgl-natives-linux.jar
/lwjgl-glfw/lwjgl-glfw.jar
/lwjgl-glfw/lwjgl-glfw-natives-linux.jar
/lwjgl-jemalloc/lwjgl-jemalloc.jar
/lwjgl-jemalloc/lwjgl-jemalloc-natives-linux.jar
/lwjgl-opengl/lwjgl-opengl.jar
/lwjgl-opengl/lwjgl-opengl-natives-linux.jar

 

Now I've renamed them so all of them end in "-new.jar" - this is so they will not replace the original files.

After that I copied them to the /ProjectZomboid/projectzomboid/ folder, on my system found in

/home/engineofdarkness/.steam/debian-installation/steamapps/common/ProjectZomboid/projectzomboid/

I now have the "vanilla" jar files and the new files in that directory.

Now I needed to make Project Zomboid use the files - opened /ProjectZomboid/projectzomboid/ProjectZomboid64.json

which on my system is in

/home/engineofdarkness/.steam/debian-installation/steamapps/common/ProjectZomboid/projectzomboid/ProjectZomboid64.json

and there I replaced the following lines

        "lwjgl.jar",
        "lwjgl-natives-linux.jar",
        "lwjgl-glfw.jar",
        "lwjgl-glfw-natives-linux.jar",
        "lwjgl-jemalloc.jar",
        "lwjgl-jemalloc-natives-linux.jar",
        "lwjgl-opengl.jar",
        "lwjgl-opengl-natives-linux.jar",

with

        "lwjgl-new.jar",
        "lwjgl-natives-linux-new.jar",
        "lwjgl-glfw-new.jar",
        "lwjgl-glfw-natives-linux-new.jar",
        "lwjgl-jemalloc-new.jar",
        "lwjgl-jemalloc-natives-linux-new.jar",
        "lwjgl-opengl-new.jar",
        "lwjgl-opengl-natives-linux-new.jar",

How do I know these are even used? Well in the beginning I only replaced the two glfw files files and the game window did not open any longer. After that I just replaced almost all "lwjgl" files and the game launched again.

There is NO replacement for lwjgl_util.jar though (this is the one exception - there is no replacement in the download of lwjgl ).
 

Nevertheless the game loads into the menu and also my save in which I just walked around for 5 Minutes, so no promises the game just crashes at some other point or that this even fixes the bug.

Also not sure how this behaves with Multiplayer (I don't play in MP).

----

EDIT: I didn't have this problem anymore in multiple hours of playing, so "updating" GLFW by updating LWJGL seems to have fixed it

Edited by EngineOfDarkness
Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

Still having this issue as well. I have tried replacing the same files with versions 3.3.1 and 3.3.3... except for the lwjgl_util.jar which is apparently deprecated since the release of 3.0, even though Indie Stone appears to include lwjgl 3.2.3 for the other files, with their 41.78 release on Linux.

I have added the XMODIFIERS="@im=null" to my startup script. I have turned off repeating keys in gsettings (gnome/mate) and using xset -r. I do not have this problem with other games on linux or PZ in Windows dual boot i.e. same hardware. It's a USB wired keyboard.

It's hella frustrating as it makes it very easy to die in a key moment.

** Also, I found this. I believe that TIS may need this solution **
http://forum.lwjgl.org/index.php?topic=6827.0

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...