Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Qa303asmGuru

Handling multiple simultaneous keypresses...

This topic is 5479 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Currently I have a 2 player coop mode for my shoot ''em up style game (which will be released for testing sometime next spring), and I noticed that whenever I''m playing with someone else, if we are using the same keyboard, our ships will be unresponsive at times. I''m guessing this is due to the fact that the keyboard can only handle so many simultaneous keypresses. Is there an alternative to this that will make the keyboard respond to more simultaneous keypresses? I''m using the DInput8 interface for input. Any advice would be greatly appreciated. -Q | My Unfinished Page | | I need answers! | | Genaside presents: Hazard Ball | | Maddox |

Share this post


Link to post
Share on other sites
Advertisement
What you need to do is buffer the input from directinput.

So when you press a key, it remains in the buffer until you clear it.

Then you can test:

if (buffer[KEY_A] && buffer[KEY_B]) { .. do stuff .. }

Share this post


Link to post
Share on other sites
Nope, there's nothing you can do - keyboards *physically* can't register more than several keys at once. Depending on your particular make of keyboard, it may be able to recognize more simultaneous keypresses than others. I suppose it might be possible for keyboard manufacturers to make one with different internal electronics so that it can recognize loads of keys at once, but I've never heard of it. Basically, don't count on being able to recognize more than 6 or 7 keys held at once.

P.s. I'd like to clarify, buffering *won't* help, as the problem is with the keyboard hardware itself, not in software. I mean, buffering might fix similar problems, but this one in particular can't be solved with any fancy software trickery.

[edited by - hinch on September 22, 2003 12:56:13 PM]

Share this post


Link to post
Share on other sites
A general rule of thumb is that is a set of 3 keys forms an ''L'' shape, you probably can''t press all three at once.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!