[FYI] several keystroke triplet combinations don't work

coding an input class I’m noticing that some keystroke triplet combinations fail to work, in a way that just the first 2 keystrokes are intercepted by panda3d but the third. In the sample test code below I settled a reading outputted to the panda window. I listed some faulty triplets on the top comment section of the code for the people who wanna try to test if this issue replicates in the own system as well - here the code to play with:

combinations tried that won't work:

  'cd' with one of these: [m , . s a ; k l ;]
  'gh' with [j u y r]

  'wa' with [ s q z ]
  'gh' with [j ; o s z]
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import *
from direct.gui.OnscreenText import OnscreenText

class world(DirectObject):
  def __init__(self):


    self._display=OnscreenText(pos=(0.,0.), parent=base.aspect2d,
      scale=.1, text='', fg=(1,1,1,1)

    l=[chr(n) for n in range(ord(' '), ord('~'))]
    for c in l:
      self.accept(c, self.down, [c])
      self.accept('%c-up'%c, self.up, [c])

  def down(self, c):
  def up(self, c):
    try: self.buttsdown.remove(c)
    finally: self.printmessage()
  def printmessage(self, m='Press a 3 key combination'):
    if len(self.buttsdown):
      for c in self.buttsdown:
        if not plus: plus='+'

if __name__ == "__main__":

that’s a keyboard issue. snippet of en.wikipedia.org/wiki/Keyboard_(computing :

no kidding! I never heard that and my keyboard fall plenty into the category “low-quality”, but I guess it isn’t so because my keyboard is a counter-strike veteran (I mean for solid half a dozen years) and I assure you I used constantly triplets like arrow_up+arrow_lef(/right)t+shift for run or numkey0 for crouch without a failure. BUT - I will follow your suggestion nonetheless so I’ll try to snatch a kb somewhere and try it when at home.

Beside: did you tested my code? Do you find it work for you that combination I pointed out?

modifier keys like shift, control or alt don’t count

I think I read once that the problem appears with keys that are in the same row. A+S+D won’t work, but A+D+W would.

I think it’s that way. I remember playing MicroMachines2 three guys on the same keyboard, and we had to configure the right key combinations!

ok I tried a brand new keyboard and, guess what, the issue is still here.

can’t get what you say here - I want to use them all in my game so they counts like any other key

in my keyboard W+A+S aren’t in the same row and this combination do not work. Anyhow, as I wrote above, this is just a small example - many other combinations don’t work, including modifiers like shift and so on.

Haven’t you tried it on XP ?
Upon such combination, the pc speaker beeps. While on Ubuntu, it doesn’t.
Same thing happens when I’m at BIOS screen.

thank god somebody is come to the rescue
yes Jo, I tried today on XP and replicated xactly your same behavior.
today I extended my demo code above to include all visible characters (I listed some other failing combination in the source) - if somebody else is listening this SOS please try to see if we are the only with crazy keyboards or have to issue a bugtrack

PS: @ Nemesis#13
ok now I get it - you meant that shift and such are processed differently and this is true!

thats a pretty old problem… have you never tried to play a two player game on one keyboard??? does it works correctly,it never did on dos or windows.

yeah. exactly the same behavior here. with some combinations you can have more than 6 keys pressed, with others not more than 2. strange

it’s not depending if it’s a new or a old keyboard. newer cheap keyboards are actually worse then old ones. and it highly depends on which keys you press. there are even keyboards that arent good enougth to type with 10fingers.

actually the keys you mention are usually not pressed at the same time. In a wasd controlled fps game, pressing w and s at the same time is as useless as pressing a and d.

if you read the text referenced in the first post exactly it describes your experiences.

“Modern keyboards prevent this from happening by blocking the 3rd key in certain key combinations” -> some key combinations only report 2 pressed keys

Echoing what Hypnos said; It truly depends on your keyboard. DirectInput can handle any number of simultaneous keys pressed. (Correct me if I am wrong, but I assume that Panda3d uses this on Windows for registering keyboard input.)

I have a Logitech G15 gaming keyboard on an older PC. I can press up to six keys, in any combination, and your program registers it no problem. (ie: a+s+d+f+g+h) But this is not your typical keyboard. It’s designed specifically for gaming.

I tried this same program on my laptop (a MacBook Pro), using the same version of Panda (1.6.2) with the same OS and DX version. In this case, I was able to press anywhere from 4 to 5 keys simultaneously, depending on what combinations I used.

For example, a+s+d+f+g, but n+k+j+c. For njkc, I could press some of the number keys, such as nkjc5 but not njkc3.

You really should factor this into your designs. Some keyboards do very simple matrix scanning, and therefore can’t handle more than a few keys pressed at once. As has already been pointed out, there’s usually dedicated hardware for reading the common modifier keys, such as shift or alt, so these are always read.

thankyou FenrirWolf, I appreciate that you took time to try that code but your tests weren’t precisely what I was asking for - you talk about 4 - 5 random combinations while I asked at most and just 3 and I asked to try very specific combinations (commented out in my code), no special keys like shift or so, and all of this to see indeed if it is my local problem or a replicable issue, just to nail the issue on something. If you wanna be of some help please just try as directed.

Whether the source of the problem is in your hardware or elsewhere, I can certainly vouch that it isn’t in Panda. There’s nothing in low-level Panda that even keeps track of what buttons you’ve already pressed, so it’s pretty much impossible for Panda’s button-event mechanism to fail in precisely this way. Whatever buttons it reports are the ones it gets told by the operating system.


let me be very clear Dave:
I replicated the issue using the code above on both windowsXP and kubuntu linux with different computers (see the rigs in my signature) , both with different keyboards one of these brand new and the issue is always there and always act in the same way.
PS: I updated the list of fail combinations on the top comment section of the code above, just in case someone want to see for himself - actually I find just one guy with the same issue (ynjh_jo) let’s see if the list would grow in the future.

i really really doubt it has anything to do with panda, as drwr already said. i dont know panda very well but i disassembled quite a number of keyboards during my life to reconnect them to custom buttons. some of them as old as myself. others brand new. i noticed one thing. they all look the same (e.g. cherry keyboards). they use the same key-matrix for many many years now. you can even take a 10 year old cherry and replace the small circuit in it to make it an usb keyboard. it’s pin-compatible for the standard layouts.

most keyboards use a slightly diagonal matrix. so you cann press several keys which are side by side. but not above each other.
so running differnet OS or even different keyboards wouldnt change the outcome at all since they are pretty much all the same (except you have special keyboards designed for more keypresses at once)

suggestion: try to connect multiple keyboards to your computer (you said you have multiple , if they are usb it’s no problem). and only press 2 keys at each keyboard.
the keypresses should be reportet to the os which reports them to panda.

so Thomas, since these crappy kb are the majority around, this is another good reason to investigate deeper this issue

Beside, and sorry to be picky, I can’t exactly get from your post if you tried my code and the (assumed) faulty triplets and what kind of results you have got with your rigs.

so far 3 ppl are affected by this issue: me, Nemesis#13 and Jo

Nemesis I saw you developed a custom input section in your project: have you tested those combinations with that? Do they work?

my keyboards have the same standard matrix as your.
i can press up to 6 keys simulatinously but NOT if they are in a bad combination based on your keyboard matrix.
those keyboard matrices have 2 bunces of wires. one bunch is horizntally. one is vertically.

you can press 6 in horizontal only. or vertical only. depending on the matrix itself it might be less. if you use combinations of both, like WAS. then the vertical wire from W is already used and the horizontal wire of A is already used. so there is no way it can detect an S which would require at least one of those lines to be not used yet. so unless you lift your finger from either the w or the a key… the s will not be detected.

there is only ONE way to avoid this issue. buy a keyboard with a matrix which can handle this (usualy expensive high-end-gaming equipment).
this is a hardwarelimitation you can not work around with any softwaretricks.
and you’r right it affects most keyboards on this planet but i have yet to see an application wihch actually requires you to press 3 of those blocking keys at once.

thankyou Thomas, I guess I couldn’t find a better explanation of the phenomena than your. So this means that each pc game (commercial or not) have been so far coded the user key assignment procedure carefully preventing those bad combinations or, simply, take no great care of that or more likely adapted the game logic to circumvent this issue. I was yet a little skeptical because I never noticed evident failures, or simply I don’t remember that cos is long time I’m not a hardgamer anymore, so today I tried on windowsXP with kungfuPanda (yeah I love pandas) assigning keys fitting one of the bad combinations but the gameplay logic haven’t made that problem noticeable very much even if, actually, pressing forward(W)+jump(S)+fast attack(Q) failed to work as expected.
At the time I’m writing I’m reinstalling CSsource to see how it goes there and then I’ll report back ASAP to get some conclusion on this topic and finish my input class.
ok after a small flashback with Counterstrike:source the conclusion is that this is not a matter of panda3D engine but, as exhaustively dissected above, an hardware issue that one got to face writing input interfaces for his own game.

Case closed - thanks everybody taking part of it.[/b]