AI passive when surrounded

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:

AI passive when surrounded

Postby doofus-01 » December 7th, 2013, 7:13 pm

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:
Bad Moon Rising(BfW 1.12 supported, but new work in BfW 1.13 only) | Trinity(BfW 1.12 only) | Archaic Era(BfW 1.12 & 1.13) | Tales of the Setting Sun(On Hold/Abandoned)
GitHub link for these projects
User avatar
Art Contributor
Posts: 3474
Joined: January 6th, 2008, 9:27 pm
Location: USA ...

Re: AI passive when surrounded

Postby mattsc » December 8th, 2013, 12:58 am

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).
Posts: 939
Joined: October 13th, 2010, 6:14 pm
Location: Canada

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 3 guests