Page 1 of 1

[0.11.4] Primary bindings set to "None" will revert to defaults and may introduce conflicts [RESOLVED 0.11.5]

Posted: Wed Jul 07, 2021 8:53 pm
by PizzaBoy
Some of the keybinds are not saved properly and get overridden at launch. I start the game and change the keybinds to pic related:
bindlist.png
bindlist.png (361.23 KiB) Viewed 2477 times

I exit the game and everything is correctly written to KeyBinds.txt:

Code: Select all

{
    "actionKeyBinds": {
        "Escape": "Escape",
        "BackQuote": "ToggleConsole",
        "W": "MoveForwards",
        "S": "MoveBackwards",
        "A": "MoveLeft",
        "D": "MoveRight",
        "PageUp": "FloatUp",
        "PageDown": "FloatDown",
        "Space": "Jump",
        "C": "Crouch",
        "LeftShift": "Run",
        "R": "Rest",
        "T": "Transport",
        "Alpha1": "StealMode",
        "Alpha2": "GrabMode",
        "Alpha3": "InfoMode",
        "Alpha4": "TalkMode",
        "Equals": "CastSpell",
        "Q": "RecastSpell",
        "F1": "CharacterSheet",
        "Minus": "UseMagicItem",
        "E": "ReadyWeapon",
        "Mouse1": "ActivateCenterObject",
        "Mouse3": "Inventory",
        "Mouse0": "SwingWeapon",
        "Tab": "AutoMap",
        "F2": "Status",
        "F5": "QuickSave",
        "F3": "TravelMap",
        "F8": "PrintScreen",
        "F9": "QuickLoad",
        "LeftControl + Q": "AbortSpell",
        "Return": "ActivateCursor",
        "Mouse2": "SwitchHand",
        "L": "LogBook",
        "N": "NoteBook"
    },
    "secondaryActionKeyBinds": {

    },
    "axisActionKeyBinds": {
        "Axis1": "MovementHorizontal",
        "Axis2": "MovementVertical",
        "Axis4": "CameraHorizontal",
        "Axis5": "CameraVertical"
    },
    "axisActionInversions": {
        "MovementHorizontal": "False",
        "MovementVertical": "False",
        "CameraHorizontal": "False",
        "CameraVertical": "False"
    },
    "joystickUIKeyBinds": {
        "JoystickButton0": "LeftClick",
        "JoystickButton1": "RightClick",
        "JoystickButton2": "MiddleClick"
    },
    "$version": "v1"
}
However, when I start the game again, some of the keybinds get overreeden to defaults:
bindlistChanged.png
bindlistChanged.png (370.26 KiB) Viewed 2477 times

Re: [0.11.4] Some of the keybinds are not saved properly

Posted: Thu Jul 08, 2021 1:15 am
by Interkarma
Jefetienne is the current maintainer of keybind logic and probably knows a bit more than myself. So please take my feedback with a pinch of salt in case my mental map isn't up to date. It will just have to do until Jefetienne can reply. :)

My understanding is that "None" is only used to clear bindings. It's not in itself a permanent binding and won't be serialised. The next time you start the game, these cleared bindings will be reset to default.

If you don't want the defaults, try setting these bindings to something other than "None" and they should serialise OK and persist between game sessions.

Re: [0.11.4] Some of the keybinds are not saved properly

Posted: Thu Jul 08, 2021 11:52 am
by PizzaBoy
Interkarma wrote: Thu Jul 08, 2021 1:15 am My understanding is that "None" is only used to clear bindings. It's not in itself a permanent binding and won't be serialised. The next time you start the game, these cleared bindings will be reset to default.
The thing is that under certain circumstances keys get reverted to default even if they have been explicitly rebound. For example, I bound middle mouse to "Switch hands". On the subsequent launch of the game "Switch hands" gets reverted back to "H" and middle mouse becomes bound back to "AutoRun".

Also, keys that are included in macros get ignored too. For example, I have set "Slide" to "None" and bound "Abort spell" to L.Crtl + Q. On subsequent launch the "Slide" gets reverted back to L.Ctrl, ignoring the fact that L.Ctrl is already included in macro.

I think it would be better just to drop the "empty keys get set to default on start" behaviour and instead create KeyBinds.txt with default binds on the very first launch of the game.

Re: [0.11.4] Some of the keybinds are not saved properly

Posted: Thu Jul 08, 2021 1:06 pm
by Interkarma
Looking back through code commits, it seems right-click-to-clear is mainly intended for clearing Secondary keybinds (see Primary/Secondary button at top-right of Controls UI) to help resolve Primary/Secondary conflicts. Clearing Primary bindings to "None" will result in Primary action being reset to default. Secondary bindings already default to "None".

I agree that a missing binding should not introduce a conflicted default at game launch. There should be a check for this and leave the action empty if default conflicts with anything user has set. This will also work when introducing new actions to the game if their default conflicts with another action.

I'll ping Jefetienne on the related commit and link back to this topic for his feedback. This is very likely a technical limitation we can improve.

Re: [0.11.4] Some of the keybinds are not saved properly

Posted: Thu Jul 08, 2021 2:41 pm
by Ralzar
PizzaBoy wrote: Thu Jul 08, 2021 11:52 am For example, I bound middle mouse to "Switch hands". On the subsequent launch of the game "Switch hands" gets reverted back to "H" and middle mouse becomes bound back to "AutoRun".
This is because AutoRun default is middle mousebutton (which I honestly find to be a poor choice of default key).

So since you set AutoRun to none, it reverts to default which is middle mousebutton.

Which then is conflict with your binding of middle mouse button for "Switch Hands",

So "Switch Hands" gets set to none, to resolve the conflict, which then makes it revert to its own default: "H".


This could be handled better by DFU, but the obvious solution is to simply stop trying to set keys to "none" and instead just bind them to buttons you do not intend to use.

Re: [0.11.4] Primary bindings set to "None" will revert to defaults and may introduce conflicts

Posted: Thu Jul 08, 2021 11:45 pm
by Interkarma
Yep avoiding "None" for Primary bindings is the correct approach for now. It's fine for Secondary bindings, which is why the ability to clear bindings exists. This behaviour is currently unclear which creates user confusion.

I'll move this to Issues forum now for follow-up later.

Re: [0.11.4] Some of the keybinds are not saved properly

Posted: Fri Jul 09, 2021 4:08 am
by jefetienne
Ralzar wrote: Thu Jul 08, 2021 2:41 pm which I honestly find to be a poor choice of default key
Hey I think it's a perfect key! :lol: I chose it because of other games that had it. Sometimes it's nice to get your character moving without needing to use your keyboard.

Regarding the issue, I have a solution in place for everything mentioned here. In fact, you had such a perfect test case that it even got me to find another hidden bug in the code. Thank you for reporting this!

Re: [0.11.4] Primary bindings set to "None" will revert to defaults and may introduce conflicts

Posted: Tue Jul 13, 2021 2:45 pm
by Kab the Bird Ranger
Did you figure out why using AutoRun while walking has you automatically running and using AutoRun while running has you automatically walking?

I've always found that weird, though I wasn't sure if it was a bug

Re: [0.11.4] Primary bindings set to "None" will revert to defaults and may introduce conflicts

Posted: Tue Jul 13, 2021 9:31 pm
by jefetienne
Kab the Bird Ranger wrote: Tue Jul 13, 2021 2:45 pm Did you figure out why using AutoRun while walking has you automatically running and using AutoRun while running has you automatically walking?

I've always found that weird, though I wasn't sure if it was a bug
So I have a feature where if you are autorunning (walking -> pressing Autorun), the "Run" button becomes a toggle to alternate between walking and running. I can't remember if manual running -> pressing Autorun to do "autowalking" was an intended feature or not at the time, but it doesn't come off as expected behavior. I just submitted a PR to give the better behavior regardless.