AI consideration: enemy units chasing wounded units but then dying

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
shevegen
Posts: 603
Joined: June 3rd, 2004, 4:35 pm

AI consideration: enemy units chasing wounded units but then dying

Post by shevegen »

I am currently playing (again) Legends of the Invincibles.

I think I have noticed something that may be a small issue in regards to the current AI.

The scenario is the map where there are several knight-opponents, and we start on
the top (northern) side of the map. The simplest way is to kill the knight opponent on
the bottom right, with flying units. So I went there, with two or three wraith or so,
the undead dragon, and Letitia (or whatever was her name).

One of my wraith was a bit dumb and managed to get wounded by enemy wraiths,
to a point where an additional attack, would destroy my wraith. So the logical thing
here to do was to retreat with this unit. I should also state that there was no direct
way for my wraith to survive, as wraiths have the same speed, so even flying
away, meant the other two wraith would kill my wraith on the next turn.

Normally opponent units try to kill a wounded unit so I expected them to give chase
after the wounded wraith. Now I positioned the dragon and Letitia in a way that
made it impossible for the enemy wraith to follow. What they did instead was
interesting (to me): they would either try a longer movement around my units;
or they would instead attack e. g. the dragon. But either option they chose here,
meant that they would die on the next turn, and so it happened.

Now what was the problem here?

- I believe the AI trying to kill wounded units makes sense. This part is fine.

- However had, it seems that if there is something in the code right now,
that says "if you can not kill an injured unit, do this instead". And this,
unfortunately, also means that they do the action - but then they die the
next turn. In other words they suicide in the end.

In that case it would be better for them to regroup or reposition or
do something else.

Now I understand that AI behaviour can be difficult to implement, and
any new implementation may also be subject to being exploitable by
the player. But in this specific situation, I believe it would have helped
if the code had some routine that would check a condition such as:

"if I move around those units, yet they can still hit me, may I die?"

As part of risk assessment. This may involve checking a few more
variables e. g. how much damage Letitia and the dragon can dish
out and what not.

In this specific situation, I think it would have been better for the enemy
wraith to reposition themselves closer to the main army - or something
like that. Because the current AI behaviour kind of meant they would
suicide, even without "meaning" to suicide. I have no idea how to best
code this, but perhaps whoever understands the AI code could have a
look whether there is some routine that does funky stuff based on
chasing-after-the-wounded-enemy unit, or something similar. Perhaps
a new option could be used, aka "move far away from the enemy, but
not too far away, so you could on the next turn attack him, as right
now moving closer is too risky". There may be other solutions here of
course.

With the current AI behaviour, I think players can bait and proxy-influence
the AI into losing more units or taking more damage. I have not yet
optimised my own gameplay here, so I can not tell, but I noticed this
recently when they would chase after enemy injured units. Perhaps
others have noticed this as well; it seems to be more of a problem
when they seem to zone in on injured units. (Legend of the Invincibles
can be a bit problematic here in that some units deal insane damage
or have effects that cause problems to them such as slow or poison.
I don't know if the code checks all of that right now but it seems to me
as if it either does not check for all things, or the existing checks
may be incomplete or so. At any rate, this is mostly just an observation;
I'll try to give more feedback when I have tested this more.)

Edit: Added that my wraith could not escape because wraiths have the
same speed, so even flying away meant the wraith would be able to kill
my wraith; so the only way to protect my wraith, was to position my
own units in a zig-zag pattern so that the enemy wraiths could not
close in. This may also trigger some subroutine in the current code
that messes the units' AI up a bit.
User avatar
WarDead0
Posts: 16
Joined: September 30th, 2025, 9:38 pm
Location: AU

Re: AI consideration: enemy units chasing wounded units but then dying

Post by WarDead0 »

I think the AI is not very sophisticated, there doesn't seem to be any grouping like we would use (e.g. high HP tanks at the front with healers backing them up) - they seem to charge at the "best" target individually. Once a different unit comes in range they may attack that instead, even quite happy to suicide (this gets annoying with suiciding berserkers). So although they got to that location targetting your weakened unit, they find a new target and attack that instead. I think there are some aggression levels that can be set for scenarios that determines how suicidal they are but on many maps they are set up to attack anything at any cost. I just played LotI1 and in the last scenarios where you're in the cave system I had level 3 units suiciding on an elf assassin who killed about 10 enemies and levelled twice in the one turn!
Post Reply