It is currently 16 Sep 2025, 00:27
   
Text Size

Card AI (Improvements) Requests

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Card AI (Improvements) Requests

Postby Sloth » 14 Sep 2014, 17:59

excessum wrote:The offending chunk in AiAttackController that wants to attack with 0/1s by assuming that it will pump them is indeed using ComputerUtilCombat.damageIfUnblocked(). Switching the withoutAbilities flag to true will give the "intuitive" behaviour that I wanted. The drawback, as I mentioned wayyyyyyyy back was that the AI may not choose to make the first +1 pump and make the 0/1 into an eligible attacker if it feels that the opponent's life is too high (10% rounded at 20 life if unblocked).
What about adding the parameter withoutAbilities to ComputerUtilCombat.damageIfUnblocked(). In most cases the AI needs to factor in activated abilities, for example when an attacking creature could kill the AI and absolutely needs to be blocked.

EDIT: or add a wrapper function called expectedDamageIfUnblocked().
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card AI (Improvements) Requests

Postby excessum » 15 Sep 2014, 01:51

Sloth wrote:What about adding the parameter withoutAbilities to ComputerUtilCombat.damageIfUnblocked(). In most cases the AI needs to factor in activated abilities, for example when an attacking creature could kill the AI and absolutely needs to be blocked.
EDIT: or add a wrapper function called expectedDamageIfUnblocked().
I am inclined to do nothing about it at the moment as long as the developers are aware of this little gotcha. Given that Java does not support default argument values it is going to be a pain to manually set withoutAbilities for each instance of damageIfUnblocked() if it is to be modified to add the extra variable. I am for the idea of implementing game-states as Krazy suggested to compute such things since the new sets tend to introduce new mechanics that complicates things.

Adding the wrapper certainly works but I am quite sure some developer in the future will complain about monkey-patching when giving damageIfUnblocked the extra boolean argument does the same thing...
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

Re: Card AI (Improvements) Requests

Postby lujo » 15 Sep 2014, 04:39

^ Ok, so one of you guys is saying that the AI is behaving the way it's coded so there are no errors, just an imperfect AI, the other guy is saying, yes, but from the players perspective the way the current AI is coded can seem like a legit bug.

I have a feeling the AI is a bit better now - it sometimes doesn't apply pressure with pumpers (which it used to prioritieze 100% all the time before), but at least it's developing the board instead of setting himself up for instant removal on the pumper all the time. Which is kind of much, much better overall.

I haven't seen it "attack for 0" ever, though, before or now, so I'm a bit puzzled by this concern (I understand the concern in theory, but I haven't run into the problem in forge yet).




Can I ask another thing? Are you guys sure that the way the AI decides to attack or not is actually good? It's mostly hugely conservative and rarely goes for trades, almost never for attrition, and this would be ok for a simple AI, but it makes fantasy mode pets and plant way too good at putting a break on aggro decks.


A different thing - could the draft AI possibly be improved to "hate-draft"? I've been doing a time spiral quest, and I've noticed that if I draft with the way AI decides to attack or not in mind, certain stuff becomes even better than it ussually is. In Time spiral it's Penumbra Spider - a high pick anyway, but it ussually means that if I slap one on the board the AI will rarely ever attack, and if I'm drafting something with a lot of fliers I ussually hate draft them with extreme prejudice.

The AI also underpicks various timeshifted stuff some of which just wins games - possibly because it can't play it, but leaving it in the pool is just suicide (Void in case of TSP - I'm getting about 1-3 per draft, and it's a 1st pick under any possible circumstances regardless of what you're playing because whoever does pick it up will probably kill you with it).
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby excessum » 15 Sep 2014, 05:15

lujo wrote:Can I ask another thing? Are you guys sure that the way the AI decides to attack or not is actually good? It's mostly hugely conservative and rarely goes for trades, almost never for attrition, and this would be ok for a simple AI, but it makes fantasy mode pets and plant way too good at putting a break on aggro decks.

A different thing - could the draft AI possibly be improved to "hate-draft"? I've been doing a time spiral quest, and I've noticed that if I draft with the way AI decides to attack or not in mind, certain stuff becomes even better than it ussually is. In Time spiral it's Penumbra Spider - a high pick anyway, but it ussually means that if I slap one on the board the AI will rarely ever attack, and if I'm drafting something with a lot of fliers I ussually hate draft them with extreme prejudice.

The AI also underpicks various timeshifted stuff some of which just wins games - possibly because it can't play it, but leaving it in the pool is just suicide (Void in case of TSP - I'm getting about 1-3 per draft, and it's a 1st pick under any possible circumstances regardless of what you're playing because whoever does pick it up will probably kill you with it).
The AiAttackController that decides the attack patterns is kind of bloated and I for one would not try to get anyway near it. If you play long enough, you should be able to figure out the AI's pattern for alpha-striking and propensity to trade even without looking at the source code. I am only hoping for the AI to be competent for Standard and smaller formats and so far it is doing well in that regard (minus convoke which is probably only relevant for M15 Limited).

Quest mode decks are largely mid-range or simple combos like dredge and elves so it is kind of trivial to break the system and just dodge specific hate-decks (ie. aggro vs Moat decks). I believe most people just impose their own restrictions to avoid this win-everything scenario since the AI has no defence against the combos that define Modern and larger formats.

The draft AI is based on the random deck builder and downloaded pick-lists so there is really no strategy involved.
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

Re: Card AI (Improvements) Requests

Postby tasteful » 15 Sep 2014, 17:23

AI Superman will spend all mana (with cards in hand) on Spike Drone 's ability when Spike Drone is the only creature on the field and Doubling Season isn't out. (This only happened when Spike Drone had an additional +1/+1 on it)

AI will tap land targeted by Kiora, the Crashing Wave 's +1 ability in response, even though the land can't do damage and the ability doesn't affect anything else.
tasteful
 
Posts: 65
Joined: 04 Nov 2013, 23:53
Has thanked: 3 times
Been thanked: 3 times

Re: Card AI (Improvements) Requests

Postby lujo » 16 Sep 2014, 02:32

Something about Charm Peddler isn't working correctly. The draft AI is tapping him to use his ability, but it's probably choosing targets wrong (probably because there are 2 targets to be chosen). I had Lure on one of my creatures and the AI only had Charm Peddler. It tapped him to use him, and the only sensible way to use him in that situation is to prevent the damage that would be done to him by the creature he blocked. Whatever the AI did wasn't that. I also noticed the AI using him for no visible benefit several other times.
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby lujo » 16 Sep 2014, 03:46

AI Playing Phyrexian Driver after combat which makes no sense. If it's possible to set the preferred phase for an individual card, that one should definitely be played before combat.
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby lujo » 16 Sep 2014, 06:10

Oh,good lord! AI is prioritizing every possible removal target in Masques block instead of Lin Sivvi, Defiant Hero. I've had an AI use 4 Seal of Doom on random stuff while Lin Sivvi just sat there and returned the killed guys turn after turn.

Please, whatever it takes, make it the highes possible priority target for removal individually. If a deck is running Lin Sivvi the odds of something else being a better removal target are pretty slim. This card destroyed Masques block constructed - it was actually BANNED in block constructed. For anyone who doesn't understand how ridiculous this is:

http://www.wizards.com/default.asp?x=si ... /20030617a

People actually held masques draft tourneys where if someone would open Lin Sivvi a separate booster would be opened and it replaced. I'm not even kidding.
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby lujo » 17 Sep 2014, 09:46

Timecrafting doesn't work. It's not removing time counters.
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby LtEntropy » 18 Sep 2014, 01:22

I noticed the AI gets stuck tapping and untapping Basalt Monoliths when it has two out on its side.
LtEntropy
 
Posts: 16
Joined: 08 Oct 2012, 13:11
Has thanked: 1 time
Been thanked: 2 times

Re: Card AI (Improvements) Requests

Postby excessum » 18 Sep 2014, 06:52

Agetian wrote:Ah, yes, indeed, that makes sense and I agree with your statement here. And yep, of course the initial attack itself doesn't have to be guaranteed (and may depend on a variety of strategic considerations that may happen in the higher, "strategic" layer of AI), but in the case that it does take place (and even whether it takes place or not, at large, given the current game situation) it should, so to speak, "make sense". :)
- Agetian
This is somewhat related to the original issue of WYSIWYG for AI-related functions. The predictSpellToCastInMain2() function you added is blocking the AI from using its mana in an efficient manner. I understand that you were trying to address the potential "waste all its mana pumping" issue with repeatable pumps but this is overdoing it.

The current implementation only checks that the AI can pay for the spell and forcing it to always prepare for that eventuality. A better (and probably impossible at the moment...) solution is to actually check for canPlayAi() otherwise the AI is crippled when it comes to pumping. Notable examples are the AI failing to pump to save/kill a creature in combat and failing to pump either evasive or power for an immediate win.
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

Re: Card AI (Improvements) Requests

Postby Agetian » 18 Sep 2014, 07:33

excessum wrote:The current implementation only checks that the AI can pay for the spell and forcing it to always prepare for that eventuality. A better (and probably impossible at the moment...) solution is to actually check for canPlayAi() otherwise the AI is crippled when it comes to pumping. Notable examples are the AI failing to pump to save/kill a creature in combat and failing to pump either evasive or power for an immediate win.
Yes, I noticed that too, thought I'm not sure if there's really an optimal solution to this. It looks like it's not possible to use canPlayAi() because it checks against the current phase, not the previous/future phase of choice, thus it's not really possible to predict (with the current codebase) if the spell will become playable in main 2. Moreover, even with this check in mind, if it determines that it can play a spell in main 2 using canPlayAi(), it will reserve mana and will not be able to avoid the traps you mentioned (because if it does reserve mana, then it still won't pump to save/kill a creature in combat or for an immediate win even given enough mana sources). Also, a related thought is that without reserving the mana, it can still get itself screwed over because it can continuously pump "full steam ahead", using the entire mana base if need be, and thus locking itself on casting spells.

I guess there is no optimal solution for this right now (unless you have a good enough idea - I don't really have any :)); for now, I think I'll temporarily disable reserving mana for pumps and only leave it active for moving equipment (in which case it might be a "safer bet" than with pumps... at least I hope so). If I think of anything good enough to make this work better I'll give it a shot.

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: Card AI (Improvements) Requests

Postby Agetian » 18 Sep 2014, 08:48

OK, for now, mana source reservations will not be accounted for because I switched the logic to look for an explicit specification that a certain spell ability is of low priority (via a SVar). I'll try to think of better conditions for mana reservations for pump/attach AI that I will hopefully implement with this logic in mind.

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: Card AI (Improvements) Requests

Postby lujo » 18 Sep 2014, 09:46

Do points about draft deckbuilding AI go here or somewhere else? Because the AI can't play Gush very well and severely gimps itself by having it in a draft deck (happens a lot in Masques block draft). Time and time again it bounces his islands back into its hand as soon is it has 2 tapped ones, leaving him at 1 or 2 lands, and the full Masques block draft is insanely fast and tempo oriented which makes that equal to suicide.
---

My Shandalar deck pack folder is avaliable here:Dropbox
Leave feedback on particular decks here: Google doc
Ask for instructions, give feedback and complaints here: Thread
User avatar
lujo
 
Posts: 557
Joined: 20 Nov 2013, 13:17
Has thanked: 224 times
Been thanked: 70 times

Re: Card AI (Improvements) Requests

Postby excessum » 18 Sep 2014, 13:34

Agetian wrote:OK, for now, mana source reservations will not be accounted for because I switched the logic to look for an explicit specification that a certain spell ability is of low priority (via a SVar). I'll try to think of better conditions for mana reservations for pump/attach AI that I will hopefully implement with this logic in mind.

- Agetian
I finally figured out why my stupid logic fails to stack repeatable attack pumps and fixed that bug. I added some specific code to boost the AI's propensity to do the first pump for 0 power creatures like Frozen Shade and Killer Bees and amended AiAttackController as I described in the long rambling discussion we had earlier this week.

Repeating pumps will have progressively lower chances to reduce spamming while the first few pumps are much more likely. Some of this might be overkill but the numbers can be easily tweaked if necessary.

Anyways, your change for this same issue was causing the AI to always waste its +attack pump spells when an attacker is unblocked but that is moot now...
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

PreviousNext

Return to Forge

Who is online

Users browsing this forum: No registered users and 87 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 87 users online :: 0 registered, 0 hidden and 87 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 87 guests

Login Form