Keyboard Problem - Only 4 Keys at a Time

Started by
9 comments, last by rajivtm 18 years, 1 month ago
Hello- I'm making a 2d DirectX 9 game where two players use the same keyboard. My keyboard seems to only allow 4 keys to be pushed down at a time, and then it disregards the rest. Other keyboards allow even less to be pushed down at a time. This is a huge problem in my game and neither me nor my users won't like the inconsistency between keyboards. Has anyone run into this before or have a possible solution? Thanks! Rajiv
Advertisement
There is no solution. This is a fundamental result of the way most keyboards are constructed, and there is no fix. This document discusses some of the problems and why they arise.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Personally, I believe players keen on one-PC-multiplayer should invest in a dual (or more) keyboard setup. I have 2 keyboards on my system (one PS2, one USB) and it works great for these situations.

I don't know if this will help, but its a thought.

You could alternate conrol of the keyboard each iteration of your main loop. For example, player 1's keys would be enabled for one iteration, then player 2's keys, then player 1's again, back and forth for the duration of your game. This will happen so fast it MAY give the appearance that all keys are working at the same time, it depends on how fast you update your input. If key repeat rate is an issue in your game this could wreak havoc on that as well...
codeXtremeif(you->intelligence < radish->intelligence) you->STFU();
It's an electrical thing, not a system thing. There's no way to temporarily "disable" a group of keys on the keyboard.
I used to play 2 player with my brother on the same keyboard through the nineties, and encountered this all the time (fighting games were a real pain). The only solutions that I know of are fairly obvious:
  • Design the game so only a few keys need to be pressed at any one time (and hope a malicious player doesn't press extra keys in order to disable their opponent).
  • Design the game so one player can play with an alternative device (joystick, gamepad, mouse).
  • Make the game turn-based

Of course, these probably invalidate your game idea. But I'm afraid the 2 player thing is something that has to be incorporated in at the design level.
Well, thanks a ton for your help everyone. It's not the answer I was hoping for, but I can now make a decision on what to do. I might as well try the alternating keyboard idea and I'll post it if it works for me.

Thanks again!
Rajiv
He was right it won't work. I didn't really understand that it was a hardware problem. Whether or not DI is ignoring the keys if the non-active player is still pressing his the active players keys won't register.
codeXtremeif(you->intelligence < radish->intelligence) you->STFU();
Hmm.. alrighty, I guess I'll check into using two keyboards. I know I have a few old ones sitting around, so hopefully my users will too.
buy a different keyboard .. this is a detail of the physical keyboards design and the controller chip used in it ... there are keyboards which support more keys than others. I used to buy $11 mitsumi keyboards from www.mwave.com and they supported more keys than the MS and logitech $40 keyboards at the time (4 years ago). There are also companies selling gamming keyboards (like saitek) that almost definately support more than 4 keys down at a time.

This topic is closed to new replies.

Advertisement