CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.61k stars 4.17k forks source link

Selectable keybind sets #59675

Open I-am-Erk opened 2 years ago

I-am-Erk commented 2 years ago

Is your feature request related to a problem? Please describe.

We have a major issue with keyboard/hotkey usage, one that merits several issues and a project of its own. However, any discussion of optimizing keyboard layout runs afoul of different people having different usage needs. For example, on the US keyboard, it would be well worth considering reserving the ' " key for movement functions and remapping the current ' binding to another key. However, on non-US board layouts this usually won't work out as intended, and instead is a pointless interference with someone's motor memory. Many other layouts that are reasonable on US boards are bizarre elsewhere. Further, some keybindings are useful on particular setups such as laptops, but become at least a waste of valuable space on a full sized keyboard.

Solution you would like.

We should have the ability to save separate keybinding sets and cycle through them in the keybindings menu like we can with tilesets.

As a default I would suggest we have the following:

Later we can have people add their own regional keyboards as well, and we could consider alternate keybinding sets if there is a strong incentive to include them, but there has to be a rationale for it.

Maintenance considerations: My main concern with these is that someone is going to add their own custom keybinding layout, and then it won't be maintained and important new keybindings won't be mapped to it. I recommend that a phase 2 addition to this issue would be adding a list of "Core" keybindings, and a CI test that ensures that these core keybindings are present in every keybinding set that ships with mainline.

Easy export: It would be very nice if you could simply press a button to save your current keybindings as a keymap of your own, to upload and share or transfer to other savegames or whatever.

Describe alternatives you have considered.

We can currently save and migrate keysets, so in a way we have this, but there is no easy in game manager.

Additional context

I think having this would free us up to completely reinvent keybindings without really pissing everyone off, and I think this game desperately needs that. I will post more on the subject soon.

NetSysFire commented 2 years ago

Honestly I could also imagine some other uses for this, too. I remapped most of the stuff to be more nethack-like (smash is ctrl+d, examine is s and so on), that would surely appeal to folks coming from other roguelikes. I could also imagine a special preset for people with parkinsons, making it harder to typo stuff in exchange for efficiency. Just a wild thought but it does have some potential.

ghost commented 2 years ago

This would be highly useful. The one thing i would say about "small keyboards" is that the L/R tilt feature in options is incredibly useful. Shift + L/R arrow keys for upward diagonals and CTRL + L/R arrow keys for downwards diagonals is honestly quite easy to get used to and is standard in some games (Cogmind at least)

I don't think, with the proposal, having certain options default with the different selections is possible, but it could be useful. Even without, multiple keybinding sets would be amazing!


Separate thought, but i think Spacebar is the most useful, overlooked keybinding available. My thoughts are it defaulting to opening inventory for now, and down the road being used (fingers crossed) to open the new player/inv/other menu that would encompass many others. (it can still be used to close menus and essentially like ESC when a menu is open, but if nothing is open being used to open inventory or something else.)

I-am-Erk commented 2 years ago

In terms of specific keybindings, I'd really like a team effort to devise a "max efficiency" layout from the ground up that may bear no resemblance to the current one. That should not be part of this Issue, let's discuss that separately here: https://github.com/CleverRaven/Cataclysm-DDA/discussions/59678

Qrox commented 2 years ago

This would also be useful for the keycode input mode as it currently only supports qwerty layout. Having presets for other keyboard layouts would make it more useful (and maybe make it possible to use the keycode mode by default on Tiles when all UIs are migrated to it).

keampe commented 2 years ago

I'm wondering if you could have a "Keybindings" menu option in the "Settings" menu of the main screen (where you choose which game to load) that would allow you to save your keybindings the same way you save character presets. You could then have the keybindings option show up wherever the tiles option shows up, allowing one to set it as the default for all games, for example.

Comrade-Soupbeans commented 1 year ago

this might be out of scope for this, but i would be interested in seeing keybinds potentially moved away from literal letter inputs and towards keycodes. This would allow for more easy translation for people who use alternate layouts like dvorak (and then ofc translating back into what key that corresponds to in their layout) as well as just generally making the system more robust to different keyboard layouts like azerty etc

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

AdamALittle commented 5 months ago

An additional suggestion to consider: Could we tie input mode to each keybinding set as well? When a new keybinding set is created, it should have the ability to only receive keycode inputs, or symbol inputs. A significant issue I've been running into while concepting out custom keybindings is that there is a horrendous overlap between the two.

Symbol works in all menus, but lacks consistent functionality for the SHIFT, CTRL, and ALT modifiers. Keycode is able to utilize said modifiers, but does not consistently work in all menus.

Tying the input mode to saved keybinding sets would help ensure players that their keybindings will work in all menus, as well as provide a way for internal development to run tests against each stock keybinding set that would be provided.

Qrox commented 5 months ago

Could we tie input mode to each keybinding set as well? When a new keybinding set is created, it should have the ability to only receive keycode inputs, or symbol inputs.

If you mean making keycode and symbol mode work at the same time on different keybindings, as far as I know there isn't a way to tell which symbol event corresponds to which keycode event in SDL, and both events are generated by SDL in symbol mode, whereas only keycode events are generated in keycode mode, so it is probably not straightforward to do what you suggested, as there may be the problem of a single keypress triggering multiple actions in symbol mode, and I don't think there is a way to receive symbol events in keycode mode.

Keycode is able to utilize said modifiers, but does not consistently work in all menus.

Some menus do not support keycode mode due to some issue with their previous implementation. They should be eventually migrated, but I don't have much time to finish it right now.

AdamALittle commented 5 months ago

Some menus do not support keycode mode due to some issue with their previous implementation. They should be eventually migrated, but I don't have much time to finish it right now.

I'd like to help, if that's alright! Do you know if there's a concrete list of which menus are still utilizing symbol input exclusively? Off the top of my head, I think the inventory, drop/multidrop, and main menu don't seem to utilize keycode inputs fully.

The reasoning for defaulting to symbol input is because the default keybinding wouldn't work with non-qwerty keyboard layouts (at least that's what the game is telling me.) If we set up these keybinding sets, I could see reason to get rid of symbol-only input... 👀 (As long as there'd be a good amount of default keybinding sets available by default for the more popular keyboard layouts.)

Qrox commented 5 months ago

UIs that use symbol input only can be found by searching for input contexts or popups created using the keyboard_mode::keychar argument. Most of them rely on data that specify keybindngs/hotkeys in the symbol form, so it might take some effort to make them work with keycode mode.

If we set up these keybinding sets, I could see reason to get rid of symbol-only input

We could default to keycode mode on SDL PC builds if it is fully implemented, but I think the curses build (and perhaps the android build) can only work with symbol input.