Re: [Plib-users] Don't Do This!
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2002-01-01 16:27:09
|
Christian Mayer wrote: > > Steve Baker wrote: > > > > ha...@sl... wrote: > > > > > > >I wrote up an Omniverous Biped FAQ item about this: > > > > > > > > http://www.sjbaker.org/steve/omniv/index.html > > > > > > > >...check out "Keyboards Are Evil". > > > > > > Now, not to disagree with what you've figured out, as I'm sure it's > > > correct, but... Whats weird is I've seen several older windows games that > > > did exactly this, with two players. One in particular was action based, > > > kinda like a player versus player asteroids game. I wish I could > > > remember the name. You picked a space ship (each had different > > > speeds/weapons/etc). You had to thrust, rotate and fire - all sharing > > > the same keyboard. > > > > I didn't say it was impossible - if you pick the right keys, it can work. > > > > (eg Q,W,E,R as Turnleft/Thrust/TurnRight/Fire for player 1, > > Y,U,I,O as the same for player 2...that works just fine). > > Does the num pad count extra? If that's so than two players should be > possible. If you look at my FAQ: http://www.sjbaker.org/steve/omniv/index.html You'll see a table at the bottom of the page showing (for my keyboards at least) what the decoder's matrix looks like. It predicts that holding down (for example) 'R' and 'T' will block 4,5,6,7,8,9 and + on the keypad...<tries it>...and it does! Really, no keys are immune to the effect. You just have to *carefully* pick keys that either all occupy different rows - or all occupy different columns. So, looking at that table in the FAQ, you'll see that there are 8 rows and 18 columns. Ack! I accidentally typed my table in 'sideways'...and I'm *certainly* not going to type it in again. Tables are a pain in HTML!. Conclusion: You can have at most 18 keys active in the game. However, it gets worse. Some columns of the matrix only have wierd keys like Left-Meta or Right-Meta that are something of a pain to read in most window libraries...and which can have unintended consequences. (You wouldn't want to write a game that could result in player 1 pressing Ctrl, Player 2 pressing Alt and Player 3 pressing Del or Backspace in the heat of the action!!) So, if we eliminate the columns containing only 'dangerous' keys, we have 14 or maybe 15 keys left (depending on what 'PrintScreen' does). That's certainly not enough for a four player mode for my game - and even in 3 player mode, one of the players has to uses SysRequest/PrintScreen as one of his keys in order to have 5 keys each - and I really wanted at least six keys per player (North,South,East,West,Jump,Fire) and had really hoped for something like 10 or 15 per player. So, I'm left with two player mode as the only possible setup and only seven keys each. I can do a *little* better by knowing that you won't often want to press North and South together - or East and West together...but still, I should try to ensure that when a player does that by mistake, it doesn't mess up his competitor. There would also be *easy* scope for covert cheating! Just hold down the right key combination to block the other player's Fire button! The game could actually detect that and flash up a "CHEAT!" warning. Another way to increase the number of commands per player would be to write the code in a way that would discourage holding some of the keys down for a long time. For example, if holding down the 'Jump' button for more than some small amount of time caused the player to trip and fall flat on his face, then I could use more than one key in that column, accepting the small probability of a short-term key lock-out. There is also the issue of i18n. There are at least a dozen keyboard layouts in the world - and some (such as the 'AZERTY' design which has A and Z where most people would expect Q and W to be) will need different key assignments...then there are people who remapped their keyboards and swapped the keycaps around to do a Dvorjak layout or something. Most worrying of all is that I've only tested this out on the four keyboards I have at home (Casio laptop, Fujitsu laptop and two different no-name ergonomic 'split' keyboards). There is no reason at all why some other brand might not have a different keyboard decoder with a different key matrix. The PC and it's software wouldn't care - but the combinations of keys that would lock out could be totally different. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |