ddnet
ddnet copied to clipboard
Bind groups
While discussing issues related to binds, one suggestion was to add bind categories/groups so we could do more actions not only in game but in menus, demo player, editor, etc. See #3995, https://github.com/ddnet/ddnet/issues/3995#issuecomment-1548570994.
This PR is an attempt to do this while trying to keep the existing bind system so that players that are used to it do not need to update all their bind configs. This is a draft as I would like some discussion on this on some aspects, like how do we port existing binds for the "in game" group for example. Ultimately the goal of this PR is also to remove hard-coded binds.
I would also need other console commands for specific groups. For example, I would need console commands for the demo player and its different actions (play/pause, forward, increase speed, etc) as well as editor (#3995). Edit: Maybe there are other ways than using console to execute actions
I also reworked the bind settings UI, which you can see in this short demo:
https://github.com/ddnet/ddnet/assets/13364635/4ae82da1-b4b1-47ea-a2a8-64e4f74a8501
Right now, I have added new bind commands:
bindv2 s[group] s[key] ?r[command]bindsv2 ?s[group] ?s[key]unbindv2 s[group] s[key]unbindallv2 ?s[group]
I believe these names are temporary, I would also like to discuss a good name for them, unless we want to replace the existing bind system and reuse the same name, but I don't think that's the best idea as it would require everyone to update their bind config files to use the "in game" group for most of them.
There are currently 4 groups: ingame, menus, demoplayer and editor. I've already tested them and that only one is active at a time and it should be correct, meaning that the ingame group is only active while in game with no menus opened, the editor group is only active while editor is shown, and so on.
Finally, I changed how we setup the binds list in menu_settings.cpp to be similar to creating a tree of nodes, allowing us to nest groups inside groups, making it possible to create categories. Such categories can be seen in the video, under the "In Game" group, there are categories like "Movement", "Weapons", etc.
Checklist
- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with ASan+UBSan or valgrind's memcheck (optional)
its been almost half a year - i'd love to see progress or atleast a status on this. i am a big fan of this ^^
bump
I find this to be a bit too complex. Why are normal keys and + combinations not enough for all kinds of binds you could need?
I find this to be a bit too complex. Why are normal keys and + combinations not enough for all kinds of binds you could need?
The initial problem is that binds don't work ouside of ingame, that is in menus, in the editor, in demo player, ... The goal is to make bind groups to allow for binds to be used in specific context, for example a bind group for the editor in which binds can only be used when inside the editor. When outside of it, the binds become inactive, which means you can bind the same keys in different groups. This would also solve the mentionned issues.
closing as its stale reopen another pr if you want to continue working on this
I think I don't want this, so I agree with closing it.
closing as its stale reopen another pr if you want to continue working on this
That's fair, however I have opened two issues related to this PR which are still waiting discussions before I can continue working on this PR.
I think I don't want this, so I agree with closing it.
And what about the people who want this? But yeah, since there is no activity for this feature it seems it's not liked enough to be worth the time discussing.