Just for the record (no pics, no vid... maybe later), it seems like I managed to nail a teething problem that has been bothering us for ages: AI plane collisions.
In the previous video, you could see how AI "survived" a couple of formation changes, however, there still was a catch:
You've had to issue formation changes so that there wouldn't be two aircraft switching positions side-by-side.
Because that's something the IL-2 AI was utterly unable to deal with.
The underlying reason essentially is the same that causes AI fighters to run into other friendly aircraft every now and then in a fight.
While the code used in IL-2 was quite reasonable, the possible reactions of AI aircraft in case of an imminent collision are quite limited: They can either pull up or dive down.
Avoiding collisions to the left or right is not within IL-2 AI capabilities for various reasons...
Now in order to judge whether AI has to pull up or dive down to avoid a collision, IL-2 would check the flight paths of both aircraft involved, and check whether, from each aircraft's point of view, the other aircraft would reach the impact point from above or below, when looking from each aircraft's cockpit that is.
This results in an edge case when both aircraft turn toward each other while they are banking toward the point of impact.
In that case, from both aircraft's point of view, the other aircraft respectively is approaching the virtual point of impact from above, therefore both aircraft will choose to dive down.
The simple solution to this issue was:
Whenever one aircraft detects an imminent collision with another aircraft, it decides to pull up or dive down,
and then forcibly issues the opposite command to the other aircraft. This other aircraft will follow the command issued by the first aircraft that detected the imminent collision and then reset that command enforcement (which will be renewed by the first aircraft in every tick, until the collision has been avoided).
Works a treat so far.
Mike