Hacker News new | ask | show | jobs
by mstange 4261 days ago
Nightly and Aurora Firefox builds actually support the "code" field on keyboard events, which lets JS know which physical key was pressed on the keyboard. For example, when a Dvorak user presses the key that would be W on a QWERTY layout (for moving forwards in a game), you'll get a keydown event with e.key == "," and e.code == "KeyW".

I'd really like to know what the spec status on that is, and whether other browsers implement it.

1 comments

Seems like it could be a clever way to solve the issue for players, but probably makes developers on those other keyboards quite miserable.
a prompt training the game controls could be quite simple... "PRESS THE KEY YOU EXPECT TO BE UP" step 2: "PRESS THE KEY YOU USE FOR FIRE"
I've seen some FPSes get the player's preferred control mappings in a really subtle, cool way: ask the player to perform some actions very early in the game (often as part of a "training" sequence), and configure the controls however necessary to make the user's input correct.

For instance, in Portal 2, to check whether the player wants inverted controls:

http://youtu.be/niE5oiRs7pY?t=45s

That does sound clever but I don't understand your example; in this case, would moving the mouse either way go the intended direction?
I'm guessing whichever direction your move the mouse, the game looks in the correct direction for you to obey the instructions, and that mapping is then persisted.
It makes more sense for consoles / controllers. Although I am sure /someone/ uses inverted mouse controls. It could be disabled in the PC version also.
Inverted Y (vertical axis, i.e. up/down view) is a very popular setting for simulation games and FPS games on PC. It's popular enough that games with >100k players will get bad press and >20 forum complaints (even when the forum is hard to find!) over it, and many more than this will simply not play/buy the game.

In other genres / types of games, especially where you don't control exclusively one character / vehicle from a fixed first/third person viewpoint, it is drastically less common.