Putting Leader self-preservation into the AI

General feedback and discussion of the game.

Moderator: Forum Moderators

User avatar
santi
Lord of Wesmere
Posts: 1320
Joined: April 6th, 2004, 12:32 pm

Putting Leader self-preservation into the AI

Post by santi »

I am just looking for info on the AI's handling of "danger" and whether there are plans to change anything.
This was tempted when playtesting a scenario, where a "must-survive" ally
(who is controlled by AI, however), is attacked and slightly wounded in his keep, then both his troops and mine rush to create a shield around him (not a prefect one), and whereas he could withdraw to our side of the shield, instead he flees to a village on the enemy's side of the shield and gets cut to pieces next round. The way to deal with this is usually to choose "passive leader". This is the only way you can be sure of what he will do.
In any event, the allied leader's behavior greatly influences balancing-I need a different strategy to get to him fast enough-.
User avatar
Bob_The_Mighty
Posts: 870
Joined: July 13th, 2006, 1:15 pm

Post by Bob_The_Mighty »

If you have not read this, then do:

http://www.wesnoth.org/wiki/AiWML

If you have, then, nvm. There's two recent threads in the ideas section of the forum about ai behaviour.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
Darth Jordius
Posts: 399
Joined: September 17th, 2007, 4:53 pm
Location: 2 miles southeast of the Middle of Nowhere

Post by Darth Jordius »

II wonder why scenarios makers don't make the must survive AI bosses passive, or maybe they just want it to be more difficult.
Quiz wrote:You are a Dwarvish Fighter. You're surly and handy with an axe. Go chop some trees.
Check out Quietus's Minotaurs!
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

I do it so the leader can move to a village to heal if necessary.

What's truly terrible is an ai-controlled non-leader that is gameloss.
CHKDSK has repaired bad sectors in CHKDSK.EXE
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

Post by DDR »

Perhaps, the AI needs to withdraw wounded units more, and one could set the 'wounded' level. So, the AI will treat a special character like it needs to be withdrawn, no matter how healthy it really is.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

joshudson wrote:What's truly terrible is an ai-controlled non-leader that is gameloss.
Indeed... I had to rewrite a scenario that had one of those because it was just unwinnable - he suicided before any of my units could even catch up to him.

Actually, what I would like to see is for the AI to treat units of a higher level than it can recruit as more valuable. So, if it can recruit Elvish Archers, and it starts the scenario with a Ranger, it tries to keep the Ranger alive, since it can't replace it if it dies.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Nebiros
Posts: 86
Joined: July 24th, 2007, 5:20 pm
Location: Charlottesville, VA, USA

Post by Nebiros »

I don't think the AI knows the meaning of "treat a unit as valuable"... does it? It's just not capable of evaluating risk to its units, let alone deciding which units are too valuable to expose to that risk, letting the expendable take hits for the valuable and balancing defensive vs. offensive play. Many humans struggle with those same issues, for that matter.

I'm not sure that marking a unit as "more valuable to keep alive" would have any effect.

Now, the AI certainly *does* consider which units are more valuable to *kill*... but it's a lot easier to plan your own attacks than to anticipate your opponent's.
User avatar
Federalist marshal
Art Contributor
Posts: 382
Joined: December 17th, 2007, 12:02 am

Post by Federalist marshal »

Nope, the AI often does make some stupid mistakes that most humans probably wouldn't make, which often costs it a good unit. One time, I was facing the AI, and it had a 1HP, poisoned thief, given either the choice of retreating (recommended), or attacking a 5HP cavalryman of mine (not recommended). Apparently the AI decided that killing my cavalryman was more important than saving that thief. I'm sure it's possible to code a bit more into the AI to alleviate us of this problem.
User avatar
DDR
Posts: 558
Joined: March 23rd, 2007, 4:56 pm
Location: Vancouver, Canada
Contact:

Post by DDR »

if HP < 30% then
run away
end if
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

DDR wrote:if HP < 30% then
run away
end if
This wouldn't do very well at all. There are many situations where the leader is in grave danger and has much higher than 30%.

Also by the time it's down to 30% it's likely the player has already trapped it between ZoCs.

Finally where does it run to? If it just goes to some nearby village then it'll likely still get hunted down there and killed....if it runs as far as possible, then it'll be difficult for it to heal and get into a situation where it can recruit again...

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
St Stux
Posts: 40
Joined: October 15th, 2007, 3:10 pm
Location: scotland

Post by St Stux »

Federalist marshal wrote:Nope, the AI often does make some stupid mistakes that most humans probably wouldn't make, which often costs it a good unit. One time, I was facing the AI, and it had a 1HP, poisoned thief, given either the choice of retreating (recommended), or attacking a 5HP cavalryman of mine (not recommended). Apparently the AI decided that killing my cavalryman was more important than saving that thief. I'm sure it's possible to code a bit more into the AI to alleviate us of this problem.
Don't know about others but i would have attacked to.
Porro ago res publica of somnium
CarpeGuitarrem
Posts: 250
Joined: November 19th, 2007, 7:46 pm
Location: One among the Fence

Post by CarpeGuitarrem »

Dave wrote:
DDR wrote:if HP < 30% then
run away
end if
This wouldn't do very well at all. There are many situations where the leader is in grave danger and has much higher than 30%.

Also by the time it's down to 30% it's likely the player has already trapped it between ZoCs.

Finally where does it run to? If it just goes to some nearby village then it'll likely still get hunted down there and killed....if it runs as far as possible, then it'll be difficult for it to heal and get into a situation where it can recruit again...

David
Yeah, that's one of the big AI problems. Computers are "1" or "0". They see absolutes. What AI tries to do is simulate human fuzzy logic. In other words, there's not an absolute right or an absolute wrong answer. Because humans are capable of understanding that almost all strategic choices have a fuzziness about them, they have a tactical advantage over computers.
Glory in Blood...Needs Programming Help!

If you have time, check out my ongoing serial story...
The Hidden: Secrets of the Future's Past
F50
Posts: 48
Joined: April 22nd, 2008, 9:59 pm

Re: Putting Leader self-preservation into the AI

Post by F50 »

I think that the problem lies not in the computer's absolutes, but the inability of humans to express the processes by which they function.

"If a must-live guy is in danger then run." I think is a good principle for the AI to go by. What must be defined:

danger: brute force the list of units that can attack must-live unit and find the best combination. Check the likelihood of death. If likelihood of death is greater than x%, then we are in danger.

run: check for places that the enemy can't get to. If none, then check for lowest enemy optimum CTK (less than x% -> 0%). Then check for allies. Use this information to decide where to move.


The definition of run needs expanding, but you get the idea.
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Putting Leader self-preservation into the AI

Post by Iris »

Image
So, what exactly do you suggest as a solution to the problem?
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
CarpeGuitarrem
Posts: 250
Joined: November 19th, 2007, 7:46 pm
Location: One among the Fence

Re: Putting Leader self-preservation into the AI

Post by CarpeGuitarrem »

F50 wrote:I think that the problem lies not in the computer's absolutes, but the inability of humans to express the processes by which they function.

"If a must-live guy is in danger then run." I think is a good principle for the AI to go by. What must be defined:

danger: brute force the list of units that can attack must-live unit and find the best combination. Check the likelihood of death. If likelihood of death is greater than x%, then we are in danger.

run: check for places that the enemy can't get to. If none, then check for lowest enemy optimum CTK (less than x% -> 0%). Then check for allies. Use this information to decide where to move.


The definition of run needs expanding, but you get the idea.
But the problem here is having to define a fuzzy idea (in danger) by statistics (the % likelihood of death), and not everyone agrees on that %. The brute-force approach could also take a while. But it's a good idea.
Glory in Blood...Needs Programming Help!

If you have time, check out my ongoing serial story...
The Hidden: Secrets of the Future's Past
Post Reply