trying to solve this is harder than I thought
My units avoid eachother in the same direction and get stuck occelating.
I THOUGHT it would be as simple as: one unit makes a decision, the other makes the opposite decision, and 'race conditions' wouldn't matter because all that matters is ONE of them decides first.
But apparently the way unity works, they both decide in unison, in any order, before writing the answer to their own decisions to themselves. So neither is 'first' and neither can see who went 'first', so they both go the same direction, both see the other is going that direction, both choose to go the other direction because neither can see that the other updated its vector because the writing of the decision to change vector happens 'later' as in race conditions 'later' and not a 'measurable later' as in like next frame.
This is the first time ive faced race conditions I think. The way I thought it would work would work if instead of them making their own decisions, some kind of AI coordinator iterates through every unit in an arbitrary order, and has them explicitly make the decision, write the decision, one after the other, every frame for every unit. But that sounds maybe slow and bad?
Is that how you solve this situation or is there a smarter sollution?