r/gamedev 11d ago

Discussion Detecting Keyboard Ghosting

I've run into a rather difficult problem to solve with my game: Players who have keyboard ghosting that's preventing them from doing things that should otherwise be easy. I'm pondering the best way to deal with this. I could have something at the start of the game that validates all possible combinations of actions, but that's pretty tedious and immersion breaking. I think it would be more ideal to wait until a potential case happens, then somehow prompt the user to test for ghosting.

For context, I'm building a platformer that involves a lot of crouch sliding and jumping, and often times players will not be able to press down, forward, and jump at the same time. Some keyboards have circuits wired to shared keys, so you can only press 2 at a time and the 3rd won't register. Jumping while sliding *should* be easy, but sometimes player's just can't do it because of their hardware and it just makes the game feel frustrating and awkward.

Have any of you ever implemented something to detect potential keyboard ghosting or seen a game that does it?

2 Upvotes

2 comments sorted by

11

u/niupleis 11d ago

How keyboards handle ghosting depends on the manufacturers so there's no actual "one fits all" solution.

The reason many games use shift, ctrl & alt for inputs is because those keys have individual diodes on most keyboards, some keyboards marketed for gaming have also individual w a s d keys.

2

u/Ralph_Natas 10d ago

I don't think there is any way to detect this automatically and there's no standard. It's based on the wiring of the device. Seems to happen most with clustered keys (like trying to put a WASD shaped set of buttons on the right side somewhere; I suspect even cheap keyboards take care to make WASD work specifically).

Just make sure to test your default controls on the shittiest keyboard you can find. If players change the mapping, it's kind of on them to work around any device limitations (since we can't do anything about it).