Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 3 keys ok, but 4 halts the input. Why? (Solved)  (Read 3935 times)

0 Members and 1 Guest are viewing this topic.

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« on: January 31, 2012, 11:42:04 am »
We are using HP proBook 6450b laptops with Win 7 Enterprise 64, VC++ 2010 express and sfml 1.6

So, we have made some small games this week and to make them two player games, we're sitting two at each laptop. One person use keyboard keys A, S, W and X to control a player, the other use the arrow keys. Both players sprites move around in the same render window.

The problem is that if the two persons who play are using two keys or more simultaneously, the player that is last to hit two fail and no key input is read into the game (both want tomove to NW at the same time for instance). If one player use two keys at once (going NW for instance), and the other just one (going west for instance), no problem arise.

Is there a way to overcome this problem so both players can use several keys at once? Is the issue sfml or hardware based? Does it depend on what keys we use for the game?

kamui

  • Sr. Member
  • ****
  • Posts: 291
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #1 on: January 31, 2012, 11:52:52 am »
Hy,

I read somwhere that it depends on the keyboard.

(searching where...)

tobybear

  • Newbie
  • *
  • Posts: 27
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #2 on: January 31, 2012, 11:56:39 am »
Yes, this is a well known hardware based problem, depending on your keyboard. Some keyboards allow no more than 2 keys to be pressed at once, some even more than 4.
But also the allowed keys to be pressed simultaneously differ, like it could be that "A" and "S" are detected, but not "A" and "D".

I think there was a nice explanation for it on the FretsOnFire open source game, can't find the link at the moment though...

jone

  • Newbie
  • *
  • Posts: 12
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #3 on: January 31, 2012, 01:22:03 pm »
Here's a nice explanation. You can even test your keyboard using the small app on top of the page. :)

http://www.microsoft.com/appliedsciences/antighostingexplained.mspx

kamui

  • Sr. Member
  • ****
  • Posts: 291
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #4 on: January 31, 2012, 02:13:39 pm »
Quote from: "jone"
Here's a nice explanation. You can even test your keyboard using the small app on top of the page. :)

http://www.microsoft.com/appliedsciences/antighostingexplained.mspx


To test its own keyboard seems to be interesting. But how to code an app which test keybord capabilities, according to you (I've no idea)?

It could be usefull on a multi-player game taking only one keyboard...

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #5 on: January 31, 2012, 06:32:09 pm »
There are documents available, plus there are some specific mappings that have to work. Usually, there shouldn't be any issues, if the keys are apart far enough, e.g. having one player use ASDW, another one JKLI, another one cursor keys and the last one the numpad should work even on the most cheap keyboards.

I don't think it's really possible to write some kind of hardware test without user interaction. Buy a cheap 5 €/$ keyboard and use that one for reference. Placing 2 players should be no issue (limiting the number of simultaneous key presses; which you have to do even for one player anyway), 3 or 4 might get tricky, but in the end it's up to whatever you'd like to do.

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
3 keys ok, but 4 halts the input. Why? (Solved)
« Reply #6 on: January 31, 2012, 08:35:35 pm »
That link to Microsoft really explained keyboard ghosting well, and the little applet is valuable for the pupils since they can check what combinations that do work on their keyboards and wich one that don't during the testing phase.  Later, it will be network games anyway.

Thanks a lot for the help.