New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input gets buffered #22658

Closed
netforce10 opened this Issue Dec 22, 2017 · 14 comments

Comments

@netforce10

netforce10 commented Dec 22, 2017

Game version: 0.c-25560 build 7021and many previous ones as well. Version 0.C-23275-g7f8c2e7 doesn't have this issue.

Operating system: linux mint

Tiles or curses: Tiles

Mods active: default

Expected behavior

After holding down a direction key for a while and then releasing it should stop (almost) immediately.

Actual behavior

It continues moving in the direction for multiple tiles, if while it is moving you press a different movement key then that gets queued and executed at the end.

Steps to reproduce the behavior

For me the way to reproduce it is to hold a direction key for a while and then release it.

According to someone on reddit it might have been because of a the sdl2 version it uses but according to the ldd command both use exactly the same version of the sdl2 library. If I use a smaller window size the issue get significantly less.

@Tharn

This comment has been minimized.

Show comment
Hide comment
@Tharn

Tharn Dec 24, 2017

Can confirm, made a report about this at #22483

Tharn commented Dec 24, 2017

Can confirm, made a report about this at #22483

@aeoo

This comment has been minimized.

Show comment
Hide comment
@aeoo

aeoo Dec 26, 2017

I can confirm this as well, Linux Arch here.

aeoo commented Dec 26, 2017

I can confirm this as well, Linux Arch here.

@bolodyai

This comment has been minimized.

Show comment
Hide comment
@bolodyai

bolodyai Jan 1, 2018

Huh, I've experienced this bug months ago. Tested it with current version and it's still here. Bug happens only if I use numpad, arrow keys work fine.
Given that nobody filed a report earlier, I think this bug is rare enough that it manifests only on some OS/SDL version combinations (my is gentoo, libsdl2-2.0.6).

Bisection tells that first commit responsible for bug is 43fff67 that indeed tinkers with sdltiles.cpp a little.
After a quick glance I've removed "text_refresh = true" at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/sdltiles.cpp#L1270 and bug disappeared.
Of course, I won't PR this as a solution, it's just a hack to stop trying to refresh display every time button is pressed. Someone familliar with cataclysm input subsystem and SDL should dive into that mess to find the real problem source.

bolodyai commented Jan 1, 2018

Huh, I've experienced this bug months ago. Tested it with current version and it's still here. Bug happens only if I use numpad, arrow keys work fine.
Given that nobody filed a report earlier, I think this bug is rare enough that it manifests only on some OS/SDL version combinations (my is gentoo, libsdl2-2.0.6).

Bisection tells that first commit responsible for bug is 43fff67 that indeed tinkers with sdltiles.cpp a little.
After a quick glance I've removed "text_refresh = true" at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/sdltiles.cpp#L1270 and bug disappeared.
Of course, I won't PR this as a solution, it's just a hack to stop trying to refresh display every time button is pressed. Someone familliar with cataclysm input subsystem and SDL should dive into that mess to find the real problem source.

@nshcat

This comment has been minimized.

Show comment
Hide comment
@nshcat

nshcat Jan 2, 2018

Contributor

Can confirm this, running Arch Linux with SDL version 2.0.7-1

Contributor

nshcat commented Jan 2, 2018

Can confirm this, running Arch Linux with SDL version 2.0.7-1

@ZhilkinSerg

This comment has been minimized.

Show comment
Hide comment
@ZhilkinSerg

ZhilkinSerg Jan 2, 2018

Contributor

Huh, I've experienced this bug months ago. Tested it with current version and it's still here. Bug happens only if I use numpad, arrow keys work fine.
Given that nobody filed a report earlier, I think this bug is rare enough that it manifests only on some OS/SDL version combinations (my is gentoo, libsdl2-2.0.6).

Bisection tells that first commit responsible for bug is 43fff67 that indeed tinkers with sdltiles.cpp a little.
After a quick glance I've removed "text_refresh = true" at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/sdltiles.cpp#L1270 and bug disappeared.
Of course, I won't PR this as a solution, it's just a hack to stop trying to refresh display every time button is pressed. Someone familliar with cataclysm input subsystem and SDL should dive into that mess to find the real problem source.

Very interesting. I guess SDL_TEXTINPUT event is used for those text inputs when characters are displayed on screen and it should not be used for all of key inputs.

Linking #22084.

Contributor

ZhilkinSerg commented Jan 2, 2018

Huh, I've experienced this bug months ago. Tested it with current version and it's still here. Bug happens only if I use numpad, arrow keys work fine.
Given that nobody filed a report earlier, I think this bug is rare enough that it manifests only on some OS/SDL version combinations (my is gentoo, libsdl2-2.0.6).

Bisection tells that first commit responsible for bug is 43fff67 that indeed tinkers with sdltiles.cpp a little.
After a quick glance I've removed "text_refresh = true" at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/sdltiles.cpp#L1270 and bug disappeared.
Of course, I won't PR this as a solution, it's just a hack to stop trying to refresh display every time button is pressed. Someone familliar with cataclysm input subsystem and SDL should dive into that mess to find the real problem source.

Very interesting. I guess SDL_TEXTINPUT event is used for those text inputs when characters are displayed on screen and it should not be used for all of key inputs.

Linking #22084.

@Leland

This comment has been minimized.

Show comment
Hide comment
@Leland

Leland Jan 22, 2018

Contributor

@Tharn I'm combining your other issue here:

Game version: Tested build 6942 and 6951
Operating system: Win 8.1 x64
Tiles or curses: Tiles
Mods active:

Recently, moving over tiles with a lot of inventory on them produces noticeable slowdown, to the point that you can chain move commands and watch the game catch up for half a minute.

Similarly, when driving a vehicle, the display will lag behind the input to the point that collisions become inevitable. There is this strange across-turn delay where you can pull a vehicle around, complete the turn and hit numpad 5 a couple of times - watching the vehicle continue to turn.

It does this in both software and hardware rendering modes. The game has been handling massive inventories just fine a few dozen builds ago.

Contributor

Leland commented Jan 22, 2018

@Tharn I'm combining your other issue here:

Game version: Tested build 6942 and 6951
Operating system: Win 8.1 x64
Tiles or curses: Tiles
Mods active:

Recently, moving over tiles with a lot of inventory on them produces noticeable slowdown, to the point that you can chain move commands and watch the game catch up for half a minute.

Similarly, when driving a vehicle, the display will lag behind the input to the point that collisions become inevitable. There is this strange across-turn delay where you can pull a vehicle around, complete the turn and hit numpad 5 a couple of times - watching the vehicle continue to turn.

It does this in both software and hardware rendering modes. The game has been handling massive inventories just fine a few dozen builds ago.

@AMurkin

This comment has been minimized.

Show comment
Hide comment
@AMurkin

AMurkin Jan 22, 2018

Contributor

24ec07a - probably previous fix of a such issue.

Contributor

AMurkin commented Jan 22, 2018

24ec07a - probably previous fix of a such issue.

@zsebastian

This comment has been minimized.

Show comment
Hide comment
@zsebastian

zsebastian Feb 20, 2018

Can confirm: using Arch Linux with sdl 2.0.7-1 on cataclysm commit 1688d77. I've experienced this bug for months now. Is anyone working on this? I have some time this week, I'm thinking about testing different version of SDL and perhaps bisect the repo to figure out where this started. Has anyone done this work yet?

zsebastian commented Feb 20, 2018

Can confirm: using Arch Linux with sdl 2.0.7-1 on cataclysm commit 1688d77. I've experienced this bug for months now. Is anyone working on this? I have some time this week, I'm thinking about testing different version of SDL and perhaps bisect the repo to figure out where this started. Has anyone done this work yet?

@kevingranade

This comment has been minimized.

Show comment
Hide comment
@kevingranade

kevingranade Feb 20, 2018

Member

I haven't had a chance to look into it, unlikely anyone else is either.

Member

kevingranade commented Feb 20, 2018

I haven't had a chance to look into it, unlikely anyone else is either.

@pookleblinky

This comment has been minimized.

Show comment
Hide comment
@pookleblinky

pookleblinky Mar 7, 2018

I experienced the same bug, modifying SDL_TEXTINPUT fixed it for me as well. It's not worth forking just to merge around that one line, but I did create a note to remind myself to check for it whenever I pull the latest version. Given that it's on the roadmap for 0.D it'll probably get fixed soon, anyway.

pookleblinky commented Mar 7, 2018

I experienced the same bug, modifying SDL_TEXTINPUT fixed it for me as well. It's not worth forking just to merge around that one line, but I did create a note to remind myself to check for it whenever I pull the latest version. Given that it's on the roadmap for 0.D it'll probably get fixed soon, anyway.

@Litppunk

This comment has been minimized.

Show comment
Hide comment
@Litppunk

Litppunk Apr 25, 2018

Oh, I don't think that this is a bug, or at least it can be fixed for Linux users outside of the game, tracked it down to the input spacing(forget the actual name) it should be in the keyboard menu found the solution while I was getting the dualboot setup (ubuntu). I'll get back with more details next time Im logged in on that side of the dual boot.
But basically theres two sliders that determine the press & hold delay for keypresses to become multiple presses, and how fast the keypress repeat is. Takes a little tweaking, but if you find the sweet spot, it resolves this issue 100% (including keypresses for scrolling in the menus), with no ill effects elsewhere. Overall workflow seems better in general once that sweet spot is atained too.

Litppunk commented Apr 25, 2018

Oh, I don't think that this is a bug, or at least it can be fixed for Linux users outside of the game, tracked it down to the input spacing(forget the actual name) it should be in the keyboard menu found the solution while I was getting the dualboot setup (ubuntu). I'll get back with more details next time Im logged in on that side of the dual boot.
But basically theres two sliders that determine the press & hold delay for keypresses to become multiple presses, and how fast the keypress repeat is. Takes a little tweaking, but if you find the sweet spot, it resolves this issue 100% (including keypresses for scrolling in the menus), with no ill effects elsewhere. Overall workflow seems better in general once that sweet spot is atained too.

@int-ua

This comment has been minimized.

Show comment
Hide comment
@int-ua

int-ua Apr 26, 2018

Contributor

@Litppunk
AFAIU it's still a bug, but adjusting keyboard repeat rate (that's how it's called in KDE5 settings) just under the threshold for this problem is an interesting way to workaround it.

Can you launch some other CPU-intensive task and try playing again with the same rate settings?

Contributor

int-ua commented Apr 26, 2018

@Litppunk
AFAIU it's still a bug, but adjusting keyboard repeat rate (that's how it's called in KDE5 settings) just under the threshold for this problem is an interesting way to workaround it.

Can you launch some other CPU-intensive task and try playing again with the same rate settings?

@Litppunk

This comment has been minimized.

Show comment
Hide comment
@Litppunk

Litppunk Apr 27, 2018

I don't think i can find anything CPU intensive enough to make this computer drag, but I will let you know.
screenshot from 2018-04-26 14-35-55
This is the sweet spot for me, in case anyone else wants to work around it this way. I'll test the play soon as I get some free time with my computer again, which will prob be Monday at the earliest.

Litppunk commented Apr 27, 2018

I don't think i can find anything CPU intensive enough to make this computer drag, but I will let you know.
screenshot from 2018-04-26 14-35-55
This is the sweet spot for me, in case anyone else wants to work around it this way. I'll test the play soon as I get some free time with my computer again, which will prob be Monday at the earliest.

@Litppunk

This comment has been minimized.

Show comment
Hide comment
@Litppunk

Litppunk Apr 30, 2018

Nope, I've played several versions now including one near the start of the weekend and one today (.C-27598-g4d1238c), and I don't notice any obnoxious level of input lag. It is amazing not being frustrated at input lag from even the simple things like scrolling through the crafting and inventory menus. Strongly recommend for anyone else who has had this problem, even if the bug gets resolved.

Litppunk commented Apr 30, 2018

Nope, I've played several versions now including one near the start of the weekend and one today (.C-27598-g4d1238c), and I don't notice any obnoxious level of input lag. It is amazing not being frustrated at input lag from even the simple things like scrolling through the crafting and inventory menus. Strongly recommend for anyone else who has had this problem, even if the bug gets resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment