Quote Originally Posted by Puzz3D
When the AI uses ranged units as melee, I think this is another consequence of the AI being designed to charge into melee with units that are slightly weaker than the target unit. In STW, the AI does not make direct frontal attacks unless it can beat the unit it is attacking. If its unit is weaker, it always attempts to make an indirect attack. The AI makes attacking decisions using the unit stats in effect at that moment, so there is no doubt about having a combat advantage unless the AI is being tricked into thinking it has a combat advantage by some weighting factor. I can see several tendencies of the AI in battle which suggest a weighting is occuring, and we know that CA used weighting in the auto-resolve so they aren't above designing it into the battle AI to make things more "exciting" I suppose.
I'm sure weighting factors into a lot of the AI combat decisions. You can see some of the weighting by looking at the bar in 1vs1, and it often does not do a good job of representing the actual balance in dissimilar units, particularly when one is a missile unit. CA has a really obvious weakspot with ranged units of any type. I highly suspect their weighting is flat out wrong for melee. Pri/sec bug or the strange charge effect types of issues with the weighting are possible.

In weighting, I'm not sure how much the lethality, charge, and combat bonus parts factor in, nor discipline, morale, stamina, etc. I know fatigue plays a significant role as the bar shifts as fatigue changes. (It is a huge effect down in the "very tired" and "exhausted" range.)

Regardless of the weighting though, there is a bigger issue: Failing to use missile primary units as ranged attackers first and foremost is a major flaw. Whether or not they can win the melee is secondary. If they can win without losses by engaging in ranged combat, then why melee at all? Resorting to melee should be last resort, or used when the weighting (one that actually is correct) says they have a huge advantage.

P.S. Wouldn't surprise me if CA made a simple divisor or sign error. The game/stats have been full of these. Just for the sake of argument the melee test might have been intended as:
If missile unit melee > 2 * target unit melee, then attack
However, the actual formula might have gotten garbled so that the 2 is a divisor or on the wrong side, e.g.
If 2 * missile unit melee > target unit melee, then attack.