News for hackers. Stuff that matters.
Re:Show HN: 3D first person game rendered in CSS/HTML by s_gourichon on Friday August 28, 2020 @01:52PM (#24307857)
Thanks a lot for sharing! Very interesting experiment.

That said, please please, no "WASD". This is very uncomfortable on non-QWERTY keyboard layouts.

There are two solutions to this.

# Best solution

Game programmer always mean "the group of physically-positioned keys that happen to be labelled WASD on the programmer's keyboard", not "whatever keys that are actually labelled WASD on the player's keyboard".

So, wherever possible, use an API that refers to key position, not key symbol. This is possible in most programming environments, e.g. in Javascript using https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEve...

# Alternative solution

Alternatively, use keys that are stable across most common Latin keyboards layout, which means no AMQWYZ.

ESDF is fine, as are RDFG, TFGH, or the traditional IJKL (see https://en.wikipedia.org/wiki/Arrow_keys for more).

If you want to be kind to Dvorak, Bepo, Colemak and other users, prefer the first solution!

https://en.wikipedia.org/wiki/Keyboard_layout#QWERTY-based_L...

Re:Show HN: 3D first person game rendered in CSS/HTML by codetrotter on Friday August 28, 2020 @04:19PM (#24309479)
To be really pedantic, keycodes only help when the layout is being remapped in software by the operating system. There are dozens of us that use hardware Dvorak mapping. Dozens! :p

So to be clear, the ideal thing to do is to allow the player to define in-game which keys should do what. But realistically speaking, I’m not going to complain because I brought this on myself when I chose to use a hardware controlled Dvorak layout. Still worth it btw ^^

I do note however, that the project is open source on GitHub, so if any of my fellow hardware controlled alternate keyboard layout peoples want to take a stab at submitting a PR for a keyboard binding config menu for the game I say go for it :)

Re:Show HN: 3D first person game rendered in CSS/HTML by rangewookie on Friday August 28, 2020 @02:54PM (#24308638)
Given that WASD is a standard in gaming I'm surprised by this approach. Do many games / game engines use key position? Isn't it easier to just add key remapping so outliers can configure freely?
Re:Show HN: 3D first person game rendered in CSS/HTML by ChickeNES on Friday August 28, 2020 @03:17PM (#24308865)
Yes, just allowing the keys to be remapped is simpler and would serve all users with non-standard setups, not just the handful that use alternative keyboard layouts.
Re:Show HN: 3D first person game rendered in CSS/HTML by rkagerer on Saturday August 29, 2020 @05:45PM (#24319642)
I'm surprised most Dvorakers don't already tend to have a utility installed to let them remap temporarily or for an application. This must be a common occurrence?
Re:Show HN: 3D first person game rendered in CSS/HTML by tomc1985 on Friday August 28, 2020 @09:23PM (#24312422)
> ESDF is fine, as are RDFG, TFGH, or the traditional IJKL (see https://en.wikipedia.org/wiki/Arrow_keys for more).

Ugh, no. FPS has standardized on WASD over the last 20 years and people trying to reinterpret this are the bane of a positive experience.

Positional keys? Sure. Whatever's in WASD's place is fine. But splitting hairs for the <1% of users using nonstandard stuff (like a dvorak keyboard, which after a lifetime of computer nerditry I still have never seen in-the-wild) will lose you a huge chunk of your audience.

WASD or die

Re:Show HN: 3D first person game rendered in CSS/HTML by pantelisk on Friday August 28, 2020 @01:57PM (#24307965)
Woaah.. this never occurred to me. Thank you, for the suggestion. Didn't know about "KeyboardEvent.code". And of course.. arrowkeys, kinda ashamed I didn't think of that!
Re:Show HN: 3D first person game rendered in CSS/HTML by moron4hire on Friday August 28, 2020 @03:36PM (#24309055)
`KeyboardEvent.code` used to be the only way we had to read key events in JS. They `key` field didn't come out until about 5 years ago.
Re:Show HN: 3D first person game rendered in CSS/HTML by kleiba on Friday August 28, 2020 @03:00PM (#24308713)
...or just install the US keyboard layout as an alternative to the one you typically use.
Re:Show HN: 3D first person game rendered in CSS/HTML by p1necone on Friday August 28, 2020 @10:16PM (#24312747)
"Alternatively, use keys that are stable across most common Latin keyboards layout, which means no AMQWYZ."

No no no no no this is a terrible idea. Don't make 99% of peoples experience non standard just so that people with non qwerty keyboards (who are probably expecting to need to remap controls anyway) have automagic defaults. Just default to the most common thing (WASD) and let people remap keybinds to whatever they want in case that doesn't fit.

I'm a pretty avid gamer and I've literally never opened a PC first person/third person shooter (or other real time genres with a similar perspective) released in the last 15 years or so that didn't have movement mapped to WASD by default. Not doing so would make your game feel very unpolished.

If you care about accessibility at all you need to allow button remapping anyway, even if you go with positional keybinding.

Re:Show HN: 3D first person game rendered in CSS/HTML by FullyFunctional on Friday August 28, 2020 @01:57PM (#24307970)
Funny. I had to look for WASD on my Dvorak keyboard, but that said, we are a minority. My bigger recommendation would just be to quickly mention which keys are relevant as I was left wondering if I was missing something.
Re:Show HN: 3D first person game rendered in CSS/HTML by profinger on Friday August 28, 2020 @03:42PM (#24309107)
It does do that at the beginning before you start
Re:Show HN: 3D first person game rendered in CSS/HTML by FullyFunctional on Friday August 28, 2020 @08:13PM (#24311949)
thanks, I must have missed that
Re:Show HN: 3D first person game rendered in CSS/HTML by wilsonrocks on Friday August 28, 2020 @01:54PM (#24307905)
I did not know about key codes and physical position! Thank you!