Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Heeelp! Need Keyboard Input Help....(multiple keypresses)

neurosyneurosy Posts: 4Member
I am working on a two-player, split screen game that is very keyboard intensive. Both players control their respective character via keyboard input. The character control is very fluid, but requires that the user hold down two or more keys (such as the 'up' AND 'left' keys to move in a diagonal direction. The problem is, I can not get the program to register more than three simultaneous keypresses. If player one is moving diagonally, then player two can only move up, down, left, or right as the fourth keypress does not register. If player one moves diagonally AND fires guns then player two cannot move at all! I am currently using the GetAsyncKeyState() API function inside of a do...while game loop. The players each have their own small form, which are child forms in an MDI. Please, please help as the game is complete except for this control issue. It pains me to not be able to share my game w/ family and friends because of this one little issue! I thank you in advance for your time and consideration on this problem!

thomas
sebek12345@aol.com
www.neurosy.com

Comments

  • AmanteAmante Posts: 52Member
    : I am working on a two-player, split screen game that is very keyboard intensive. Both players control their respective character via keyboard input. The character control is very fluid, but requires that the user hold down two or more keys (such as the 'up' AND 'left' keys to move in a diagonal direction. The problem is, I can not get the program to register more than three simultaneous keypresses. If player one is moving diagonally, then player two can only move up, down, left, or right as the fourth keypress does not register. If player one moves diagonally AND fires guns then player two cannot move at all! I am currently using the GetAsyncKeyState() API function inside of a do...while game loop. The players each have their own small form, which are child forms in an MDI. Please, please help as the game is complete except for this control issue. It pains me to not be able to share my game w/ family and friends because of this one little issue! I thank you in advance for your time and consideration on this problem!
    :
    : thomas
    : sebek12345@aol.com
    : www.neurosy.com
    :


  • AmanteAmante Posts: 52Member
    Once there was a game called StarControl, and i also remmber it have this problem.
    It's called KeyBoard - Jam, in any keyboard it's diffrent.
    After pressing some keys , and keep them pressed, messages of pressing other keys are not passed. But some times there are still keys that do pass the messages. Like if you keep keys 1,2,3,4,5 pressed, you will not get the key 6 message, but you will get ' key pressed, or so.
    You just need to find the keys that do work.
    StarControl had a program to find those key jamming.

    Don.

    : I am working on a two-player, split screen game that is very keyboard intensive. Both players control their respective character via keyboard input. The character control is very fluid, but requires that the user hold down two or more keys (such as the 'up' AND 'left' keys to move in a diagonal direction. The problem is, I can not get the program to register more than three simultaneous keypresses. If player one is moving diagonally, then player two can only move up, down, left, or right as the fourth keypress does not register. If player one moves diagonally AND fires guns then player two cannot move at all! I am currently using the GetAsyncKeyState() API function inside of a do...while game loop. The players each have their own small form, which are child forms in an MDI. Please, please help as the game is complete except for this control issue. It pains me to not be able to share my game w/ family and friends because of this one little issue! I thank you in advance for your time and consideration on this problem!
    :
    : thomas
    : sebek12345@aol.com
    : www.neurosy.com
    :


  • neurosyneurosy Posts: 4Member
    Don,
    Thank you much for your kind response and most excellent input. I have discovered that there is an inconsistency insofar as some keys are blocked while others are not. A most perplexing, but nonetheless interesting, dilemma. I will try to find StarControl and see if their program is of any use. I think my only reservation might be that perhaps the key combinations are also different for each keyboard - wouldn't that be fun! LOL. I have exhausted all other options here, so I will certainly pursue your lead. Thanx again!


    : Once there was a game called StarControl, and i also remmber it have this problem.
    : It's called KeyBoard - Jam, in any keyboard it's diffrent.
    : After pressing some keys , and keep them pressed, messages of pressing other keys are not passed. But some times there are still keys that do pass the messages. Like if you keep keys 1,2,3,4,5 pressed, you will not get the key 6 message, but you will get ' key pressed, or so.
    : You just need to find the keys that do work.
    : StarControl had a program to find those key jamming.
    :
    : Don.




  • MachairaMachaira Posts: 13Member
    You might want to look at DirectInput. Using the API for keyboard handling is problematic at best when trying to capture multiple keys pressed at the same time.

Sign In or Register to comment.