yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.32k stars 1.56k forks source link

Counts for map generation options #4347

Closed Mape6 closed 3 years ago

Mape6 commented 3 years ago

The sliders are really small on an Android device. So it would be cool to have count next to each slider where you could see the percentage of the individual option.

ravignir commented 3 years ago

I would also like to have plus and minus arrows to modify these values instead of a slider. The whole thing has thresholds so it makes no sense to have sliders imo.

ajustsomebody commented 3 years ago

also while we're at it the generation should be like in civ 5

Mape6 commented 3 years ago

also while we're at it the generation should be like in civ 5

That's not the topic here. Please open a separate request for that. Especially with a more detailed description of what you want.

SomeTroglodyte commented 3 years ago

@ravignir what thresholds exactly? How could it look without a slider? Dropdown select using labels like "none-few-some-average-many-gadzooks"? Label flanked by -/+ buttons? The only slider I know how the underlying values work without checking the source would be coast extension...

Mape6 commented 3 years ago

I like the idea from @ravignir, too. Imo the sliders does not have so good usability on my Android device as the following: Just a field where I can see a number between 1 to 9, or whatever the threshold for a slider is, and a minus left and a plus button right of it. If the thresholds are much bigger like 1 to 99, the field should be writable, so that you don't need to tap 98 times on the plus button to get the maximum. Did I describe my wish clearly enough?

ravignir commented 3 years ago

@ravignir what thresholds exactly? How could it look without a slider? Dropdown select using labels like "none-few-some-average-many-gadzooks"? Label flanked by -/+ buttons? The only slider I know how the underlying values work without checking the source would be coast extension...

I meant that as of now sliders only stop at the predefined values (thresholds). And yes, a label with +/- buttons and current value (whether it is numerical or a text like small-normal-huge) in the middle is what I meant.

SomeTroglodyte commented 3 years ago

The problem with the sliders is mostly size and far-too-easy focus loss. I already tried a few times to force them to follow as long as I don't lift the finger, and never got perfection (testing with the volume sliders, not these). Make no sound, disallow scroll, and add 20f padding, and they're markedly easier to 'slide', but still lose you sometimes. And yes I'm speaking of a fast-ish hardware Android device, no Mouse involved. Of course, those changes are already too much of a throwback. And a textbox with +/- buttons would IMHO look ugly - this is a game not a technical tool.

Options:

@ravignir - does the Original have something comparable we could follow? Ah, with threshold you mean the step size - well the controls can't do without, even if you make them smaller than a pixel equivalent. Which would exacerbate the focus loss issue. But the ones we're talking about - they all have exactly 21 steps as can be seen in this source line...

ravignir commented 3 years ago

In the original you have the slider for city states and the rest is just pick an item from the predefined list z

But then there is a mod that allows you to set pretty much anything you want called Really Advanced Setup, which i am not going to elaborate on now. It is self-explaining.

SomeTroglodyte commented 3 years ago

OK - that's a possible approach, you list all possible choices of the World Age to Resources widgets for us, we figure out how to map them to the Unciv values (World Age being the interesting one), and go for dropdown selects as our idol has...

... Gdx Slider is a tricky beast. It subclasses ProgressBar then writes to ProgressBar's private position field, so just "side-classing" it is extra hard. But I'm surprised you can have it snap to explicit positions that need not be evenly spaced...

SomeTroglodyte commented 3 years ago

Eureka. I mean, I understand an important underlying problem, not that I know how to fix already.

It's the same detail that had me stumped with the keyboard handling. There's other examples others did the workarounds for in Unciv. It's this: Gdx bubbles events from bottom to top, not as you'd expect. So the ScrollPane under the Slider has first say, and if it thinks you wanted to scroll the container - that's it, Slider is out and deprived of the focus. Let's see if a similar kludge as with keyboard can be done...

Of course that's not the answer to the OP, but once Sliders 'feel' reliable and like they actually 'obey' we're in a better position, and less pressured to consider flipping the boat over instead of slightly pushing it...

SomeTroglodyte commented 3 years ago

So if anyone wants to check out what I came up with...

https://user-images.githubusercontent.com/63000004/124369269-42c84f80-dc6a-11eb-9b4c-b87844b19c1f.mp4

source branch is here - for people with Android Studio debug apk is here - for the daring the one key source file - read and facepalm

... notice how the ScrollPane cannot steal the focus from a slider anymore if the step is small or one starts dragging off the knob, but when dragging coast extension by the knob the thing fails and the ScrollPane still takes over? Couldn't solve that. Also, the numeric tip works only on desktop, despite a few attempts to force-show. No, it's not dependent on presence of a keyboard... It also shows the positioning problem, as the exact same Table without any changes, but called for a the new map screen, will put them right over the slider itself, ignoring my offset. Friggin' mystery to me.

But it's still gotten much easier on a physical phone.

ajustsomebody commented 3 years ago

So if anyone wants to check out what I came up with...

https://user-images.githubusercontent.com/63000004/124369269-42c84f80-dc6a-11eb-9b4c-b87844b19c1f.mp4

source branch is here - for people with Android Studio debug apk is here - for the daring the one key source file - read and facepalm

... notice how the ScrollPane cannot steal the focus from a slider anymore if the step is small or one starts dragging off the knob, but when dragging coast extension by the knob the thing fails and the ScrollPane still takes over? Couldn't solve that. Also, the numeric tip works only on desktop, despite a few attempts to force-show. No, it's not dependent on presence of a keyboard... It also shows the positioning problem, as the exact same Table without any changes, but called for a the new map screen, will put them right over the slider itself, ignoring my offset. Friggin' mystery to me.

But it's still gotten much easier on a physical phone.

it looks great, as you said the only problem seems to be lose focus thing. what about just simply showing the values of the sliders right next to the plus icon on mobile? that would be better than nothing i think.

also why does the middle section even move, couldn't it be scaled to match the screen size?

Mape6 commented 3 years ago

I tested the apk on my phone and it looks really good. Only the missing numbers are a thing... Probably the suggestion from @logicminimal could be a possible solution? Btw, thank you @SomeTroglodyte very much for investigating into the request here! I really appreciate that.

SomeTroglodyte commented 3 years ago

Thanks for the feedback. That's by no means anywhere near polished and 'production-ready', and I need to think it over for a while.

Numbers to the side of course occurred to me, but that wasn't in the "I need to code it and see it to understand" category. Also, screen real estate is really scarce so I hope with a little time maybe I'll get a better idea. Could we do something clever with long-press perhaps? Exchange the slider with a textbox in that case? That'd be more my style... (and that's meant tongue-in-cheek).

SomeTroglodyte commented 3 years ago

FYI: I submitted a PR for a version that looks and feels almost identical to the video and apk, the tip is no longer a Gdx ToolTip under the hood so it behaves a little nicer. No 'drive' left to try out more alternatives.

yairm210 commented 3 years ago

Resolved by #4506