HomeWildfire Games

Gamesetup slider support, use it for Ceasefire, RelicCount, RelicDuration…

Description

Gamesetup slider support, use it for Ceasefire, RelicCount, RelicDuration, WonderDuration.

Use Math.round until the slider GUI object type supports fixed step sizes, refs D406.

Differential Revision: https://code.wildfiregames.com/D2571
Comments By: Vladislav (irc), nani (PM), bb (irc), Stan

Event Timeline

Nescio added a subscriber: Nescio.Jan 24 2020, 12:52 PM

A few minor points:

  • The sliders are rather narrow and because you have to click on them, this makes them harder to use than the vertically much larger drop-down boxes.
  • The ends are noticeably faded, which is somewhat confusing. (Are the min and max values less valid options?)
  • The relic and wonder time go from 0 to 60 minutes, ceasefire from 0 to 45; why not 60 as well, for consistency? 60 minutes ceasefire used to be an option. (Off-topic, why exactly is 13 the maximum number of relics?)
  • Why did you use it for these four settings, but not others? Having a drop-down for game speed directly above the ceasefire slider is a bit ugly.

Overall, I'm not entirely convinced sliders are better (more user-friendly) than drop-down lists, though I don't have very strong feelings either way.

The relic and wonder time go from 0 to 60 minutes, ceasefire from 0 to 45; why not 60 as well, for consistency? 60 minutes ceasefire used to be an option.

The more narrow the range, the easier it is to pick values.
I have seen maybe 300 matches with Victory durations and they were usually 50minutes, since for shorter times it was too hard to attack the enemy, as it is easy to turtle up.
Ceasefire has the main use case at < 5 minutes on nomad.
(See also irc discussion with Vladislav linked)

(Off-topic, why exactly is 13 the maximum number of relics?)

The number of relics is the number of civs, each relic is spawned at most once.

Why did you use it for these four settings, but not others?

This had been discussed as well. It seems not publicly.
There are dropdowns with few choices where the labels are more informative than numbers, for example mapsize "small" is more descriptive than mapsize 192.
For starting resources the upper limit is infinite / 50.000, so using that as a scale wont work well.
For the population limit, maybe, I never said that this should be the final layout, but it was used for the durations first and foremost because those are continuous values selectable.
It had been proposed since the introduction of of the ceasefire / victory durations several years ago that introduced these json files.
A much greater argument against the sliders was that the use case distribution is not even, for example 10% of the users use 90% of the value range of ceasefire (> 5min), and 90% of the users only use the bottom 10%.
The primary reason I decided to to introduce the sliders is because the gamesetup should support them, because the value range of durations is numeric.
For the extinct volcano sea-level-rise duration for example (rP23434), the use case distribution is expected to be uniform, i.e. sometimes players want to play with instant waterrise, sometimes with 60 minutes, and everything in between with equal likelihood of being chosen.
Then one could at most use a 5 minute step dropdown, but that would also not allow chosing 2 minutes or 38 minutes for example.
It is also easier to pick values with a slider if there are 60 of them.

The ends are noticeably faded, which is somewhat confusing. (Are the min and max values less valid options?)

Thats just the sprite looking that way, its faded elsewhere too.
I didn't come up with this style, the sliders were first used in the options page for sound volume controls in rP19479 (0-100).
nani also proposed a different slider theme, but it looked much uglier to me, have a look at the revision proposal.
The reason why I committed this patch is to support sliders it in the gamesetup, and because this is the best style I and the others could come up with, then if someone finds an actually better theme, it can be authored, reviewed and merged without having to change edit and reivew the code (but only xml).
Another thing one can complain about at sliders is the FPS drop while sliding, and the Math.round workaround, that will be fixed by D406.

Then one could at most use a 5 minute step dropdown, but that would also not allow chosing 2 minutes or 38 minutes for example.
It is also easier to pick values with a slider if there are 60 of them.

True; the question is how likely it is people would want 38 minutes, rather than 40.

Ceasefire has the main use case at < 5 minutes on nomad.

Then why not reduce it further, to e.g. 30 or 20? (Just curious.)

The number of relics is the number of civs, each relic is spawned at most once.

So each mod that adds civs ought to edit the gui files?

Why did you use it for these four settings, but not others?

This had been discussed as well. It seems not publicly.
There are dropdowns with few choices where the labels are more informative than numbers, for example mapsize "small" is more descriptive than mapsize 192.
For starting resources the upper limit is infinite / 50.000, so using that as a scale wont work well.
For the population limit, maybe, I never said that this should be the final layout, but it was used for the durations first and foremost because those are continuous values selectable.

Understood, I was thinking more of settings with narrower ranges, e.g. game speed (up to 2×) or number of players (up to 8).

Then one could at most use a 5 minute step dropdown, but that would also not allow chosing 2 minutes or 38 minutes for example.
It is also easier to pick values with a slider if there are 60 of them.

True; the question is how likely it is people would want 38 minutes, rather than 40.

Also dropdowns require hardcoding the values whereas a slider only has 3 datapoints (min, max, step)

Ceasefire has the main use case at < 5 minutes on nomad.

Then why not reduce it further, to e.g. 30 or 20? (Just curious.)

Players who are interested in citybuilding, experiencing all economy to see the game for the first time in all aspects.
Or for jebel barkal for conquering the city first. That's a conceivable existing use case for a23b.
So its a tradeoff between GUI usability (pixel precision reqiured for a large range) and simulation utility (range of simulation values modifiable), which is also unfortunate.

The number of relics is the number of civs, each relic is spawned at most once.

So each mod that adds civs ought to edit the gui files?

No, the UI just uses number of civs, see RelicCount.js.

GameSettingControls.RelicCount.prototype.MaxValue = Object.keys(g_CivData).length;

Whether each new civ needs a relic depends on maps/scripts/CaptureTheRelic.js.

Why did you use it for these four settings, but not others?

Understood, I was thinking more of settings with narrower ranges, e.g. game speed (up to 2×) or number of players (up to 8).

Gamespeed (1) has labels, so it would remove something, also stepsize other than 1, so I would have added a worse workaround until there was D406.
Actually started implementing Playercount, but since is not present as a number (but as the length of the array g_GameAttributes.settings.PlayerData), and without D406 it wasnt well to code yet.

Also dropdowns require hardcoding the values whereas a slider only has 3 datapoints (min, max, step)

Thanks, I agree that's an improvement.

Gamespeed (1) has labels, so it would remove something, also stepsize other than 1, so I would have added a worse workaround until there was D406.

Perhaps move the game speed setting to the top, to make things visually more pleasing? This looks a bit ugly to me:

  • The sliders are rather narrow and because you have to click on them, this makes them harder to use than the vertically much larger drop-down boxes.

It would be nice if clicking above the slider, rather than exactly on the line, would also work. It shouldn't be too hard to increase the (vertical) sensitive area? And maybe make the arrow keys work with sliders as well?

nani added a subscriber: nani.Jan 24 2020, 4:11 PM

Perhaps move the game speed setting to the top, to make things visually more pleasing? This looks a bit ugly to me:

  • The sliders are rather narrow and because you have to click on them, this makes them harder to use than the vertically much larger drop-down boxes.

It would be nice if clicking above the slider, rather than exactly on the line, would also work. It shouldn't be too hard to increase the (vertical) sensitive area? And maybe make the arrow keys work with sliders as well?

This would fix all your complains. Improved from the version elexis mentioned before by making the edges not overlap with the slider button.

binaries\data\mods\public\gui\gamesetup\Pages\GameSetupPage\GameSettings\GameSettingControlSlider.xml

<?xml version="1.0" encoding="utf-8"?>
<object name="sliderSettingFrame[n]" size="0 2 100% 36" hidden="true">

	<include file="gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlLabels.xml"/>

	<object
		name="sliderSettingControl[n]"
		type="slider"
		size="175 7 100% 19"
		style="ModernSlider"
		tooltip_style="onscreenToolTip"
		hidden="true"
		z="1"
	/>

	<object
		name="sliderSettingLabel[n]"
		type="text"
		style="ModernLabelText"
		font="sans-bold-12"
		size="175 7 100% 19"
		z="1"
		ghost="true"
	/>

</object>

binaries\data\mods\mod\gui\common\modern\sprites.xml

	<sprite name="ModernSliderButton">
		<image backcolor="255 255 255 60"
			size="50%-4 50%-10 50%+4 50%+10"
		/>
	</sprite>
	<sprite name="ModernSliderLine">
		<image backcolor="255 255 255 10"
			size="-6 50%-12 100%+6 50%+12"
			border="true"
			bordercolor="255 255 255 50"
		/>
	</sprite>

This would fix all your complains. Improved from the version elexis mentioned before by making the edges not overlap with the slider button.

Actually I'm not sure it would. Also, I agree with elexis those sliders in your screenshot look a bit ugly, though they are clearer.

I had another look at the game options and the sliders there work fine for me. Apparently they're 36 pixels vertically (gui/options/options.xml) so maybe the match setup sliders could use the same size?

I wouldn't mind switching to nanis theme under the condition that it uses a color style that fits to the existing theme, i.e. using gold for enabled controls and gray for disabled ones, no? and secondly the rectangular shape looks more brutal than the current slider sprite. so if that square rectangle shape would be changed, I might agree with that diff. One advantage of nanis proposal might be that the area of the slider selector is larger, so it may be easier to use / move it (or not, I didnt look at the size property in the xml).

As for the gamespeed inconsistency (1 dropdown surrounded by multiple sliders), we could reuse the existing dropdown strings as the slider label caption after D406 I suppose, and perhaps one can then also use it for the playercount.

(A feature that dropdowns have that the slider doesnt have is the ability to provide "abstract" items, for example the "random" random map, or the "random" civ dropdown item.
So if one wants to change a dropdown to a slider, then one will have to consider that such an option would either become impossible, or require an additional checkbox, or require revert to the dropdown again.
For example for the SeaLevel gamesetting, there could also be a "Random" option that selects some time between 20min and 60min, but that would not be possible with a slider (but perhaps two. though that wouldn't scale).
For the playercount, there could be options like 4v4 inserted instead of only 1...8 Players, but I suppose that setting again would be preferable in an own dropdown, allowing the playercount to become a slider without losing a relevant setting feature)