alexwidua / aegis

A tiny game to practice shortcuts for the videogame Age of Empires.

Home Page:https://www.aegis.lol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default keyboard setting unclear

coenvanpoelje opened this issue · comments

Playing the Aegis game, I ran into Q-Y shortcut for Outposts. Playing a QWERTY keyboard this seemed odd to me.
image

Checking the settings menu, in the keyboard layout selection, no option is highlighted.
image
After selecting qwerty in the settings menu, it works as I am used to.

The only issue is that the current selected keyboard layout should be easier to find out.

Hi @coenvanpoelje,
thank you for bringing this up.

You're right, the default keyboard layout is set to QWERTZ. While it's up for debate if this is good as a default, each key of the grid can be rebound by clicking on it, but I guess this isn't really clear. The options at the bottom are more popular presets that populate the grid above, but they're totally optional — this also is more implied than it is clear.

From your opinion or gut feeling, how could we make this more clear?

From the top of my head, one thing I could imagine is to transform the ambiguous preset menu into an primary segmented option menu. Here's a quick mock up — what do you think?

#7

@alexwidua I love your proposed solution

related to default, considering QWERTY is the most popular layout overall, I think that should be the default

alternatively we can also use experimental feature to detect layout and set default based on it but support is not great https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/getLayoutMap

Sounds like you guys got this down, @alexwidua your solution looks great.
Perhaps, since not knowing the current set keyboard layout affects the user experience a lot.
There could be a quick light / transparent notification or watermark in-game that indicates the current setting and links the user to the settings page to set their own preference.

Detecting the actual keyboard layout can be tough, though finding the most likely default determined by I18N language could be possible if you use some form of I18N in the app.

Thank you for your input guys. The idea with the initial message asking if the settings are correct is also great.
I've dabbled with it yesterday and changed the structure of the keyboard menu to the proposed solution ☝️(not live yet),

I'm also doing some refactoring of other components -- I'll push the changes asap, I'm just super tight on time right now. I'll keep you guys posted, thanks for your help!

One option could be to use this API. It's not supported on Firefox or Safari yet, so you'd need it to be optional, but something like setting the default on initial load as:

if ("keyboard" in navigator) {
  let keyboardLayout = await navigator.keyboard.getLayoutMap();
  var ageOneKey = keyboardLayout.get('KeyQ');
  var ageTwoKey = keyboardLayout.get('KeyW');
  // etc.
}

Then set the variables for ageOneKey, ageTwoKey, etc. to the keyboard layout, could provide a pretty great user experience out of the box, giving users the option to customise it themselves if they prefer (or if that fails).

Thank you for your getLayoutMap() suggestions @reneklacan @jimcullenaus
I've pushed a new version to the dev branch which implements this feature. You can view the preview here, I'll merge it tomorrow.

If the player plays for the first time, the game will ask the user if the current keyboard layout is correct (great idea, James).