AI passive when surrounded
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
AI passive when surrounded
In BfW 1.11.7, the AI gets passive if it is surrounded, and won't attack when retaliation possible, no matter how feeble.
An example:
In first scenario of HttT (so, no UMC pollution), create a Yeti and give to side 2. Surround on six sides with some crappy unit with melee attack, like a bat. Leave the bats as side 1. End turn. Yeti does nothing. Next time, move one of the bats. Now the Yeti will move, then attack.
If you had used a fire dragon instead of a yeti, the AI would have used fireballs on the bats. If you had used something with ranged & melee attacks, instead of bats, the AI dragon wouldn't do anything when surrounded.
Reported in Gna: http://gna.org/bugs/index.php?21334
An example:
In first scenario of HttT (so, no UMC pollution), create a Yeti and give to side 2. Surround on six sides with some crappy unit with melee attack, like a bat. Leave the bats as side 1. End turn. Yeti does nothing. Next time, move one of the bats. Now the Yeti will move, then attack.
If you had used a fire dragon instead of a yeti, the AI would have used fireballs on the bats. If you had used something with ranged & melee attacks, instead of bats, the AI dragon wouldn't do anything when surrounded.
Reported in Gna: http://gna.org/bugs/index.php?21334
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: AI passive when surrounded
Wow, this is a good one. Apparently, it has been around since the RCA AI was introduced in Wesnoth 1.7. Well, I don't actually know that for sure, but I tested it with Wesnoth 1.8.4 in an MP game where you can choose between the old default AI and the RCA AI (which is now the default). The bug occurs with the RCA AI, but not with the old default AI.
This should be fixed in commit e7f17412378bd81d2c89c0f391d97894c2cc80d2 and should work correctly in Wesnoth 1.11.8.
And for those interested in the underlying reason, the attack rating contains a multiplicative factor "support", which is (roughly speaking) the "power" other AI units can provide to help the attacking AI unit. For a surrounded unit, no other AI unit can get there, support is zero, and thus the attack rating is zero. This meant that the unit never attacked (attack rating >0 is required for that). I changed that by only multiplying by support if the unit is not surrounded (there are already some other exceptions when it's also not done).
This should be fixed in commit e7f17412378bd81d2c89c0f391d97894c2cc80d2 and should work correctly in Wesnoth 1.11.8.
And for those interested in the underlying reason, the attack rating contains a multiplicative factor "support", which is (roughly speaking) the "power" other AI units can provide to help the attacking AI unit. For a surrounded unit, no other AI unit can get there, support is zero, and thus the attack rating is zero. This meant that the unit never attacked (attack rating >0 is required for that). I changed that by only multiplying by support if the unit is not surrounded (there are already some other exceptions when it's also not done).
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on