# What keys should I use for a four-player game with one keyboard?

I'm planning on making a multiplayer game for up to four people on a single machine. We want to have all input coming from players using the same keyboard (or multiple keyboards connected to the same computer). What keys should I use for each player?

Each player will be able to move around at a minimum, which will require four directional keys. They might potentially have one extra action they can take, which would require a fifth key.

WASD and the Arrow Keys are somewhat obvious options for a single player game, but what other sets of keys should I use?

I'm mainly interested in what positions of keys to use, rather than the letters, so just answer using the QWERTY keyboard layout. Potentially we can let people map this to their own preference for the other keyboard users.

I'm aware that many keyboards limit the number of keys that can be pressed simultaneously, however for this particular game we will be controlling the hardware and using multiple keyboards. It would be nice to have a set of keys that would work on a single keyboard if that keyboard didn't have that input limit (although it might be difficult fitting everyone's hand)

• Although I've added my own answer, I'd appreciate some input here, and would happily upvote better answers than mine. – Jezzamon Jun 29 '16 at 13:48
• related question, but with only 2 players: gamedev.stackexchange.com/questions/86477/… – Jezzamon Jun 29 '16 at 13:54
• Just a note, I think you're going have a lot of problems with ghosting, especially when all 4 players are pressing keys and you have 10+ keys pressed down at once. – Shaun Wild Jun 29 '16 at 14:17

Just as a heads up, most keyboards have a finite limit of keys that can be pressed. For example, I have an Asus Transformer Book and you can only press around ~5 keys at a time. Some keyboards also won't allow more than a few keys pressed if shift or control is being pressed. (Like my Transformer Book...) And yes, most of the time, this is hardware limited, so you wouldn't be able to interface with any drivers in order to remove the limit. The limit is usually unintentional or is there to drive costs down on budget keyboards. It may not be possible to have a high number of keys pressed simultaneously with certain designs/layouts.

Hardware limitations aside, I'm not so sure that having four hands on the same keyboard at the same time is very... ergonomic. Not only would it be cramped, selecting the correct keys to use would be a nightmare, and I suppose that is why you asked the question.

If you're looking for multiplayer support, why don't you do something with Xbox controllers? A-lot of successful desktop games support multiplayer XInput without extensive Keyboard/Mouse support, but that's drifting away from your original question.

You would need 16 available keys in order to have 4 people playing the same game locally.

What about WASD TFGH IJKL ↑ ↓ ← →?

You could use Home, Delete, End and Start or the numpad instead of arrow keys and you should refrain from using punctuation, syntax or symbols as they are differ by region, not by layout. (i.e. US QWERTY and UK QWERTY)

Edit: With most laptop keyboards, using Home, Delete, End and Start or using the numpad is not a feasible option. Compact keyboards tend to "squish" these keys on the edge of the board or at the top beside the function keys. Some keyboard manufacturers even decide to omit these features completely, so I wouldn't recommend adding those keys as the defaults.

Another note; Make sure that you allow the user to change the keys for themselves as they would be able to decide on their situation and their needs and, chances are that they wouldn't be happy with the default settings or their keyboard wouldn't be compatible for four players anyway.

Anyway, what ever you decide to choose, all the best with your project! ^_^

• Thanks! As I said in the question, I'm aware that keyboards have a maximum number of keys, and that 'ghosting' can occur, and that it would be hard to fit everyone's hands. – Jezzamon Jun 30 '16 at 0:21
• Are you aware of any games that use that key configuration? Or a reason to use TFGH over GVBN? – Jezzamon Jun 30 '16 at 0:21
• @Jezzamon To me, TFGH seems a-lot more natural. (As in, more WASD-like.) It's really a preference thing tbh. – Mr_Rockers Jul 5 '16 at 22:22
• I ended up going with this, using two keyboards plugged into one computer, and two players per keyboard. Thanks to this, there was no ghosting, and it went really well! – Jezzamon Sep 14 '16 at 1:06

As others have pointed out, you can't be sure the player has a keyboard with anti-ghosting so this simply wont be possible on most non-gaming keyboards.

Regardless, I think the best solution would be to let the players decide when the game starts. Everyone positions their hands where they're comfortable then each player is prompted, one by one, to press their up, down, left, and then right keys. It's an extra step in the game flow but avoids plenty of confusion and I'm sure after doing it once or twice, people would be able to do it very quickly (and there's always the option of saving their choices).

• This is a good idea, and could be useful for determining how many players you have in a game that has a variable number of players. – Jezzamon Jun 30 '16 at 0:26

Depends on the player's keyboard hardware. You cannot make a set that will work for sure on everyone's computer.

Make sure your game design does not encourage the players to hold more than one key, as you'll run into the limit on the number of keys that can be reported at a time.

Have you considered supporting gamepad controllers? For inspiration the game Duel (https://github.com/odanek/duel6r) supports 4 positions on keyboard + others on gamepads.

And for completeness - numpad keys can be used too to give you more room around the keyboard.

WASD and Arrow Keys are good options for two players. According to Wikipedia, IJKL is a common option, so that could be used for the third player.

If the keyboard has a number pad, you can use that for the fourth player. Otherwise, GVBM is the most spaced set of letters in the WASD shape.

For the fifth key for each player, you could potentially use a letter next to each of the players, such as X for with WASD, Ctrl with the Arrow Keys, M with IJKL, and Space for GVBM.

• in actual practice (I've used a very similar set up before for attempted 4 player co-op), this is the worst idea ever. Players quickly realise that they can "overload" the input, to hold other players back. – Gnemlock Aug 27 '16 at 23:37