Future of DialogShortcuts.txt

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
pango
Posts: 2831
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Future of DialogShortcuts.txt

Post by pango »

Hi,
To resume my Twitter discussion with Interkarma, I created DialogShortcuts.txt to remove hardcoded shortcuts from the code, because I knew it would be cool to be able to change them easily, say for localization.
So:
  • I moved hardcoded shortcuts, like automaps shortcuts;
  • I implemented shortcuts that exist in classic, Y/N prompts etc.
  • I added keyboard support not present in classic, so one can for example mount a horse with T then H, or sell items with L then Y, etc. I probably forgot some screens, like banking or the potion maker.
  • I moved quest debugger shortcuts because I wanted to be able to change them ([ and ] are not plain keys on my keyboard), but I wasn't sure they were worth adding to keys the player could customize. Also, you couldn't bind combos at the time IIRC, only plain keys
My thought about the result:
  • Some shortcuts should be moddable for localization purposes, for example Y and N for Yes/No prompt.
  • Added keyboard support is a mixed bag: It can be great at time, like the examples I gave above, but few people use them, partially because it's not documented at all and had no equivalent in classic, partially because left hand on WASD and right hand on mouse is a comfy position, so keyboard shortcuts must be extra convenient to be used.
  • Some added shortcuts are arbitrary, like the use of Function Keys to select inventory categories or conversation tones. I'm not sure how I feel about those.
  • And then some added keyboard support can get in the way, like pressing W in the inventory trying to toggle wagon display, or S in spellbook triggering spells sorting.
So players may want to customize or disable some of those shortcuts, independently of localization...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Hazelnut
Posts: 2663
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Future of DialogShortcuts.txt

Post by Hazelnut »

It might also be worth considering the side effects of UI window hotkeys to mods that add interaction to them. For example, the outfit manager mod recently reported that people trying to name their bundle ended up closing the whole inventory UI when they typed an i into the text entry.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
pango
Posts: 2831
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Future of DialogShortcuts.txt

Post by pango »

There's already a mechanism to suspend interpretation of shortcuts when an input field has focus:
https://github.com/Interkarma/daggerfal ... ssues/1707
https://github.com/Interkarma/daggerfal ... /pull/1708
It has been used successfully by Inventory Filter. Maybe that's sufficient, maybe not.
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Hazelnut
Posts: 2663
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Future of DialogShortcuts.txt

Post by Hazelnut »

Probably, I wasn't aware of that. Thanks Pango.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 6123
Joined: Sun Mar 22, 2015 1:51 am

Re: Future of DialogShortcuts.txt

Post by Interkarma »

From our conversation on Twitter - should we move dialogshortcuts to persistent data? As you pointed out, users lose their shortcut setting every time they upgrade the game.

User avatar
pango
Posts: 2831
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Future of DialogShortcuts.txt

Post by pango »

Well, that'd give a lot of flexibility to the players, maybe even too much ;)
Also, how would that work with, say, localization mods?
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 6123
Joined: Sun Mar 22, 2015 1:51 am

Re: Future of DialogShortcuts.txt

Post by Interkarma »

Would it give players any additional flexibility? The functionality is the same as now, we're just saving them time having to copy their shortcut file across every time they upgrade.

I'm not sure it needs to relate much to localisation. The shortcuts are a personal thing like keybinds and everyone can have their own preferences. Maybe translation mod developers can suggest a default shortcuts setup, but like keybinds it's up to the individual user how they want this configured.

I might be missing a lot of angles though. You've spent more time thinking about this feature as its creator. Happy to bounce ideas and problems, and I do what I can to help. :)

User avatar
pango
Posts: 2831
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Future of DialogShortcuts.txt

Post by pango »

Well, again this depends on the shortcuts; We have the shortcuts Y and N for the Yes/No prompts, same for transport options, etc. and it can only make sense for localization mods to adjust all of those if they also replace the visuals.
Maybe those mods should be able to change the default of some bindings, even if players are able to override defaults, or something. I hope it's not over-engineering, I also see the risk of people replacing Y and N shortcuts with random combos and later being unable to answer Y/N prompts...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 6123
Joined: Sun Mar 22, 2015 1:51 am

Re: Future of DialogShortcuts.txt

Post by Interkarma »

OK, I hear what you're saying about giving the player too much control over the shortcuts file. :) I imagine it also becomes harder for us to add new shortcuts and push them out once the file is removed from streaming assets and the user is fully responsible for maintaining the file.

How about the following:
  1. Leave shortcuts file in streaming assets - we maintain defaults in core project
  2. We review current defaults - you've already expressed some concern over quest debugger defaults
  3. Add methods for mods to change/override existing shortcuts at mod startup
  4. Add methods to disable/enable shortcuts
  5. Consider future methods for registering new shortcuts at startup and how this would work considering potential for conflicts and load order
This way, a localisation mod can just assign shortcut chosen shortcuts changes (e.g. to Y/N) based on their target language, along with their payload of new images and string tables.

User avatar
pango
Posts: 2831
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Future of DialogShortcuts.txt

Post by pango »

Interkarma wrote: Wed Feb 24, 2021 1:59 am
  1. Add methods for mods to change/override existing shortcuts at mod startup
  2. Add methods to disable/enable shortcuts
  3. Consider future methods for registering new shortcuts at startup and how this would work considering potential for conflicts and load order
Looking good to me.
Current way to disable a shortcut in DialogShortcuts.txt is to assign it "None", I guess that'd work as dynamic assignment too.
Interkarma wrote: Wed Feb 24, 2021 1:59 am
  1. Leave shortcuts file in streaming assets - we maintain defaults in core project
  2. We review current defaults - you've already expressed some concern over quest debugger defaults
Right, we can discuss defaults. The main gripe I expressed was with quest debugger combos:
  • Both Shift and Tab are easy to reach from WASD, Shift is assigned by default for running I think, and many people use Tab for either map or inventory. In any case it's not uncommon for players to press Shift-Tab unintentionally, and don't understand what's going on. Either quest debugger should be explicitly enabled, or a less easy to trigger combo should be picked. (Adding modifiers may not be great either, as Alt-Tab and others may already be reserved by the environment). I have no great suggestion that come to mind, maybe Ctrl-Alt-D?
  • [ and ] are not plain keys in some keyboard layouts (I gave the example of Azerty-like layouts), and so debugger shortcuts don't work on those. Maybe localization can take care of that issue, and remap them, say to AltGr-LeftParen and AltGr-RightParen or something
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply