Hello.

I did some pretty extensive testing back with RTW 1.1 with the AI formation file. I did tests with custom formations, toying with priorities, blocks etc... to see what happens in custom battle.

At that time I concluded that the AI formation selection algorithm looks like that, it applies successive filters, selecting a subset of formations at each step:
1) select formations that fit purpose (attack, defend...)
2) select formations with min_units and max_units constraints satisfied with the army the AI has.
3) finally select the formation with the highest priority; in case of conflicting equal priorities the 1st as it appear in the file is picked.

So that means that given the same army composition the AI will always pick the same formation.
So my most important finding in 1.1 was that ai_priority is really a priority not a probability and min/max has precedence over priority.

I cant confirm if this has changed in 1.2 but I hope so.

My testing procedure to test ai_priority influence was:
1) clear descr_formations_ai of all vanilla formations.
2) write a limited set of dumb formations that all are exactly the same, expect for some visual difference (block relative placement); this way I can see which formation the AI picks.
3) try different values for ai_priority, launch custom battles with the same army each time and see which formation is picked.

The same protocol was applied for min/max_units testing.

I'll see if I can reproduce it with 1.2. Be carefull with the formation fellow RTW scientists, the parser for descr_formations_ai is very sensitive.
(I hope my explanations are clear, English is not my mother tongue)

As a side note, there are so many obvious features missing in descr_formations_ai it's depressing : no faction/culture specific formations, no strategic hint on how to use the formation (flanking? frontal charge?...), no effect of terrain, no comparison of forces...