AI Improvement

All about getting the AI less baka...
Saint
Posts: 434
Joined: Sat Jan 09, 2010 4:57 pm
Location: Netherlands

Re: AI sometimes a bit retarted

Post by Saint »

Hmmm well i'm glad it's on top priority, it might be a weird suggestion but you could calculate an "if" factor in, like small pieces of code checking in order if they should be applied, like does it have flying if yes go left if no go right it has this go left or right and so on so on (making it sound as uncomplicated as possible) but well i'll break my brain over it myself aswell maybe i can think of a usefull suggestion because i think you'll mostlike have thought of something like this before :P
"The bird of the Hermes is my name, eating my wings to make me tame." - Ripley Scrowle, Elias Ashmole's Theatrum Chemicum Britannicum - 1652
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: AI sometimes a bit retarted

Post by Psyringe »

The problem is this: With specific "if" clauses, we'd produce a lot of code: one check for flying (which also needs to take "reach" into account), on for shadow (which also needs to take "reachshadow" into account), one for fear (which also needs to check whether the opponent has black or artifact creatures), several checks for landwalk abilities, etc. This would make the code unwieldy, hard to maintain, and very difficult to improve later (since any changes we make to evasion would have to be transferred to, and checked for, dozens of places in the code which all deal with evasion).

Therefore (imho) we should look for a more generic algorithm, which can work on a list of evasion abilities and their counter-abilities. However, finding such an algorithm is not easy, since these abilities can be combined and may be influenced by other effects. Also, other factors influence the decision whether or not to attack with a given creature as well, for example power/toughness comparisons, abilities like Rampage or Bushido, Trample, Deathtouch, etc.

Altogether this creates a very complex scenario for which it's difficult to devise an algorithm that's "smart" enough to take the right decision in most cases, while still being efficient enough to work on PSP hardware. I *do* think that improvements to the current state of affairs are possible though, however we'd probably need to spend a lot of time on improving the algorithm. Any help on that would be greatly appreciated. :)
bcdiscman
Posts: 222
Joined: Sat Jul 18, 2009 4:40 am
Location: Indiana - USA

Re: AI sometimes a bit retarted

Post by bcdiscman »

Just an added aside, I noticed that if I attack with two creatures (both of which with enough power to kill the AI) and the AI has more than two creatures it almost always blocks the 1st and lets the 2nd one through -- killing it self. This has happened with several of my decks against multiple AI decks many dozen times.
ImageImageImageImage
BCdiscman
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: AI sometimes a bit retarted

Post by Psyringe »

Yes, I noticed that too, but wasn't sure if it happened regularly. Thanks for the confirmation.

I think we introduced this problem when we fixed the AI memory (so that the AI would mass-block dangerous attackers again). I suspect that the AI now thinks "This attacker is dangerous, I have to block it at all costs", and forgets to check whether the remaining attackers would kill it if it does so.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: AI sometimes a bit retarted

Post by wololo »

Psyringe wrote: I think we introduced this problem when we fixed the AI memory (so that the AI would mass-block dangerous attackers again). I suspect that the AI now thinks "This attacker is dangerous, I have to block it at all costs", and forgets to check whether the remaining attackers would kill it if it does so.
This is exactly what happens, and it is not entirely new. It is true that the AI felt less dumb in that regard when its memory was broken though.
A good countermeasure in that specific case would be to add high priority rules for the AI to protect its own life before thinking of destroying a dangerous attacker.

For those with a background in AI: Minmax is the best solution for games such as MTG, but is not doable in our case considering the processing power of the PSP. A good MTG freeware with Minmax is Deckbot (the game is unfortunately hard to find because they don't want Wotc to threaten them), but the AI can take up to a few minutes for each move on a high end computer. The AI rarely does mistakes in Deckbot, and it doesn't need to be taught how to use new cards.
Duels of the planeswalkers on the XBOx 360 also uses minmax, but from what I've been told it is waaay less impressive than the one in deckbot.
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: AI sometimes a bit retarted

Post by Szei »

Why does the AI sometimes not choose to block a creature at all though even if it has more available blockers?
Image
Saint
Posts: 434
Joined: Sat Jan 09, 2010 4:57 pm
Location: Netherlands

Re: AI sometimes a bit retarted

Post by Saint »

@wolo Well i think the Minmax system really is to complicated for an psp, maybe if you overclock it like till the max it might reach a point were it can form the calculations but then again i don't think its open source so we cant fondle with it ourselfs. The deckbot thing does sound good, searched for it for a while (private networks and such) no luck... might end up having to build our own fully functioning AI system... wich will be a drag lol but oh well. But as for now sometimes the AI owns your *** but at some point your playing against a retarted 3 yo... wich is, well, not good lol.

@psy With the "if" method i meant ofcourse first bundeling a few things were possible, you will end up with lots of code that's a known fact but not to weird with the 1600+ (not even counting the a,b,c,d etc. underneith them) rules magic has, but it would be lightweight since it'lll only ask for one part of the code or even part of a file were the code is written, and just let it trigger from what's written in the card ID specs.
"The bird of the Hermes is my name, eating my wings to make me tame." - Ripley Scrowle, Elias Ashmole's Theatrum Chemicum Britannicum - 1652
seguuro
Posts: 18
Joined: Sat Jan 02, 2010 12:18 pm

Re: AI Improvement

Post by seguuro »

If the player's and the AI's creatures have comparable stats, it seems like the AI is unable to take advantage of its creatures' shadow/flying/protection from *insert color here* or abilities alike. For example, AI often won't attack with its flying 2/2 when I have a non-flying, first strike 2/1, probably because it recognizes it as a threat just by looking at sheer numbers. Am I wrong?
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: AI Improvement

Post by Szei »

That is correct. The AI does not recognize what it's creature's abilities actually mean so it judges based on power, toughness, and the dangerousness of certain creatures based on past encounters.
Image
efsixx
Posts: 7
Joined: Thu Jan 07, 2010 12:56 pm
Location: Philippines

Re: AI Improvement

Post by efsixx »

I was thinking how the AI could use dual lands. I believe that it is difficult
for the AI to choose due to infinite possibilities that could come up.

Well, I came upon an idea to eliminate the choice options of the dual lands.

For example, the "Plateau" dual land card which can produce either {W} or {R}
but instead of choosing {W} or {R} it will produce a "pink mana"
that can be used to cast a cost of {W} or {R} or {colorless mana}.

Another example I thought of is the creature "Birds of Paradise", when tapped
for its ability, will automatically produce a single "rainbow mana" which
can be used to cast a cost of any color or colorless mana.

I am not sure if this is a good idea since I am not a programmer myself.

Anyway, Wagic is already a great game, I really like playing it.
Many thanks to wololo and its dev team. :D
Locked