I'm developing prototype of Tower Defense/RTS game and I've implemented simple Flow Field grid. Here is the example (link).
How to use example: First click on S50, this will spawn additional units, then wait till all of them clump together, click on SET_BASE button and click on a free space, this will move the base (red circle) and they'll move to the new location. The problem is that if you click to a relatevely diagonal position, they'll all go straight to the target, while if you give them new order at the same y coordinate, they'll start clumping.
If you click several times to move units around, you'll notice that they're moving pretty well when you order them to move diagonally and clump in a line when going horizontally or vertically.
I ran out of ideas what to do next to fix this, what are yours?
A bit more info about my flow field: I do one pass of "Dijkstra distance" and then do second pass of detecting lowest distance neighbor and assign "vector" to that neighbor.
Then, about units movement - every unit every update reads "desired movement vector" from it's current cell, predits its movement, then checks if it will hit the wall, updates movement vector, then checks if it will hit other units and finally updates movement vector.
EDIT: Here's the source code of movement logic.(link)
And source of flow field generation (link)
I'm sorry for shitty code and stupid comments, it's all "prototyp-ish" as possible.
What I want is to achieve less "diagonal-horizontal" difference, because at the current state it's really seem underwhelming and it's unaccetable that you can move all units faster by zig-zagging them to their destination.