@Jip said in Disperse Move:
Pretty cool idea - if the discovery from @TheWheelie is correct then I feel you are choosing random orders somehow. After inspecting the code I didn't get much wiser - it has comments but I'm not enough into this bit of the code base to understand in under a few minutes.
What do you think about assuming that the group of units have the same orders, choose the orders from the first unit and then see they align with the number of units that you have?
For example:
- If you have more orders than units, assign each unit a unique order leaving some out.
- If you have more units than orders, make sure each order is assigned and assign some double.
That would solve the situation Wheelie has, which shows unreliable behavior.
what happened to @TheWheelie was solved already in version 3
the reason it happened before is that units' orders were randomized normally like in original Spread Move, and I was simply removing every order per unit except first one given to it, but units could have been unevenly distributed between these orders (because it was a random function) resulting in more units getting the same first order than others, and sometimes (like in farms' example) some orders might have not been given to any unit at all as their first order, and once all orders after the first were removed, those orders that were not given to any units as their first order were deleted completely
the way it works now is that the unit uses its index (which number in selected group of units they are) to select which order goes to it first (from order queue), and thus every order gets at least 1 unit (as long as there are at least same number of units as orders), if there are more orders than units, the orders given past the unit number get deleted and units are distributed up to last order they could, if there are more units than orders, once last order in queue is given to a unit, the next unit in group starts over from first queued order and this repeats until all units are given first orders, evenly distributing all units between all orders