A major bug that caused the input to lag on Steam Deck or Linux + Proton while playing with a joypad has finally been fixed. Thank you for your patience and massive thanks to everyone who helped fixing it!
Long version
The bug
Several users reported input lag spikes after playing through the game's story or tutorial mode on Steam Deck. The issue only happened when playing with a joypad and only on Steam Deck or Linux + Proton (albeit more rarely), while Windows was completely unaffected.
The cause
Back in 2016, I edited the irrlicht source code to allow for detecting joypads more than once. The original behavior was to keep adding joypads at every new detection, effectively duplicating the list. This was fine at the time because the function to detect joypads was meant to be called only once, when the game started up.
My modification cleared the list of detected joypads before starting a new detection, to solve this issue. Unfortunately, what I didn't do was also releasing the already detected devices, which somehow still lingered in memory, causing the input events to be duplicated or missed entirely after enough detections had been triggered.
The solution
The solution to this bug was going back to that 2016 code and release all the previously detected devices before clearing the list. This apparently was the core of the issue.
Special thanks
My thanks go to the members of the community that helped me tackle this nasty bug, since I didn't own a Steam Deck to check it. In no particular order:
-
Desaeta, who first reported the bug and helped me find the root cause (see this thread)
-
Gamingjunkie222 for confirming the bug independently on Twitter, which made things easier to deal with (i.e. showing me it wasn't a bug that just affected one single user)
-
GamingWarthog and 4C3M4N777, who verified that the fix is indeed working as intended
Changed files in this update