Soldiers list - wrong sorts (sigh probably not LW2)

Post Reply
Zork
Posts: 151
Joined: Wed Jul 26, 2017 3:58 pm

Soldiers list - wrong sorts (sigh probably not LW2)

Post by Zork »

In the list of soldiers, sorts are wrong. I started notice with sort by name, but now I have it with all sorts but perhaps not state and level.

I'll take an example of sort by class: 7 "Agent Psi", 1 "Artificier", 2 "Agent Psi", 5 "Artificier", 2 "Commando", 1 "Agent Psi", 5 "Commando", 1 "Artificier", 1 'Grenadier", 1 "Agent Psi", 1 'Grenadier", 1 "Commando", 1 "Artificier", 2 'Grenadier", 2 "Agent Psi", and so on.

It's total madness up to wonder how it's possible. It's not there is no sort or that it's another sort, there's obviously mix of criteria, and most probably some totally wrong algorithm polluted by something.

I wouldn't be surprise that a trigger of the bug is 100+ soldiers or 110+ soldiers and that it goes worse and worse as number of soldiers rise (now 143). Moreover sometimes a change in a squad like remove or add a soldier influences the order.

It's no way a small bug, but quite a major one, how alone in universe I have it, I can't imagine.

EDIT: Sigh, I made another test and except if sorts are somehow saved in save file, it's probably a bug of base game.
Removed all mods but the 3 maps packs, load a save, sort per class was looking ok but most classes was empty but Pis, Spark and Recruits. But the sort by names had errors.

The problem is I have never seen this bug in my campaigns of base game, my guess is it's probably because I never reach 100+ or 110+ soldiers. Well I give up report in that condition with no clean case to provide.
NOT a tactical/strategy expert player, playing LW2 at Easy. Rather old so I appreciate not be bothered by excessive familiarity, I'm not your friend and will never be. Refuse to learn English well so don't attempt learn it to me, thank you. :-)
tracktwo
Long War Dev
Posts: 241
Joined: Sat Jan 07, 2017 7:43 pm

Re: Soldiers list - wrong sorts (sigh probably not LW2)

Post by tracktwo »

Yep, this is a known bug in not just xcom2, but the unreal engine. Robojumper posted a good summary of it on the xcom2 subreddit a while back, but the quick summary is that it will fail to sort sufficiently long lists of things. So this doesn't just impact the barracks, but also any sorting of the black market, inventory lists, etc whether in the base game or added in a mod, unless they wrote their own custom sorting code.
Zork
Posts: 151
Joined: Wed Jul 26, 2017 3:58 pm

Re: Soldiers list - wrong sorts (sigh probably not LW2)

Post by Zork »

Woo even come from engine API? Weird because it's a major bug. Sigh unreal engine is really amateurish stuff, imagine this in any OS API, or open source API, woo.
NOT a tactical/strategy expert player, playing LW2 at Easy. Rather old so I appreciate not be bothered by excessive familiarity, I'm not your friend and will never be. Refuse to learn English well so don't attempt learn it to me, thank you. :-)
fowlJ
Posts: 198
Joined: Thu Jan 21, 2016 1:45 pm

Re: Soldiers list - wrong sorts (sigh probably not LW2)

Post by fowlJ »

Here is the reddit post in question for anyone curious. Technically, I don't think it's actually a bug, necessarily, it's a consequence of the engine being set up to use a sorting algorithm that is prone to that issue - a comment on the post suggests some possible reasoning for why they might have done so, though I don't know enough about it personally to know if it checks out.
robojumper
Posts: 3
Joined: Tue Feb 21, 2017 3:53 pm

Re: Soldiers list - wrong sorts (sigh probably not LW2)

Post by robojumper »

fowlJ wrote:a comment on the post suggests some possible reasoning for why they might have done so, though I don't know enough about it personally to know if it checks out.
It does not check out. Epic Games does "sort using a simple bubble-sort (assuming no large arrays in script in the first place)", and I guess they added a check for the number of comparisons and bail out when the number gets too big. BubbleSort has a very bad runtime for long arrays, so they maybe just decided to improve performance at the cost of sorting accuracy in case someone accidentally sorts long arrays.

Developers who have the source code and deal with very long arrays can just implement their own better native sorting functions anyway. I don't even know if it's stock UE3 behavior (BubbleSort is, but the failure to sort long arrays -- who knows? The very outdated UE3 source I found doesn't indicate anything like that).
Zork
Posts: 151
Joined: Wed Jul 26, 2017 3:58 pm

Re: Soldiers list - wrong sorts (sigh probably not LW2)

Post by Zork »

It's very bizarre, I program rather often and used ton of high level libraries, including for GUI or tables, and never ever I quoted a wrong sort. It's not like sort is programming, it's copy/paste known algorithm if you can't use any library doing the sort for you, nothing to program.

No matter the sort, with such tiny lists, even 200, no human would be able to make a difference for the time used, bubble sort has one advantage it allows mix sorts, you take a list sorted by a criteria, sort with buddle for second criteria and you get a list sorted by second criteria and first criteria. For such GUI where the list must be short or it's a burden for user, bubble is fine.

What's totally weird is when the panel is opened the default sort seems totally fine, when you request the reverse of this sort it's total garbage, and if you request the original sort it's fine again.

Your hypothesis is possible and it's possible the garbage sort is an intermediate state of a bubble sort, but it's still garbage in Unreal engine and high level amateurism:
- They sort well the list with a size above their limit when the panel is opened but after the API does total garbage, amateurs.
- Even if the API to sort a panel list specifies a limit, that this API does something and generates total crap is a total garbage programing showing newbie amateurism and programmers unable to do anything clean. If you have a size limit you test it first before lost time to do pointless wrong sort.
- Screw up a classic sort that you should never program yourself past school and learning, but that you should copy paste is total incompentency without to mention the pointless cost it generates.
- If there's some crap test badly managed in the sort testing 100, it's a stupid limit for the sort point of view, I'm pretty sure a human wouldn't be able notice the time difference of a bubble sort of a list of 200 and a list of 100. Modern computers even more able to play modern games are total beasts.
- That there's two behaviors of the sort, at panel opening and when requesting another is showing the code is total garbage with pointless duplicate coding, and of a classic simple algorithm, it's just huge incompetency.
- Finally if the API of the engine wanted force an ergonomy limit for such panel list, it must have been managed at panel opening.

:-)

A side note is I always had a strong contempt for anything Unreal, but he, I'm not that much surprised that they can be so incompetent. A company with that cloning mentally can only stink quite a lot.
NOT a tactical/strategy expert player, playing LW2 at Easy. Rather old so I appreciate not be bothered by excessive familiarity, I'm not your friend and will never be. Refuse to learn English well so don't attempt learn it to me, thank you. :-)
Post Reply