Who Defends?

Originally posted by MadScot
One might therefore conclude that a random element also exists when selecting defenders from a stack.
Interesting finding. :)

My own experiences suggest that when AI defends, it sends the unit with the highest defense value to the front line. That is, most of the time (if not always) I need to first finish all the infs (and then riflemen, if any) before seeing the cavs with full strength.

In the example provided by MadScot, IMHO the defense values among the units mentioned (2 for impi, 3 for pike, and 4 for musk) are fairly close to each other compared to that of the later units (3 for cav, 6 for rifle, 10 for inf), so it's difficult to see a clear logic following the AI's choice of the defending unit.

Someone care to give it a test? :goodjob:
 
Attack with Tanks and Tank Armies on a (grassland?) city

Defenders:
2 veteran infantry (4/4)
1 wounded veteran infantry (2/4) - bombardment damage
1 veteran guerilla (4/4)

First defender: veteran infantry 4/4
Second defender: veteran infantry 4/4
Third defender: veteran guerilla 4/4 - reduced to 2/4
Fourth defender: veteran infantry 2/4
Last defender: veteran guerilla 2/4

Attack on city, or possibly metro. Plains or grasslands IIRC

Defenders:
5 veteran infantry
2 regular infantry
1 veteran cavalry

First 5 defenders: veteran 4/4 infantry, 3 killed and 2 reduced to 1/4
6th & 7th defenders: regular 3/3 infantry, both killed
8th defender: veteran 4/4 cavalry
9th & 10th defenders: veteran 1/4 infantry

From these we see that a full strength unit with 6 defence (guerilla, 4hp) is preferred over a weakened (2hp) infantry unit (10 defence).
We also see that a full strength unit with 3 defence (cavalry, 4hp) is preferable to an infantry unit with only one hp.

So it's only true to say
That is, most of the time (if not always) I need to first finish all the infs (and then riflemen, if any) before seeing the cavs with full strength.
When talking about full strength units. Once the better defensive units are weakened, the cavalry etc can end up defending first.
 
Looking at the above, my guess would be that the AI choice is based on HP * Defense

I suspect that it breaks ties
1: in favor of a fortified unit
edit: (which might explain the two different choices in the veteran pike vs regular musketman scenarios posted earlier)
2: in favor of the unit with higher defense
3: in favor of the least valuable (lowest xp level) unit

since I saw (somewhere) that the "top " unit in a stack without the active unit is the one chosen to defend, I'll see if I can use that to set up some tests in a controled way and check the above guesses.
 
MadScot @

Thanks alot for your tests . Now I'll send more experienced defenders to the frontlines , while conscripts and such will be left in the cities for MP tasks .
:goodjob:
 
Madscot, did you mention in the event of hitpoint and defence tie it goes to the defender that has a weaker attack value?
 
I have taken a test assuming the top unit is the first defender. I have mostly used modded units with attack 40, defence from 1 to 10, HP 2 or 3 out of max 3 or 4.

It look like the defender are the one with greatest:

Floor(D*HP*(1+FB))

D - defence value
HP - helth point left
FB - fortify bounus, normally 0.25

In a tie I guess (based on just a few test) the one with lowest:

A*MHP

A - attack value
MHP - Max value of HP

Again tie then random. At least I have seen an unfortified 40.10.1 (3/3) unit both before and after a fortified 40.8.1 (3/3) unit.
 
Back
Top Bottom