Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaigns menu overhaul #5358

Merged
merged 8 commits into from Dec 19, 2020

Conversation

irydacea
Copy link
Member

@irydacea irydacea commented Dec 15, 2020

This overhauls the game's Campaigns menu following some of the directions previously suggested in issue #4543.

Requesting reviews from @Vultraz for the UI layout and code changes, @gfgtdf for the engine changes, and @Pentarctagon and @nemaara for the core changes to the single-player campaign UI flow.

User interface changes

Screenshot_20201215_002624
Screenshot_20201215_003209
Screenshot_20201215_003039

  • The main area of the dialog is rearranged into four distinct sections:
    • The caption row, with the dialog caption and search box
    • The main panel, with the list of campaigns on the left, the campaign description and image on the right, and an image background.
    • The settings row, with the Modifications, Combat (RNG) and Difficulty menus arranged in that order.
    • The control row, with the Play and Cancel buttons.
  • The toggle buttons serving as the headers for the list of campaigns have their text centered in order to make the list header seem more tidy in general.
  • The Difficulty menu is integrated into the dialog in the form of a dropdown menu button. The old standalone menu remains available for use by Load Game and others that may need it.
  • The Save random seed option is replaced with a new Combat dropdown menu button allowing the player to choose between Default RNG, Predictable RNG (identical to Save random seed), and Biased RNG (identical to the Advanced Preferences experimental PRNG option, removed by this PR).

WML changes

  • A new attribute, background=<image path> is added to top-level [campaign] to allow specifying a custom background image for the main panel. In the absence of this, a default image is used (currently story/landscape-battlefield_nohumans.jpg).
  • The random_mode= attribute in game classification has a new possible value, biased, which selects the predictable RNG as with the Save random seed option before but also enables the RNG bias logic in the attack engine (previously the experimental PRNG option). The logic in the attack constructor may now be slightly redundant since it shouldn't be possible for random_mode to be biased and randomness::generator->is_networked() to return true (@gfgtdf may want to confirm this).
  • toggle_button widgets gain new definitions: listbox_header_centered (unused), listbox_header_bg (unused), listbox_header_centered_bg (used by this PR for the campaign list header row).
  • panel widgets gain new definitions: panel_listbox_bg (used by this PR for the campaign list header row), campaign_menu_bg (used by this PR for the main campaign menu panel).

Known issues

  • The Difficulty menu button has to compose labels from the label proper specified in [difficulty] WML as well as the description in order for the labels to make sense (e.g. for HttT, the difficulty labels would be the rather meaningless "Fighter", "Commander", "Lord" otherwise). The problem arises from the possibility of [difficulty] descriptions using Pango markup that will look plain wrong on the menu button proper's label. We don't seem to have a function to unescape markup entities and strip Pango markup at the moment, so this is left unsolved in the PR for the time being.
  • The Combat menu button has overlong descriptions resulting in a messy dropdown display as seen in the third screenshot above. I'm not entirely sure what to do about this without losing the intended conveyance of information — tooltips perhaps?
  • The dialog has layout issues on low resolution (< 1024 px horizontal) modes and other situations where overlong text crops up.on the game settings row at the bottom. I want to fix this, ideally before merging.
  • There is no way to set modification options from the dialog itself. If this is wanted it could be worked on at a later date, preferably with the help of someone who knows better how modifications work (such as @gfgtdf).
  • The idea suggested in issue Campaign Menu GUI design  #4543 of adding a separate tab for tutorials is not implemented yet. There does not seem to be a use case for it yet either since the tutorial only has two scenarios at the moment. I also largely ignore if it's possible to instruct the game to skip to a scenario other than first_scenario. I would greatly appreciate some input on this particular point for this PR and others.
  • Mainline campaigns have no custom backgrounds defined yet. Below is attached a patch I used to test the feature only, with no real thematic coherence intended ­— save perhaps for HttT, where my best option was the antiquated 1.0 story art used for the Battle for Wesnoth scenario.
  • Campaign images (often portraits) are currently allowed to jump around even when the text doesn't take enough space for them to need to do so. Perhaps anchor them to the bottom of the right pane? (Note that @Vultraz seems to be of the opinion that we should do away with the images themselves. I do not agree with this.)
  • Campaign descriptions may suffer from text contrast issues when a sufficiently bright background is selected. Currently this is partly alleviated by using a dark translucent overlay on the background (see the campaign_menu_bg definition for panel). I don't feel we can do anything about this short of adding shadows or (preferably) outlines to the text.
  • Long campaign descriptions predictably cause a vertical scrollbar to appear. multi_page remembers the scrollbar position for each page and I can't quite decide if this is desirable behaviour or not.

Reference/test material

Original Experimental PRNG option patch

See commit 3f06813 and the forum thread, both by Dave.

Background image test patch

See https://gist.github.com/shikadiqueen/e66d433d9ee0d6dd4915f986d6658c38.

@irydacea irydacea added UI User interface issues, including both back-end and front-end issues. Engine General game engine issues that do not fit in any other category. labels Dec 15, 2020
Copy link
Contributor

@nemaara nemaara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty nice.

@Vultraz
Copy link
Member

Vultraz commented Dec 15, 2020

One think that immediately stands out to me is that Modifications section. It should be aligned with the left window edge.

@soliton-
Copy link
Member

Perhaps the combat descriptions can be moved to a linked help page instead.

CC: issue wesnoth#4543

(N.B. This is a monolithic mega-commit because of a bunch of
experimental phase changes that necessitated constant changes to both
engine code and UI WML.)

This redesigns the campaign selection dialog implementing a
campaign-defined background image that changes depending on the selected
campaign, specified by the [campaign] background= attribute; adding a
menu button for selecting the RNG mechanism in use (default RNG vs.
predictable RNG a.k.a. "save random seed"); and finally, adding a menu
button for selecting the campaign difficulty without having to go
through the campaign difficulty selection dialog.

A huge amount of changes to the UI WML were required for this to say the
least.

This also adds the following new widget definitions:

 * toggle_button: listbox_header_centered, listbox_header_bg,
   listbox_header_centered_bg
 * panel: panel_listbox_bg, campaign_menu_bg

As a side effect, two private methods in
gui2::dialogs::campaign_selection() are no longer const-qualified. No
idea why they were const-qualified in the first place, but it
interferred with some of the new code in a major way.
This removes the use_prng Advanced Preferences option and replaces it
with a new possible value for randomness in the game classification
class, "biased". It also changes the enumeration label for it in the
GUI2 campaign dialog.

It also makes it so the synced RNG is automatically used with this
option as well as the existing deterministic randomness option ("save
random seed").
This brings back laurels for the difficulty menu. Because I really don't
want to break into menu_button's implementations details just yet, this
is a bit of a hack using the BLIT IPF instead of stacked_widget.

To make up for it, this version uses the three different difficulty
laurels depending on the difficulty being displayed, instead of always
using the standard laurel.
@irydacea irydacea force-pushed the feature/campaign-menu-redesign branch from d2c7b36 to 42ee3b1 Compare December 15, 2020 15:57
@irydacea
Copy link
Member Author

Perhaps the combat descriptions can be moved to a linked help page instead.

I thought about this, but that would mean adding a new help page and hoping for people to click on a somewhat unrelated element in the dialog (a new Help button) to figure out what the option does.

On the other hand, it turns out that tooltips do work with dropdown menu items as one would expect them to do without any issues:

Screenshot_20201215_131214

The opacity used here for the fill colour is identical to the one used
in the image file.
This makes the row actually take up its full horizontal space and spaces
out the columns very slightly while still allowing them to be usable at
800x600.

It also replaces the overlong detailed descriptions for the options in
the Combat menu with tooltips holding the same contents.
@Pentarctagon
Copy link
Member

@nemaara Once this is merged, can you take a look as far as adding backgrounds for the mainline campaigns?

@irydacea irydacea self-assigned this Dec 19, 2020
@irydacea
Copy link
Member Author

After consulting with @Pentarctagon and @Vultraz, we've decided to merge as-is. The PR is still here for @gfgtdf's reference if he becomes able to review the engine changes at a later time.

@irydacea irydacea merged commit 61e832e into wesnoth:master Dec 19, 2020
@AI0867
Copy link
Member

AI0867 commented Dec 25, 2020

I dislike the description of the Biased RNG. It seems to imply that the regular RNG doesn't obey the true probabilities, even though it doesn't actually say that.

I'm not sure how to word it better though.

@CelticMinstrel
Copy link
Member

Now that this has been merged, I have two comments.

  • First, I agree with @AI0867 on the description of the "Biased RNG". I'm not 100% how it works, but I did glance at the original commit and it looks similar to DotA's system where the chance to hit starts below the target chance but increases with every miss, resetting once there's a hit. I don't think "biased" is at all an accurate description of this - biased gives the impression that it's altering the probabilities, but if it is similar to what DotA does, then it's not altering the probabilities themselves, only the distribution of successes and failures. Perhaps "Smoothed RNG" or something similar? I'm not happy with that either but it seems less misleading than "Biased RNG".
  • It seems like there's no longer any way to use the experimental PRNG without enabling Save Random Seed, is that correct? I'd prefer them to be two separate options. They have nothing to do with each other, after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engine General game engine issues that do not fit in any other category. UI User interface issues, including both back-end and front-end issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants