Ok, what I would like to see is some thematic rules for AI targetting. Let me focus on spellcasting targeting first, since I would assume that meele targeting is mostly a subset of this (meele-attacks might be considered similar to low-fatigue short-range damaging spells doing ordinary damage).
The basic problem would be whether to choose a spell or a target first. How does the AI resolve that now? It would be helpful to built on top of the existing system...
Addressing the problem right now, I would propose as a base for discussion to order all enemies by the threat they propose, then choosing an appropriate spell for each enemy (or the first ten threats) and then considering the product of threat rating and estimated spell-effectiveness.
Ordering enemies by the threat they pose:
- Visibility: This should be the major factor of target selection.
I can hardly estimate the threat of something that I cannot see; it also rewards clever tactical placement of units and it naturally encourages targeting of units that are closer to the caster (thus addressing the original target-retreating-units issue).
Determining visibility:
- Sum of Sizes of units on the direct line of sight. The size of the target and the unit doing the targeting should affect the values added to this sum, i.e. a couple of hoburgs between two dragons should not count very much.
- Auras and Mists should affect visibility. A unit with a fire shield is easier to spot, while a unit with a fire shield hides units behind it much more easily. Maybe each such aura-effect should simply increase size to the sum-of-sizes-calculation.
- Flight: Unit that actually were in air during that round should be easier to spot and should not obstruct sight at all. A flying unit should have better sight if it is considered flying during that (or the Last) round.
- Deathcount:The number of units either killed or made fleeing by a creature. I think that this is indeed the major factor which makes me perceive a unit as dangerous. The number of killed units seems to be available anyway, so it should be used here as well.
It might be questionable how a unit knows how many units another one has killed so far, but we need some simple value to determine strength, and this one seems simple and appropriate, sind it naturally encompasses specific circumstances. Strength, for example, is even harder to spot and not a really good measure!
I also like that the strength of the defeated number shall play no role here: Of course, some SC's battling each other will have a smaller bodycount and hence less priority than an elephant trampling hordes of hoburgs, but I feel that the elephant would righteously look more dreadful in such a case to me!
Of course, this will also make havoc-spreading mages to be of top priority, but this is ok, since large-area spell effects are easy to spot and easy to recognize as lethal if they indeed are. However I assume again that poor visibiliy will usually protect these mages from always ending up as the choosen target.
The deathblow might however be dealt by simple milita man which was just standing next to his worhsipped pretender-dragon helping him. Thus instead of a bodycount, I would rather prefer the sum of damage dealt and moral loss inflicted.
- Command: Of course, the tactical command should be a major factor. If a player sets targeting to 'flyers', those should gain a big increase in their threat rating, but it should not override visibility completely (if there is a single flyer somewhere in the back, it should not be the automatic target!)
- Distribution and Friendly Fire: Each friendly unit that has already targetted that creature should decrease its priority somewhat. Any friendly unit that already caused some damage within that round should correspond to a somewhat higher decrease in priority.
- Fear & Berserking: Fear & Berserkers should also be a direct factor in estimating the threat of a unit, however this is dangerous, since the number of units sent fleeing is already counted and likely much higher for units having fear. Nevertheless, a rampaging or fear spreading unit should appear a bit more menacing than another unit which has achieved the same bodycount, although the non-berserker or non-fear-spreade is actually much stronger game-wise, but normal killing simply doesnt get as much attention...
- Steadiness: Units should continue to pursue their current foe instead of indecisevly moving between targets. So previouly targeted unit should receive a slight increase in priority. This shall also cause units to pursue fleeing units somewhat, but it should be less than the visibility loss of several squares, so that fleeing units are not pursued if there are equally dangerous units closer by than a turn's move. This might also help light cav to wreak more havoc once it penetrated the main battle lines...
- Experience: As usual, the threat list should be randomized a bit for several reasons. However, an experienced unit should judge the threat of an enemy much better than a novice, hence the random-range should decrease with the number of experience points.
So, that are my naive ideas how I would address the target choosing-problem. I have no idea whether that would indeed lead to sensible system, or whether it might cause units to indecisevly move back and forward. If have also no ideas about the specific weights one should attach to each factor. Comments!