Latest Posts

Topic: Soldier sorting in the Attack dialog box

SandJ
Avatar
Topic Opener
Joined: 2015-05-08, 22:46
Posts: 14
OS: Linux
Ranking
Pry about Widelands
Location: UK
Posted at: 2024-11-29, 22:36

When attacking a site, the dialog box where you select who is attacking and who is not, has me wondering. How are the soldiers sorted?

It is not by any of the attributes (Health, Attack, Defence, Evade) since heroes and rookies are all mixed up. It does not appear to be by distance from the target, I think. It does not take into account whether soldiers are still healing.

And what makes we really curious is the way the list of soldiers re-arranges as you move one from one section to the other. It makes the list shuffle again. So it cannot be an internal ID number for each soldier.

How are they arranged?

(And I will have follow-up comments such as "It would be nice if we could sort them by distance / skill / injured.")


Top Quote
mxb2001
Avatar
Joined: 2019-05-20, 18:49
Posts: 288
OS: Linux
Version: 1.2
Ranking
Tribe Member
Location: The land of the thirsty spider
Posted at: 2024-11-30, 01:00

I think it is by order of arrival in the forts. Not a clue how it sorts the forts if there is >1. What I've seen is that returning soldiers line up at the end of the queue. I think...


--
To Boldly Go Where No Man Has Gone Before

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2054
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-12-01, 17:00

The soldiers are sorted by air distance to the attack target. Equally distant soldiers are always in arbitrary order, although they usually end up grouped by building and soldiers within a building typically in order of arrival.

Note that air distance does not account for obstacles so it may not accurately reflect actual walking distance. This is an optimization for performance.
Healing and skill are not currently taken into account. +1 for more sorting options.

This is the code where the sorting takes place:
https://codeberg.org/wl/widelands/src/commit/73c82e1e1a93c13677578b29cc9ecd4d7d12a239/src/wui/attack_window.cc#L702-L722


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2547
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-12-01, 17:12

Do the slight background colors of the soldiers show this? I wonder what the coloring shows...


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2054
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-12-01, 18:09

Yes, the background tints indicate soldiers who are in the same building, or on the same warship.

https://codeberg.org/wl/widelands/src/commit/73c82e1e1a93c13677578b29cc9ecd4d7d12a239/src/wui/attack_window.cc#L46-L64


Top Quote
mxb2001
Avatar
Joined: 2019-05-20, 18:49
Posts: 288
OS: Linux
Version: 1.2
Ranking
Tribe Member
Location: The land of the thirsty spider
Posted at: 2024-12-01, 18:17

I usually send fully healed best trained soldiers (I imagine that's the usual) so options to sort by training/healing would be nice. It's not a big deal though, scanning through them for the ones you want is not exactly the most tedious chore... On the other hand I recall doing it too quickly and misclicking. Although that might be my poor hand eye co-ordination (which is why I play strategy/thinking games and eschew arcade games!).


--
To Boldly Go Where No Man Has Gone Before

Top Quote
SandJ
Avatar
Topic Opener
Joined: 2015-05-08, 22:46
Posts: 14
OS: Linux
Ranking
Pry about Widelands
Location: UK
Posted at: 2024-12-05, 15:09

Nordfriese wrote:

Healing and skill are not currently taken into account. +1 for more sorting options.

Sorting by the number of soldier upgrades would be nice. Although someone might say "I want them sorted by Attack because I have loads of soldiers but I do want them to kill the enemy" and another time "I want them sorted by Defence or Evade because I can't afford too many losses". So it could be a can of worms.

When I want to capture a large military building that is surrounded by small ones, I will send some soldiers to each of the small ones first to bring out all the defenders, then send a force of my best troops to capture the big one, now that the defenders are all distracted. So I want to sort by distance and skill!

Maybe there is no satisfactory universal solution to this.

Regarding wanting to only send full healed soldiers, perhaps a toggle would help: Include injured soldiers? X


Top Quote
SandJ
Avatar
Topic Opener
Joined: 2015-05-08, 22:46
Posts: 14
OS: Linux
Ranking
Pry about Widelands
Location: UK
Posted at: 2024-12-05, 15:11

kaputtnik wrote:

Do the slight background colors of the soldiers show this? I wonder what the coloring shows...

I had never noticed that. On my monitor that shading is so subtle as to be near invisible.


Top Quote