SDL More KeyPresses?

I'm developing a SDL2 game framework on YT.
I have a demo game which is basically pong with extra steps.
My problem is that if player "wasd" is holding a button down and player "arrows" then holds three keys (left, up, right), player wasd loses control of their key presses. (So arrows not only can cheat, but it's an easy enough combo that it might be done by accident)

I think the problem lies with the spamming of the held-down keys overloading the keysym buffer.
The game only needs to capture initial keydown-keyup. Is there a way to ignore spamming of the held down key on polling event, and maybe then capture more initial presses?

In github the game is in demo->pong
https://github.com/Michael-LightGameFramework/LightGameFrameworkSDL2

(Edit: Now I've tested the game on my laptop, and notice that any keydown held will also freeze the touch-pad mouse. All my machines are Fedora-Linux at this point, so I don't know how Windoze or Mac might handle things, this might be a drivers issue.)

(Edit2: Yep, if I open a non-related text editor in Fedora and hold left-up-right, then I lose all ability to type any other keys. Weird. Definitely an OS issue. Well, that stinks for wasd multiplayer gaming. Anyone else experiencing this? I don't have the time or know-how in order to submit a bug report...)
Last edited on
You're stuck with a fundamental limitation of how all keyboards work.

There isn't a dedicated pair of wires from each switch to the keyboard controller, and then onto the computer. Each switch is just the junction of a matrix of row and column wires.

Basically, you can only press a very few keys simultaneously before the whole thing stops making sense.

Scroll down to the last couple of pictures.
https://apple.stackexchange.com/questions/298853/keyboard-key-stuck-or-not-being-recognized-how-to-fix
You're stuck with a fundamental limitation of how all keyboards work.

It's not a limitation of all keyboards, but nearly all cheap keyboards and some more expensive ones. If this is a problem, you'll want to look for a keyboard which supports a feature called N-key rollover. Obviously that won't help your users.

This problem is called "key ghosting" (or occasionally "key jamming"). Occasionally, ghosting results in spurious key presses, but more commonly the system recognizes this situation and ignores any key press which might be spurious, resulting in the situation you describe.

https://en.wikipedia.org/wiki/Rollover_(key)

Try to design your game so that it works on a cheap keyboard. ;)
Last edited on
Wow. I remember wondering why anyone would buy an $80 keyboard when a $15 one was sitting a foot away. Now I know the answer.
Thanks guys, I wasn't even considering that the hardware might be the issue.
Topic archived. No new replies allowed.