Holding keys before gameplay starts can result in incorrect input handling
Type
Game behaviour
Bug description
I'm an alt player, as in I always try to alternate my fingers when tapping. I have a habit of holding down 'z' when beginning a map and the first note I always tap is with 'c' as I play index-ring. Due to me holding down 'z' as the map is starting, I encountered a bug where when I click on the first circle with 'c', it does a double tap rather than a single tap. I can sort of tell what is going on, I watch the key counter on my screen, and from what I can tell, the game doesn't realize I have 'z' pressed when the level is starting/initializing. Rather, the game only realizes I have 'z' pressed after I tap 'c' which then registers both key presses simultaneously resulting in a double tap. This is obviously bad for gameplay, but also easily avoidable by just making sure to not hold down before starting a map (or what I like to do is just spam 'z' and 'c' until I see the map has finished loading and by that point, I've already gotten a few key presses on both keys, so that way I don't get a double tap).
Below I have shared a video of this issue. In the video is also a key overlay so that it is clear which key is being pressed as the one in-game is faulty due to this issue. The video first shows me holding 'z' as the level initializes and then clicking 'c' for the first circle, producing a double tap. Second, I prove that it works with either key being held first by holding 'c' first and then pressing 'z' for the first circle. I then redundantly produce the bug again by first holding 'z'. Finally, the video shows me not holding either button initially and tapping the two circles into a slider almost perfectly to prove it is not a skill issue.
Screenshots or videos
https://github.com/ppy/osu/assets/95505981/6780a21e-b4b5-4eb8-81b5-1e4fcc102bf9
Version
2023.513.0-lazer
Logs
runtime.log updater.log database.log input.log legacy-ipc.log network.log performance.log
A more sane bug description:
- Hold K1 during PlayerLoader.
- When the gameplay starts, while still holding K1, press K2.
Expected behavior: K2 keycount increases, K1 keycount does not increase. Actual behavior: Both K1 and K2 keycounts increase.
This is very likely going to be due to the state synchronisation logic in PassThroughInputManager.
I'm going to make this a priority 1 because I know for a fact this isn't the first time it's come up, and it's pretty detrimental to gameplay when it occurs.
The expected behaviour does not look to be stated here, so I checked osu!(stable) and it looks to consider the held key as pressed as soon as gameplay starts, rather than ignoring it entirely:
https://github.com/ppy/osu/assets/22781491/53960c25-0882-4782-91af-fa6c901ad929
Interestingly, PassThroughInputManager already works similarly, so the issue likely resides within KeyBindingContainer instead:
https://github.com/ppy/osu/assets/22781491/2361398a-dcf4-44ae-a4aa-6b440bdf9cb3
On second thought, KeyBindingContainer is designed to ignore already-held keys entirely, so unless the above behaviour is wanted, it's easier to just ignore the held key and fix the double-press issue.