Wounded and Running Away

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
User avatar
rmj
Posts: 257
Joined: July 4th, 2010, 5:21 am

Wounded and Running Away

Post by rmj »

I've been playing version 1.15.6 and the change in the AI leads wounded units to some strange and/or poor behavior.

It is common to see a wounded unit (enemy or ally) move away from the action. Nothing wrong with that, except I've seen such units keep moving until they reach the side of the game. This looks bad (in my opinion), particularly when they move deep into water; I would prefer they stay in the fray. Such behavior has significant effects on some scenarios. For example, in SotB Tirgaz the last warload I had to kill ran away (because wounded). He was faster than me; it took five extra turns to end his miserable life.

One unit ran six units south. If it had run five units south, it could have rested in a village.

A warlord was wounded and ran away rather than moving one square and using his gold to recruit three or four units.

On some turns where it seemed I would lose one or two units, two or three units ran away and I suffered less loss than expected.

Are the AI changes positive or negative? I'd problably go back to 1.14 if it wasn't for that annoying four second delay between turns that 1.15 has eliminated.
rmj
User avatar
Lord-Knightmare
Discord Moderator
Posts: 1293
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Wounded and Running Away

Post by Lord-Knightmare »

I've been playing version 1.15.6 and the change in the AI leads wounded units to some strange and/or poor behavior.
This has been observed for quite some time now. The AI starts retreating wounded units when their HP is too low, and the percentage of HP considered "low" is related to the assigned caution parameter.
Additionally, poisoning any AI unit kicks in the retreat thing too.
One possible solution might be to disable the retreating CA by modifying the side's AI. Another would be to just ramp up the aggression parameter for "fight to the death" situations.
User avatar
lhybrideur
Posts: 174
Joined: July 9th, 2019, 1:46 pm

Re: Wounded and Running Away

Post by lhybrideur »

The problem is not really that it is retreating units, which is good good, it's more what it is doing with those units.
Going to a village to heal and retreat 10 hexes from actions to rest is logical. Going to the other end of the map, 50 hexes from where it was wounded does not make any sense.
Maybe adding a village seeking coupled to a minimal and maximal number of hexes from enemy would solve this ?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 1293
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Wounded and Running Away

Post by Lord-Knightmare »

Maybe adding a village seeking coupled to a minimal and maximal number of hexes from enemy would solve this ?
Maybe you can file an issue request so that the suggested concept can be explored?
One drawback might be the AI might become desperate enough to capture villages belonging to an ally but I speculate that it is acceptable since the AI prioritsed curing the poison/healing back to full/moderate HP.
User avatar
lhybrideur
Posts: 174
Joined: July 9th, 2019, 1:46 pm

Re: Wounded and Running Away

Post by lhybrideur »

Lord-Knightmare wrote: November 23rd, 2020, 7:11 pm
Maybe adding a village seeking coupled to a minimal and maximal number of hexes from enemy would solve this ?
Maybe you can file an issue request so that the suggested concept can be explored?
One drawback might be the AI might become desperate enough to capture villages belonging to an ally but I speculate that it is acceptable since the AI prioritsed curing the poison/healing back to full/moderate HP.
Capturing an ally village to cure/heal myself does not seems like a bad move to me.
Zrevnur
Posts: 111
Joined: January 11th, 2020, 12:04 pm

Re: Wounded and Running Away

Post by Zrevnur »

Reads to me like this will significantly weaken the AI on higher difficulties.
Example: AI doesnt protect its units against them getting surrounded. So if I want it to retreat I dont surround it. Otherwise I surround it.
Example: Main threat from AI is the 'blob of doom'. If I can remove a unit from this blob merely by damaging it this will make it easier to dissolve that 'blob of doom'.
In general AI is in most scenarios only dangerous for a few consecutive turns. Removing a unit from the conflict zone during those few critical turns is not going to be helpful to the AI.

Does anybody know if the new coding is based on evidence (testing whether it makes the AI perform better overall) or hope (no such testing)?
User avatar
Pentarctagon
Project Manager
Posts: 4646
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Wounded and Running Away

Post by Pentarctagon »

From what I've seen said about it, the idea is good, but it may rely too strongly on the general caution value the AI has set for it.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Atreides
Posts: 189
Joined: March 30th, 2019, 10:38 pm
Location: The North Pole

Re: Wounded and Running Away

Post by Atreides »

I've always been impressed by how determined the AI was in fighting it out. Throwing badly damaged units at a victim often led to success in the short term. In fact I've tried to emulate it to some extent as I by nature tend to retreat any unit with even 1 hp damage (YES!) to safety. Sounds like now the AI acts like I do at my worst. :)

Of course the AI's aggressiveness offers obvious opportunities to the player. The new cautious tactic will apparently offer different opportunities to players. Since players can see the big picture they'll always be able to beat the AI no matter how well it does tactics.

Perhaps the AI could switch between the old aggressive tactics and the new cautious ones based on some larger strategic assessment. Since computers love numbers it could be something simple like an analysis of loss rates when using each tactic and switching if one tactical stance seems less efficient.
--
Any typos are the fault of my laptop keyboard!
Lonely Era (Ice Age) maintainer: https://forums.wesnoth.org/viewtopic.php?f=19&t=42630
Merry Christmas Campaign maintainer: https://forums.wesnoth.org/viewtopic.ph ... 97#p662897
vghetto
Posts: 354
Joined: November 2nd, 2019, 5:12 pm

Re: Wounded and Running Away

Post by vghetto »

I've seen complaints regarding this with my mod too.
Personally, I like the way retreat injured works, my only comment is instead of having the poisoned unit run to the edge of the map, have it try to seek out a healer or village. Or, keep it close to the other allied units, hiding behind their lines and trying to land killer blow so it can advance and automatically heal. A reverse healer MAI in a sense.
User avatar
patience_reloaded
Posts: 44
Joined: August 15th, 2019, 2:38 pm
Location: UTC+1

Re: Wounded and Running Away

Post by patience_reloaded »

vghetto, nice idea with the "landing killer blows" thing. However, what would happen if the AI's enemy spams poison units and poisons many of the AI's units at the same time? Levelling them up would not be efficient in that case, I'm afraid.
mattsc
Developer
Posts: 1179
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Wounded and Running Away

Post by mattsc »

First, sorry for taking so long to reply, I've been away for quite some time. I'm still not fully back and don't know when, or even if, that is going to happen, so any non-trivial progress might be slow.

Second, just for the record, you can still use the 1.14 AI in MP (in the computer player selection menu) and in SP (has to be done by the scenario author in this case). Also, as Lord-Knightmare points out, the caution parameter can be used to adjust the willingness of the AI to retreat, as described at AiWML.

And to answer one more question: the retreat_injured candidate action (CA) was in mainline in the Experimental AI for years, and I don't remember these issues being reported. So it has been tested, but certainly not as much as currently.

I've seen this mentioned a few times, but as far as I know, this is the first dedicated thread. The goal with this CA, as with all of them, is always to keep it as simple as possible, but this one appears to be too simple in its current implementation. I have a much more complex retreating analysis (moving toward villages or healers, making sure that only one unit goes toward each village, retreating thresholds are adjusted based on the overall situation, ...) in an add-on, but that one is even less tested than the Experimental AI was. Also, that action is intertwined with a lot of other functionality, and I don't know if I will be able to separate it out with the time I currently have for Wesnoth. Nevertheless, I will have a look and see if that is feasible.

Either way, it would be good to make the current behavior more configurable. First, the retreat threshold should be separated from the caution parameter. Second, it would probably be good to have separately configurable thresholds for retreating due to low hitpoints and being poisoned. If I can work out the retreat-toward-villages thing, that can also be made configurable (how far villages can be away; retreating only toward villages or simply away as far as possible, ...).

One of the problems with that is how to set the default values. The simplest answer would be to set them so that no retreating is done (resulting in default behavior as in 1.14), and only enable retreating when the scenario author specifically wants it.

Besides that, considerations like the overall strategy, positioning with respect to other units etc. are good ideas in principle, but in my experience they are very difficult to get right in practice. They often turn out to be unstable in a general setting. Or at least my attempts so far do. I will eventually pick up work on my add-on again and see if anything good comes out of it, but don't hold your breath...
mattsc
Developer
Posts: 1179
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Wounded and Running Away

Post by mattsc »

I finally got around to dealing with this and have created a pull request with the suggested fixes to the retreating behavior. The default behavior is different and there are now two additional AI aspects with which the retreat behavior can be customized, retreat_factor and retreat_enemy_weight. You can read their descriptions here. You can also check the comments in the pull request, as well as the commit messages of the individual commits in it for additional information on how it works now.

Let me know if anybody has additional comments. Barring any unexpected development, this will be available in the 1.15.11 release in a few weeks.
Post Reply