Valheim-Modding / Jotunn

Jötunn, the Valheim Library.
https://valheim-modding.github.io/Jotunn/
MIT License
125 stars 40 forks source link

Deconflict Custom Key Bindings #30

Closed jcleveland closed 3 years ago

jcleveland commented 3 years ago

As more mods need custom key bindings it would be nice to have a common approach to coordinating / de-conflicting bindings. There are a few different ways I could see this working ranging in technical complexity from agreed upon standards although way to common code library for managing key bindings. While some of the less technical approaches may not need Jotunn library support for them it seems this wiki would still be a good place to document them.

I'm throwing some possible options below, likely some combination of them will end up making sense. I'm sure there may be other solutions that would work even better.

Option 1: Mods standardize on using a ModKeyBinding section in BepinEx.Configuration. This would allow the user to easily see all of the custom key bindings they need to setup.

Option 2: For common custom button bindings Jotunn sets up the key binding for them. An example of this would be several mods may want a Use2 binding. Jotunn's config could define the Use2 key binding so that mods wouldn't have to manage the configuration themselves. For something like Use2 we could also have an agreed upon interface where a method Interact2 gets called on the object being used.

Option 3: Jotunn provides mechanism for mods to register key bindings needed and they get added to the actual Valheim configuration screen as opposed to just a BepinEx configuration file.

paddywaan commented 3 years ago

Perhaps we should implement keybinds underneath https://github.com/BepInEx/BepInEx.ConfigurationManager to further utilisation of native libraries and provide a more standardised interface for configurations.

Algorithman commented 3 years ago

Option 3 is pretty much locked in.

Internally there won't be any changes, AddButton will still need the modGuid parameter, but the configuration screen will keep them sync'd.