How about promotion check for AI?
Moderator: Forum Moderators
-
- Posts: 22
- Joined: July 11th, 2010, 8:01 am
How about promotion check for AI?
Once I saw a foolish death of friendly unit close to promotion.
It has low HP, XP only one point below promotion, and was close to 3 enemy units. Instead of attacking one of them with lowest risk of death (range attack against weak with this type of attack unit) and getting promoted, it attacked strong unit and perished.
I think it wouldn't be hard to add 'promotion check' to code.
It has low HP, XP only one point below promotion, and was close to 3 enemy units. Instead of attacking one of them with lowest risk of death (range attack against weak with this type of attack unit) and getting promoted, it attacked strong unit and perished.
I think it wouldn't be hard to add 'promotion check' to code.
Re: How about promotion check for AI?
How much AI values his own unit compared to dealing damage to enemy is different in different scenarios. Sometimes AI has 0 value of its own unit and always tries to maximize damage, which might be the case of attacking and dying over attacking and leveling up.
Lamps and Megarace http://forums.wesnoth.org/viewtopic.php?f=13&t=30708
-
- Posts: 22
- Joined: July 11th, 2010, 8:01 am
Re: How about promotion check for AI?
I found this strange, because imho leveled up unit eventually would deal more damage to enemy.
Re: How about promotion check for AI?
Guess the AI doesnt think very far ahead when it comes to planning damage. It would make sense since the possible options on a 20x20 map with 30 units are rather high in even 2 turn perspective.
Lamps and Megarace http://forums.wesnoth.org/viewtopic.php?f=13&t=30708
Re: How about promotion check for AI?
The AI already tries to consider promotions. see src/ai/default/attack.cpp , note how avg_losses is computed
Possible variants :
1) There are bugs in existing code which cause the situations like 'low hp unit which can advance' to be undervalued.
2) There are bugs in existing code which cause the AI to do attacks in suboptimal order (e.g. killing the enemy unit directly when there was a chance to farm it for XP before)
3) aggression was set too high, distorting the main attack evaluation formula
(note, how, with increasing aggression>0 (btw, default is 0.4), AI cares less and less about its own losses and promotions, trying to maximize CtK. )
Possible variants :
1) There are bugs in existing code which cause the situations like 'low hp unit which can advance' to be undervalued.
2) There are bugs in existing code which cause the AI to do attacks in suboptimal order (e.g. killing the enemy unit directly when there was a chance to farm it for XP before)
3) aggression was set too high, distorting the main attack evaluation formula
Code: Select all
double value = chance_to_kill*target_value - avg_losses*(1.0-aggression);
-
- Posts: 22
- Joined: July 11th, 2010, 8:01 am
Re: How about promotion check for AI?
Thanks for your time and the explanations. I found savegame for the case I'm talking about, but can't reproduce the unfortunate unit end now (hmmm... I could swear I reproduced it once before).
The units in question are the Elf Scout at 5,16, and two Goblin Knights and Orcish Assassin next to Scout. The Elf Scout can attack either of Goblin Knights by ranged attack and get promoted safely (they don't have ranged attack), but it attacks Assassin, what is risky - and he don't have any chance to kill the Assassin that way.
The units in question are the Elf Scout at 5,16, and two Goblin Knights and Orcish Assassin next to Scout. The Elf Scout can attack either of Goblin Knights by ranged attack and get promoted safely (they don't have ranged attack), but it attacks Assassin, what is risky - and he don't have any chance to kill the Assassin that way.
- Attachments
-
- logic.gz
- Savegame to topic
- (73.46 KiB) Downloaded 234 times
Re: How about promotion check for AI?
thanks for the save, it would allow me to check this out.