Download: https://github.com/zxbc/BAR_widgets/blob/main/cmd_customformations2.lua
TL;DR version of the story: formation move (right click drag) quality should be improved for large groups (>100).
The long version:
Because @proper elbow updated the default time limit for formation move calculation to 10ms (from the old 50ms) to reduce stutter, the overall quality of node matching is worse. I have (hopefully) improved the default matching algorithm (not the Hungarian algorithm, which only takes effect for small unit count) by doing the following:
-
Distance matrices calculation and sorting are moved to Update, using stale (by 2 frames) unit and node positions during formation draw. The stale positions should not affect overall quality of matching too much while processing time is entirely removed from MouseRelease() onward to give way for more actual optimization in clash resolution.
-
Clash reduction reworked. Binning of clash checking is used as a heuristic to reduce higher tier iterations count. The algorithm now works into smaller and smaller bin sizes as more time is left. This should take care of "long distance clashes" in earlier iterations, and move fine improvements to later iterations. If/when time runs out, the code terminates just like before, hopefully at a better state as a result.
-
Added some debug messages for the new changes (set true to defaultMode at the top to see).
-
Added mouse drag threshold: now the minimal draggable formation is tied to mouse drag threshold set in options.
Please report any abnormal behavior or bugs if you encounter any, and let me know if you see any actual improvements!
NOTE: Copying the file into your widgets folder and loading it will automatically replace in-game version.