I've been programming for 34 years now. I have never had this happen before.
I was working on a feature for the AI for units in the game. If the AI decides to move to attack an enemy, I want it to return to its original location afterwards so units don't just wander off whenever an enemy comes by.
To implement this, after a unit is downloaded to the client, I save the unit's position so it knows where to go back to. With an existing unit exactly nothing happens then. Just like I planned it.
By happenstance, a brand new unit's Y location isn't actually set to a good value when it is downloaded, (shortly after it is downloaded, some other code sets the Y value to place the new unit at the right height above the terrain.) The first time the AI wakes up and looks for something to do, it sees the change in Y and as far as it is concerned, the unit has moved. The AI then tries to move the unit back to its home location (where it actually is already) however, as part of the process of moving to its destination, it does a collision check to make sure that the destination it is moving to doesn't have any other units on it. If its destination is blocked it will move to the nearest clear location.
I had another feature on my task list which said:
Make new units find a good position to park instead of just appearing on top of one another in front of the war factory.
A bug in the AI does that for me now completely for free!
The first time a unit moved aside after creation I was completely astonished. AI is voodoo.
We were unable to retrieve our session cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.
You will not be able to post until you resolve this problem.