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.

AppGameKit Classic Chat / GetRawKeyState Issues?

Author
Message
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 22nd Sep 2021 14:38 Edited at: 22nd Sep 2021 14:41
I have 4 keys mapped, left, right, up and space to control a sprite, left/right=rotate, up=move forward in the facing direction and space=file a bullet

All keys and functions work independently but I get a single fail case, rotate right while moving forward and fire, fine, switch to rotate left while still moving forward and firing and the key press fails, back to right and its fine, no else clause, all single IF's should work

in short the left key press is being ignored if the up key and space bar is down ... Bug??



Edit: if I change "Space" to "Enter" it works as expected, something in the space key press is blocking other keys

Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 22nd Sep 2021 15:18
Seems to be working fine here. Hardware issue maybe? I'd try testing with another keyboard if you can.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 22nd Sep 2021 15:33
Works fine on my Keyboard(s) as well... although this said keep in mind how a Keyboard works.

A Sequence of Keys are on a Rail, and when a Key is pressed it adds Resistance on said Rail.
Now let's say for example we have an older keyboard, where perhaps the Resistance is greatly reduced on highly used keys (like the Spacebar)
Well it's possible that while the Signal Range is "Fine" when it's on it's own... it could get drowned out by another Key in the Sequence., like say the Left Cursor.

Of course those not on the same rail would signal just fine.
I've seen very similar behaviour on quite old Hardware (like my Acorn Electron, which I've been recently renovating)
Usual to see it happen on a more modern keyboard, but it could be you're heavy handed or the design of the spacebar doesn't evenly depress it when it's hit from one of the sides.

This said, I'm just making an educated guess based on the exhibited behaviour.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Sep 2021 18:27 Edited at: 22nd Sep 2021 18:30
On my phone so cant test. Sounds a lot like key rollover: https://en.wikipedia.org/wiki/Rollover_(key) (common enough on "cheaper" keyboards for it to continue to pop up on the forums).

Google showed some small test apps, too, if u want to confirm.

Otherwise, try re-mapping ur controls away from some of the "problem" keys.
[My Itch.io Home] [AGK on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
adambiser
AGK Developer
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 22nd Sep 2021 19:20 Edited at: 22nd Sep 2021 19:36
Raven, another well though out and correct reply.

I plugged in another keyboard and same result but ... If I press the space on keyboard A and the arrow keys on keyboard B then it works.

This just confused me even more, so I got out a screw driver and a multi meter!

The spacebar seems to bridge all 4 lines and prevents certain keys from registering but a bit of research on keyboard wiring I think I have figured it out, most keys need access to a line in case a modifier key is pressed space being among the exemptions, the voltage varies a little from key to key but it appears under certain conditions space will lock out other keys and vice versa, I'll just change my fire button key and call it a hardware limitation.

The spacebar resistance was a little unpredictable I use some switch cleaner but it was still not exactly a reliable, it could be worn or may the variable voltage is how the space bridges all 4 lines, I don't know, its a clever system tho.

A lesson learned, when using multiple key input ALWAYS use keys accessible from modifier keys, up to 4 key at once seems to be stable but 5 and I got the same results with some keys taking precedence over others.

Another lesson learned, I have to buy some new equipment!!

EDIT: Yes, soz didn't see your posts, as you say its the old hardware, I tested it the old skool way lol
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Sep 2021 19:35
I think this issue has been posted before
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 24th Sep 2021 16:05
This is a very old hardware issue which is referred to as keyboard "Ghosts" and "Masks". I wrote an article explaining it a long, long time ago (2006) which should explain why it happens:

https://www.worldbydesign.com/keyboardghosts.pdf

Basically when multiple keys are pressed it can either think extra "ghost" keys are also being pressed, or that some keys are "masked" and the keyboard doesn't recognise them as being held down. It is all down the way the keyboard matrix is designed. Hopefully the above PDF should explain it.

Login to post a reply

Server time is: 2024-11-21 17:46:19
Your offset time is: 2024-11-21 17:46:19