Ai blocking/attacking, wasting damagers

All about getting the AI less baka...
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: unhappy ai

Post by wololo »

I don't fully agree.
I think we should adjust the values, but saying that the AI will NEVER cast a damager if it cannot kill at once is a bit over the top.
Imagine the AI has Kamahl pit fighter, and a lightning bolt. and you have a 6/6.
Right now, the AI has a few chances to cast the lightning bolt (or Kamahl's ability) on your 6/6, and then will realize it can kill your creature with its remaining card (either kamahl or the lightning bolt), and will do it (that's a 100% if it can kill).

With your algorithm, the AI will never get the opportunity to do that.

I agree that the current values are not good, but lowering the chances to plain 0 if you cannot kill at once is not a good move IMO.

At the very least, it will make the AI way to predicatable, you will know it will never use a lightning bolt, or kamahl pit fighter against a creature that has more than 3 toughness... I know most of the time the randomness makes the AI look a bit silly, but personally I'm ready to pay that price for the "once in a lifetime" impressive combo it will come up with.

So, I agree that we should change the values, but 0 is not acceptable. Keep in mind the need for randomness, if you don't want the AI to be too easy to guess.

Also I think if the damage is equal to the target toughness, the probability of casting should be extremely close to 100. Not necessarily 100, so I think your rule makes sense ( 59% at best)

Note: In the future, I want these values to be configurable by AI deck creators.
muaddib
Posts: 38
Joined: Fri Jun 25, 2010 9:28 am
Location: Russia

Re: unhappy ai

Post by muaddib »

Well, you made for AI heuristic algorithm. It's better to make iterates through variants casting spell, and then see minimum summary attack of opponent creatures. It's minimum will better way to play. But it is iterates for one turn, desirable iterates through variants for few turns forward.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: unhappy ai

Post by wololo »

If you can please try to create a class that inherits from AIPlayer, and try to tweak the AI. It seems like you have lots of good ideas so the best would be if you could experiment with it. I'm willing to hear ideas, but it's of course even better if you provide the implementation you'd like to see.
Yorien
Posts: 33
Joined: Tue Feb 02, 2010 10:59 pm

Re: unhappy ai

Post by Yorien »

Yorien says:
wololo wrote:I don't fully agree.
I think we should adjust the values, but saying that the AI will NEVER cast a damager if it cannot kill at once is a bit over the top.
Imagine the AI has Kamahl pit fighter, and a lightning bolt. and you have a 6/6.
Right now, the AI has a few chances to cast the lightning bolt (or Kamahl's ability) on your 6/6, and then will realize it can kill your creature with its remaining card (either kamahl or the lightning bolt), and will do it (that's a 100% if it can kill).

With your algorithm, the AI will never get the opportunity to do that.

I agree that the current values are not good, but lowering the chances to plain 0 if you cannot kill at once is not a good move IMO.

At the very least, it will make the AI way to predicatable, you will know it will never use a lightning bolt, or kamahl pit fighter against a creature that has more than 3 toughness... I know most of the time the randomness makes the AI look a bit silly, but personally I'm ready to pay that price for the "once in a lifetime" impressive combo it will come up with.

So, I agree that we should change the values, but 0 is not acceptable. Keep in mind the need for randomness, if you don't want the AI to be too easy to guess.

Also I think if the damage is equal to the target toughness, the probability of casting should be extremely close to 100. Not necessarily 100, so I think your rule makes sense ( 59% at best)

Note: In the future, I want these values to be configurable by AI deck creators.
I'd side with muaddib here. Simple logic tells us humans casting a LB (3 damage) on a 6/6 creature is a waste of a spell card and red mana, always. There's no randomness here. You "know" popping your LB on the Kamahl it's a bad move unless you have another plan afterwards to make that initial LB useful.

Unless the player is new into magic (so he/she's more prone to making mistakes), an experienced player will NEVER cast a spell he/she's not expecting something in return.

- - -

Thus I believe there must not be randomness in that particular move and in some others, Magic is like a very big chess game, with many more rules, but still based on logic.

In a chess game if white plays:

1. e4

... black will most probably play ... e5, more rarely d5 (here's some randomness), or, (way more rarely) f5 or Ng6. But all of them will be planned strategies, black will never play some kind of weird move just because it hit the 0.01% randomness chance for a "weirdest move ever".

- - -

So, maybe wagic's AI should behave more like chess programs where AI "thinks" a lot of moves but in the end it only keeps the two or three more interesting "thought lines".

So, while Wagic can initially think on casting LB on the Kamahl... once it "sees" the benefits of that move are zero (mana lost = R, cards lost = 1, advantages gained = none), it should move to other more interesting lines ("hey, if I must cast that LB, I'll cast it on the enemy player, at least in this line I get a 3 damage benefit" or "I'll hold the spell for post combat Main Phase, so maybe then the Kamahl is damaged to 6/3 and the LB can finish it off")
muaddib
Posts: 38
Joined: Fri Jun 25, 2010 9:28 am
Location: Russia

Re: unhappy ai

Post by muaddib »

exactly Yorien, that's what I wanted to say.
muaddib
Posts: 38
Joined: Fri Jun 25, 2010 9:28 am
Location: Russia

Re: unhappy ai

Post by muaddib »

If I have free time, I will try install wagic programming enviroment and will try that to says wololo.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: unhappy ai

Post by wololo »

Yorien wrote:
So, maybe wagic's AI should behave more like chess programs where AI "thinks" a lot of moves but in the end it only keeps the two or three more interesting "thought lines".
This is already what the AI does, to some very limited extent (we only look "one move" ahead, and we're not even sure of what will really happen), and this is what we are discussing right now. Muaddib is suggesting that casting Lightning bolt on a 6/6 creature should be considered as a purely bad move. I say it should happen once in a while, be considered as a good move with low confidence.
So, while Wagic can initially think on casting LB on the Kamahl... once it "sees" the benefits of that move are zero (mana lost = R, cards lost = 1, advantages gained = none), it should move to other more interesting lines ("hey, if I must cast that LB, I'll cast it on the enemy player, at least in this line I get a 3 damage benefit" or "I'll hold the spell for post combat Main Phase, so maybe then the Kamahl is damaged to 6/3 and the LB can finish it off")
Two things:
1) There was a strong misunderstanding here. I wasn't saying casting LB on the Kahmal. I was saying using Both a LB AND Kamahl to deal a total of 6 damages in one turn to a 6/6 creature, sorry if I wasn't clear on that. I don't know why an experienced Magic player wouldn't use several damage cards in a row to kill one creature, if this is needed. If you have 2 lightning bolts, or a lightning Bolt + Kamahl, you can kill a 6/6, that's my point. I agree this does not happen very often, but I don't understand why we would want to completely remove this possibility. I still believe that knowing the AI will never cast a lightning bolt if it knows it can't "one shot kill" will be pretty obvious and fairly boring to most players. Again, we can tweak the values, but making this possibility entirely 0 sounds extremely weird to me. From a pure logical point of view, reducing the life of an enemy creature should not be considered as a "wrong" move, which is what "0 chances of doing it" means to the computer.

2) Chess AI is fairly simple to code nowadays with minmax. Computing the tree of possibles in Chess is fairly easy. In Magic this is another problem. Zethfox tried Deckbot the other day, and in some fairly simple situations, it requires up to 2 minutes for the AI to make one move. This is on a fairly modern computer, so you could expect this time to become 20 minutes on a PSP. We're talking of one move here, such as tapping a land. Are you ready to play turns that take several hours? I don't think so.

Edit: I know it feels like the AI is doing some very stupid stuff on a regular basis. This is why I'm asking you guys to give it a try instead of "just" suggesting ideas. I'm the first one to think that minmax was a good idea, and I'm the first one who hit walls when I tried to implement it. There are lots of performance issues when you try to code such a complex game on such a lowend platform, I gave up on minmax a while ago, but it doesn't mean I prevent anybody from trying. I replaced minmax with a system of "efficiency", were the AI judges which cards/abilities it should play in priority, based on many heuristics. These heuristics might not all be good and can definitely be improved, but trust me when I say that people who touched the AI code made their best to tweak the values correctly.
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: unhappy ai

Post by wololo »

Sorry for double post, here is what I'm talking about:

Imagine the AI has Kamahl, Pit fighter in play (tap to deal 3 damges to target creature), and a lightning bolt in its hand. I assume it has the mana to play the bolt
You (AI's enemy) have a craw wurm in play (6/4)

With Muaddib's algorithm, the AI looks at its cards/abilities:
Kamahl can do 3 damages to the wurm, but the wurm has 4 toughness, so the AI discards the possibility (0 chances of doing this move)
The lightning bolt can do 3 damages to the wurm, but the wurm has 4 toughness, so the AI discards the possibility (0 chances of doing this move), for the same reason as above (if the toughness of the target is higher than the damage, discard the possibility, in Muaddib's algorithm)
Nothing happens. Next turn, the wurm attacks, and the AI loses 6 life, or Kamahl.

With My algorithm:
Kamahl can do 3 damages to the wurm, and the wurm has 4 toughness, so that's 50 * 3 / 4 = 37.5% of chances of doing the damage
Same as above for the lightning bolt.
Imagine we cast the lightning bolt on the wurm.
The wurm now has 1 toughness. Kamhal does 3 damage : the AI computes this as 100% chance of acting in my algorithm.
AI killed the wurm.

The issue in my algorithm is that the AI will cast the LB independently of knowing if it can further damage the Wurm with Kamahl. This is when you see all these "missed" attempts, with the AI casting such a card on a big creature.
I still think my algorithm makes some sense, and the value just needs to be tweaked.
Most decks that have a lightning bolt are made to do indirect damage, and statistically, it makes sense that if the AI has a lightning bolt, it probably has some other damager available...
rawsugar
Posts: 228
Joined: Wed Aug 11, 2010 11:05 am

Re: unhappy ai

Post by rawsugar »

I think we get your point wololo (btw i googled that:P) but the fact is that situations where AI wastes spells/abilities is 99% and managing to do what you talk of is 1%.
the sort of situation where the randomness would be useful is rare whereas AI wasting spells is fairly common, changiong would be a huge improvement.

Im not sure Ive ever seen AI kill witha second spell and ive playerd many thousand games by now. what i have seen is ai reducing my creature so i cant block without losing my creature. How ever if AI cast only if able to kill i would block and then AI would kill me with spell in 2nd main phase which is much closer to what a smart player would do.

and btw i get your point w suggestions are cheap but his sounds like it would be really simple to change.
Last edited by rawsugar on Tue Mar 01, 2011 2:44 pm, edited 1 time in total.
muaddib
Posts: 38
Joined: Fri Jun 25, 2010 9:28 am
Location: Russia

Re: unhappy ai

Post by muaddib »

It's better to make iterates through variants casting spell, and then see minimum summary attack of opponent creatures.
You may iterates through variants damaging spell for one turn ahead, that find most aggresive creature. For example Goblin King. Or own creature with enchanment, that do damage.
I don't think it would be slow.
Locked