Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Problem detecting several keys pressed? - article

Author
Message
Binary Agents
18
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Everywhere
Posted: 8th Nov 2006 00:50 Edited at: 8th Nov 2006 00:51
(Not sure if this is right place for this, so Mods - feel free to move it)

I have put together a short article explaining why we often have problems detecting several keys held down at the same time. It explains 'ghosting' and 'masking' on keyboards. This is something which drove me mad until I looked into the hardware workings of standard keyboards.

I hope you find it useful and I hope its reasonably easy to understand. Comments always welcome.

Download 190kb PDF
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Nov 2006 21:36
An excellent insight into how it all works

Just one minor alteration required...

...but bare with me...

should be

...but bear with me...

We don't want naked programmers all over the globe now, do we!



Binary Agents
18
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Everywhere
Posted: 9th Nov 2006 01:27
Thanks BatVink. Glad you liked it.

Oh, and if you've got it... you can bare it
Mr Tank
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 9th Nov 2006 03:19 Edited at: 9th Nov 2006 23:08
Thanks. This is interesting stuff. I knew my keyboard went crappy when i press more than a few keys at a time, and now i know why.
I managed to make a table of which keys go where on the matrix (it took ages) I wonder whether there is a way to access the keyboard matrix instead of using scancode in dbp.
I say this because with wasd, if you are going diagonally forwards and sideways, and then change to going backwards/sideways, but accidentally go through a state where w and s are both pressed along with a or d (or left arrow, for instance), then you get the beeping, and it also seems that any other keyboard input is ingnored during this time (scancode states remain as they were at the start of the beeping), even the other keys share no rows/colums in the matrix with wasd.
I know most people seem to do ok with never hitting w and s simultaneously, but it just seems kind of annoying.

Here's the chart. Bizarrely, there are 17 columns, and scr lock has one all to itself. "odd key" is the one next to alt gr. No idea whether this is the same for other keyboards. I imagine the basic letter keys are similar.



You'll be able to click on this someday.
Sunflash
18
Years of Service
User Offline
Joined: 28th Jun 2005
Location: Seattle, Wa
Posted: 10th Nov 2006 07:32
Wow, this is VERY interesting! Thanks Binary Agents!

"I must tell the Queen that a robin has seen Cludd hanging about. No, thats not right. I must tell the robin that Cludd has been hanging the Queen..." -Mossflower.
Binary Agents
18
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Everywhere
Posted: 11th Nov 2006 20:13
Thanks Mr. Tank and Sunflash. Glad you found it useful.

Incidentally, I have just seen that the new Razer Tarantula Gaming Keyboard is being released on 30th November which claims no ghosting and unlimited simultaneous key presses! It does cost £89.99 though so I won't be getting one. It would be interesting to see how it performs though.
Code Dragon
17
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 11th Nov 2006 20:34 Edited at: 12th Nov 2006 03:13
That's interesting, but it was pretty hard to understand. I never knew keyboards had such annoying problems. None of those things happen on my keyboard, maybe it has diodes, I don't know.

Confucius say Zero-Defect Software Development will improve quality and reduce development time.
Mr Tank
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 12th Nov 2006 00:57
I would get one of those special keyboards, but the thing is, if i make games that require one, almost noone will be able to play them!
That's the annoying thing about PCs. I'm not even sure most people have gamepads.


You'll be able to click on this someday.

Login to post a reply

Server time is: 2024-04-24 10:07:52
Your offset time is: 2024-04-24 10:07:52