Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Splitscreen and keyboard input

This thread is locked; no one can reply to it. rss feed Print
Splitscreen and keyboard input
Zaphos
Member #1,468
August 2001

In allegro, if you press too many keys at the same time the keyboard stops responding properly, beeps, and even occasionally gives error messages (secondhand report; it never happened to me). This isn't really a problem because most games don't require you to press more than three keys at any one time, and allegro can handle that most of the time. But what about splitscreen? In a splitscreen game, having six keys pressed at the same time is relatively common ... and some keyboards / computers just can't handle this with allegro's standard input checks. Is there any command set or method I can look into that handles large amounts of simultaneous keyboard input?

I know this has been done before ...

[ January 02, 2002: Message edited by: Zaphos ]

Johnny13
Member #805
October 2000
avatar

u means 2-players game?
i think that's limit of the keyboard hardware

Alg3D Praise my Games!!<code>#define SPAMMER (post>=666&&postperday>=6)</code><Mr.spellcaster>What post? <Mr.spellcaster>A useful post by me.

Zaphos
Member #1,468
August 2001

No no ... I've seen games that get very good input for two-player splitscreen ... and Gemini posted, before:
quote: However, some programs like Impulse Tracker for DOS can have so many keys held down at once it's just amazing. I've seen IT register over 20 keys at once before! (It has a debugger for its keyboard routines which shows the HEX values of all the keys and lights up those which are held down.) Now, if someone could get in touch with the guy who coded those routines and impelement them into Allegro, it would be soooooo sweet.
So it isn't completely the hardware ... it might be the OS, but I kinda doubt that ... so it should be possible to get very high quality keyboard input ... the question is ... how?

23yrold3yrold
Member #1,134
March 2001
avatar

Never thought about it, but here's a random thought ....code:
int mykeys[128]; // or however many keys there are

...

// game logic
while(keypressed())
{
mykeys[readkey() >> 8] = 1;
}

// act on player input

// all done with player input
for(int i = 0 ; i < 128 ; i++)
mykeys[i] = 0;
Yes? No? Maybe so?

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Johnny13
Member #805
October 2000
avatar

The cheap IBM keyboard is not for exciting-action game.
I suggest buy a Microsoft SIDEWINDER FreestylePro joypad!
[ January 03, 2002: Message edited by: Johnny13 ]

Alg3D Praise my Games!!<code>#define SPAMMER (post>=666&&postperday>=6)</code><Mr.spellcaster>What post? <Mr.spellcaster>A useful post by me.

Zaphos
Member #1,468
August 2001

Buying new hardware IS NOT THE SOLUTION to technical problems like this. I don't want a game that only I can play ... I want a game that ANYONE can play ... to the greatest extent possible. And I don't get this problem anyway, I see it on other peoples' comps.

Bob
Free Market Evangelist
September 2000
avatar

Unfortunately, it is a hardware limitation. It's because of the way keyboards are built. To remain cheap, they use electrically conductive ink instead of wires. This works fine if you have only one button, or several buttons with only one being pressed at a time. However, you can't make diodes with ink - so it is possible for you to press three keys but the keyboard detects 4 of them pressed at a time (sometimes more). The keyboard logic detects this situation (if num_pressed_keys > 3), and ignores any subsequent key presses, since they might be "ghost" keys.
The software on the other hand is perfectly capable of dealing with any number of simulatious key presses. The fact that IT can be shown to work with many keypresses at a time was probably due to the exceptional (or very old) keyboard that was being used.

--
- Bob
[ -- All my signature links are 404 -- ]

Zaphos
Member #1,468
August 2001

Ok ... darn. Gemini, could you verify that the reason for IT's high accuracy is a nice keyboard, and not software based? I know it's a hardware thing ... but I could swear that there were some software workarounds ...

Go to: