[interface] sidebar: make unit status / unit_weapons scrollable

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

[interface] sidebar: make unit status / unit_weapons scrollable

Post by white_haired_uncle »

If a unit has a lot of attacks and/or specials, they don't fit on the sidebar. My first thought was to, when necessary, add a couple small up/down buttons at the bottom so the player could scroll through and see all of the attacks (a scrollbar would take up valuable horizontal space, while the space taken by buttons would be "reclaimed" by being able to scroll). But now I'm thinking that scrolling with the mouse wheel might make more sense (and might be easier to implement).

As I've been looking into the way the sidebar reports are implemented, it looks like this is going to be harder than I hoped. I think I can see a path to get there, but it's well beyond my current skill set (but, I believe, doable). Before I get too far into this...

1) Assuming this can be made to work well, is it something that would be an acceptable change?
2) Does it make sense to make the unit_weapons report scrollable, or the whole unit status panel (as one scrollable entity)? I know I'd like to see, for example, more space for status icons -- making the whole thing scrollable would add some virtual real estate.
3) Anyone working on something like this, looked into it in the past, etc?
4) If I should go forward with this, is this the place to discuss implementation details? I think I have a decent idea of what needs to be done, but I'd really like to avoid going down the wrong path if I'm wrong.

Thanks
Speak softly, and carry Doombringer.
User avatar
bssarkar
Developer
Posts: 105
Joined: April 2nd, 2020, 9:34 am
Location: India
Contact:

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by bssarkar »

I'd like to inform you about something. Wesnoth actually has two UI toolkits. The first is the legacy UI toolkit (GUI1), which is used in:
  • the top bar including the menu bar
  • the sidebar (which you're working with)
  • the help browser
  • the command window inside a scenario
All other windows use the new GUI toolkit called GUI2. More details are on the wiki and past forum post, for example here. (It separates the UI and control logic and simplifies many things.)

The development team has plans to replace the GUI1 toolkit completely (for a long time now), so it is likely possible that all of the parts mentioned above will get completely redone using GUI2, hopefully within the current development cycle. Also, this might automatically fix many of the bugs involved the previous parts. So what that mean it that any change or bugfixes to those parts will get replaced, so there's a risk that your efforts might be wasted (really sorry for that). The UI Maintainer and the Project Manager can give you more details.
4) If I should go forward with this, is this the place to discuss implementation details? I think I have a decent idea of what needs to be done, but I'd really like to avoid going down the wrong path if I'm wrong.
Joining the development channels on Discord/IRC might make the discussion faster. Another option is creating an Issue on github.
User avatar
fishrose
Posts: 21
Joined: March 31st, 2024, 12:04 am
Location: Swamp of Dread

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by fishrose »

On a related note, it could be nice to have wrapping for unit names. I'd want to see "Prince Haldric the Dragonbane" in its full glory, lol.
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by white_haired_uncle »

fishrose wrote: June 20th, 2024, 8:47 pm On a related note, it could be nice to have wrapping for unit names. I'd want to see "Prince Haldric the Dragonbane" in its full glory, lol.
Especially since the name is large/bold, that could take up a lot of room needed for other things (if the box remains unscrollable). The full name is in the tooltip, so you can just mouse over the name to see the whole thing. It does look kind of bad the way it is now though.
Speak softly, and carry Doombringer.
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by white_haired_uncle »

bssarkar wrote: May 28th, 2024, 6:10 am I'd like to inform you about something. Wesnoth actually has two UI toolkits. The first is the legacy UI toolkit (GUI1), which is used in:
  • the top bar including the menu bar
  • the sidebar (which you're working with)
  • the help browser
  • the command window inside a scenario
All other windows use the new GUI toolkit called GUI2. More details are on the wiki and past forum post, for example here. (It separates the UI and control logic and simplifies many things.)

The development team has plans to replace the GUI1 toolkit completely (for a long time now), so it is likely possible that all of the parts mentioned above will get completely redone using GUI2, hopefully within the current development cycle. Also, this might automatically fix many of the bugs involved the previous parts. So what that mean it that any change or bugfixes to those parts will get replaced, so there's a risk that your efforts might be wasted (really sorry for that). The UI Maintainer and the Project Manager can give you more details.
4) If I should go forward with this, is this the place to discuss implementation details? I think I have a decent idea of what needs to be done, but I'd really like to avoid going down the wrong path if I'm wrong.
Joining the development channels on Discord/IRC might make the discussion faster. Another option is creating an Issue on github.
Are there any ongoing discussions or documented plans I could look at? Your response got me curious, so I did a little poking around and managed to come up with a very crude GUI2 version of the top panel, and I think I now have a rough understanding of how GUI2 works with C++. What I don't get is how the player would be able interact all at once with the top panel, the sidebar, and especially the gamemap (is this what you mean by "the command window inside a scenario") -- unless the gamemap itself was made into a widget, or some sort of "pass through widget" was created, or ...??? My understanding of a dialog, mostly from the lua API, is that it takes exclusive ownership of the keyboard/mouse as long as it's open, so I'm missing something there.

I looked at discord (for the first time), but it looks to me like pretty much just an IRC clone, fine for a quick chat but not something I'd expect would be used for more long-term planning kind of stuff.

thanks
Speak softly, and carry Doombringer.
User avatar
Jagedew
Posts: 16
Joined: May 27th, 2024, 2:57 pm
Location: Poland

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by Jagedew »

The sidebar really needs some better re-arragement. Looks so messy having those Def, Lvl and the flag icon in strange place. Thus taking space from unit name.
User avatar
bssarkar
Developer
Posts: 105
Joined: April 2nd, 2020, 9:34 am
Location: India
Contact:

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by bssarkar »

Sorry for the extremely delayed reply, I'm not a regular forum user.
white_haired_uncle wrote: June 29th, 2024, 2:49 am Are there any ongoing discussions or documented plans I could look at?
white_haired_uncle wrote: June 29th, 2024, 2:49 am I looked at discord (for the first time), but it looks to me like pretty much just an IRC clone, fine for a quick chat but not something I'd expect would be used for more long-term planning kind of stuff.
A very, very old plan is here: https://wiki.wesnoth.org/NotSoEasyCoding#GUI2_framework
Sadly that page is now deprecated, and for new problems and long discussions, opening a GitHub issue is probably the best idea. Discord is suited for informal discussions (as you noticed) and asking what the dev team thinks of your idea. (Did you notice that Discord has a message history feature? They are also logged here: https://irclogs.wesnoth.org/.
white_haired_uncle wrote: June 29th, 2024, 2:49 am What I don't get is how the player would be able interact all at once with the top panel, the sidebar, and especially the gamemap (is this what you mean by "the command window inside a scenario") -- unless the gamemap itself was made into a widget, or some sort of "pass through widget" was created, or ...??? My understanding of a dialog, mostly from the lua API, is that it takes exclusive ownership of the keyboard/mouse as long as it's open, so I'm missing something there.
Your assessment is correct. All game dialogs currently are Modal, meaning they block all input to anywhere except that dialog. We also have a Modeless dialog (used for the debug clock), but it suffers from event despatch problems when GUI1 and GUI2 contexts are mixed (aka the main game map window), which is this issue: https://github.com/wesnoth/wesnoth/issues/2691.

So, my personal attack plan would be to:
1. Create a GUI2 map widget that can show everything inside a scenario correct. (All drawing code already exists, but needs to ported to GUI2)
2. Create a menu system for GUI2 (which you tried to do)
3. Use existing GUI2 widgets to create a sidebar.
4. Add everything inside that dialog.

Note that I haven't tried that, this is all theoritical. (Vultraz is the one supposed to convert the main in-game interface from GUI1 to GUI2).

(If you still have discord: here's a provisional plan: https://discord.com/channels/2319768059 ... 4798409728)

(A small statement: I'm currently bogged down with PRs, include the GUI2 Help Browser.)
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [interface] sidebar: make unit status / unit_weapons scrollable

Post by white_haired_uncle »

I'm not sure what I think about this idea yet, but... What if the attacks were a tree_view? A lot of the problem with attacks taking too much space is the number of specials, perhaps those could be collapsed by the user when they needed? Finding a way to use the melee/ranged/etc icon as a tree_view fold/unfold button -- maybe??? -- could eliminated the space needed for a scrollbar (assuming scrollbar is needed, I still would prefer mouse wheel to scroll with no bar).
Speak softly, and carry Doombringer.
Post Reply