It is currently 28 Aug 2025, 14:27
   
Text Size

Card AI (Improvements) Requests

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

Re: Card AI (Improvements) Requests

Postby Agetian » 08 Dec 2012, 11:17

Here are a couple AI-related observations:

1) Computer had a Roc of Kher Ridges, and attacked with it every turn without fail despite the fact that I always had a Wall of Air, and simply blocked it benignly every time. Usually the AI is fairly good about not attacking when it would be pointless, so I found this odd.
2) Computer had a Frozen Shade (actually more than 1), and tons of black mana, but never pumped any up to attack with despite the fact that he could've overwhelmed my defenses that way (and probably won). I didn't try aiming a Lightning Bolt at one or anything, so I don't know if he would've pumped one in response to that. One cause for this might be that I had a Pirate Ship, which is 4/3, and it thought it was saving them for defense, but the thing is he didn't have any islands so I couldn't have attacked with it anyway. Not totally sure.
3) Computer played a spell with a cost of 2, which got countered by my Counterbalance revealing a card with CMC also of 2. Thing is, after that the computer proceeded to play *another* spell with CMC 2, even though any human would know it would automatically be countered. Not sure if this would be easy to predict for the AI though. :\

- 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 cc-drake » 08 Dec 2012, 16:31

AI makes Chimeric Sphere first 2/1, then makes it 3/2 and attacks.
cc-drake
 
Posts: 570
Joined: 14 Aug 2010, 07:15
Has thanked: 29 times
Been thanked: 6 times

Re: Card AI (Improvements) Requests

Postby Agetian » 09 Dec 2012, 07:38

I have a couple ideas about the AI and I might eventually (after I'm done with sideboarding) get to some experimentation in this regard as well, but I wanted to post my considerations and ask if it'd be possible and/or viable to do this:

1) I really love the new attacking/blocking AI, but there's one thing that still prevents the AI from winning or at least taking advantage in many circumstances in which it potentially could have at least tried to win. The way I see it, the AI is probably a bit too conservative in trading creatures early and it will allow itself to get beaten down pretty badly until it starts trading even creatures (or even trading a worthless creature for a worthy creature with the same P/T) and actually blocking to get rid of my creatures. This is commonly an issue because, for example, if I have a 2/2 with no abilities and the AI has 2/2 with no abilities, I will attack with my 2/2 and I can be fairly sure that the AI won't block. Then, the AI will attack me back dealing two damage. However, depending on my deck, all of a sudden, on turn 4 or 5, this 2/2 can become pretty dangerous if I have a set of enchantments / equipments or some sort of a combo synergy going on, so maybe getting rid of that 2/2 earlier in the game and "cleaning up the table" would have been a better idea. I know that it's probably not as universally true in all circumstances, but it seems like some more aggressive blocking / cleaning the table in case the human attacks earlier on could have led to some positional advantage on the behalf of the AI. If worst came to worst, at least it would have kept the human under the threat of losing creatures, so that the "always attack, the AI won't block anyway" attitude could not be abused (cause at the moment, I feel pretty safe in attacking the AI early and I feel pretty safe about not losing the creature - I mean, I even tried attacking with 1/1 Llanowar Elves when the AI had a 1/1 Merfolk of the Pearl Trident, and it didn't choose to block even though it could have made me lose a valuable creature). Also, the AI could have saved a bit more life earlier on if it traded more aggressively, thus opening up possibilities of using that life for some costs, or at least living longer (because otherwise the AI is usually beaten down enough by the time it starts trading that it gets itself under the risk of losing the game to a single powerful enough spell like Lava Axe or something with an X in it).

Here's a simple example of a trading implementation (probably highly inoptimal and just an example of what the general idea might be), in the form of a patch to ComputerUtilBlock:

Code: Select all
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -32,6 +32,7 @@
 import forge.card.cardfactory.CardFactoryUtil;
 import forge.game.phase.Combat;
 import forge.game.phase.CombatUtil;
+import forge.game.zone.ZoneType;
 
 
 /**
@@ -40,7 +41,7 @@
  * </p>
  *
  * @author Forge
- * @version $Id$
+ * @version $Id: ComputerUtilBlock.java 18403 2012-11-26 15:16:56Z Chris H. $
  */
 public class ComputerUtilBlock {
     /** Constant <code>attackers</code>. */
@@ -544,12 +545,21 @@
             killingBlockers = ComputerUtilBlock.getKillingBlockers(attacker,
                     ComputerUtilBlock.getPossibleBlockers(attacker, ComputerUtilBlock.getBlockersLeft(), combat, true),
                     combat);
-            if ((killingBlockers.size() > 0) && CombatUtil.lifeInDanger(ai, combat)) {
+            if (killingBlockers.size() > 0) {
                 final Card blocker = CardFactoryUtil.getWorstCreatureAI(killingBlockers);
+                int worthAttacker = CardFactoryUtil.evaluateCreature(attacker);
+                int worthBlocker = CardFactoryUtil.evaluateCreature(blocker);
+                List<Card> aiCreatures = CardLists.filter(ai.getZone(ZoneType.Battlefield).getCards(), CardPredicates.isType("Creature"));         
+                List<Card> oppCreatures = CardLists.filter(combat.getAttackingPlayer().getZone(ZoneType.Battlefield).getCards(), CardPredicates.isType("Creature"));
+
+                if (worthBlocker < worthAttacker && !blocker.isFaceDown() ||
+                        (worthBlocker == worthAttacker && aiCreatures.size() > oppCreatures.size() && !blocker.isFaceDown()) ||
+                        CombatUtil.lifeInDanger(ai, combat)) {
                 combat.addBlocker(attacker, blocker);
                 currentAttackers.remove(attacker);
             }
         }
+        }
         ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
         return combat;
     }
@@ -809,11 +819,9 @@
         // == 1. choose best blocks first ==
         combat = ComputerUtilBlock.makeGoodBlocks(combat);
         combat = ComputerUtilBlock.makeGangBlocks(ai, combat);
-        if (CombatUtil.lifeInDanger(ai, combat)) {
             combat = ComputerUtilBlock.makeTradeBlocks(ai, combat); // choose
                                                                 // necessary
                                                                 // trade blocks
-        }
         // if life is in danger
         if (CombatUtil.lifeInDanger(ai, combat)) {
             combat = ComputerUtilBlock.makeChumpBlocks(ai, combat); // choose
This is not for real implementation, and probably has a lot of downsides to it, but just something like a "mock code snippet" to generally consider, maybe. :) I assume that something similar could be done for the attacking routine as well, so that the AI will attack, e.g., with its 2/2 if I have a 3/2 flying in play, trying to either trade with me or at least deal 2 damage because it won't be able to block my flyer next turn anyway.

2) The AI seems really eager to use its damage-dealing instants on the first creature that it sees, but maybe the AI can be tweaked a bit to wait out at least for a couple turns in case whatever it wants to use it on is really weak so that it can see if something nastier shows up? The current behavior can also be easily abused, because I'll commonly play some weak 1/1 creature just to see if the AI has a Lightning Bolt or a Dark Banishing card up his sleeve and then play a 3/3 mountainwalk or something to that effect afterwards. I know it's probably not as easy to implement, but it might be worth considering...

At any rate, that all being said, I might eventually work on the AI "personalities" feature which will basically allow you to choose a more aggressive/defensive/etc. opponent, but this is likely to take me quite a while to get to.

Thank you very much for your hard work on the AI!

- 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 krevett » 09 Dec 2012, 19:11

AI respond to Counterbalance trigger by casting all instant he has in his hand... Pretty silly when they are all of the same cmc! Anyway AI should always wait for the trigger to resolve before casting another spell.
Last edited by krevett on 11 Dec 2012, 11:36, edited 1 time in total.
krevett
 
Posts: 109
Joined: 21 Feb 2012, 22:24
Location: France
Has thanked: 18 times
Been thanked: 9 times

Re: Card AI (Improvements) Requests

Postby Andy9973 » 09 Dec 2012, 19:50

On turn 2, AI cast Pacifism on my Mold Adder. The next turn it played Afterlife on it.
Andy9973
 
Posts: 103
Joined: 30 Apr 2012, 08:35
Has thanked: 47 times
Been thanked: 5 times

Re: Card AI (Improvements) Requests

Postby friarsol » 11 Dec 2012, 02:04

The AI should block more proactively with creatures Enchanted By Pattern of Rebirth (do we have an SVar for that already? Maybe the SacMe SVar?)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card AI (Improvements) Requests

Postby Sloth » 11 Dec 2012, 09:40

Agetian wrote:And one more thing: the "zero Fireball" AI bug is still in - the AI will always just tap one red mana to cast Fireball and cast it with X=0, choosing no targets, I assume.
Fireball should be fixed now.

Agetian wrote:I have a couple ideas about the AI and I might eventually (after I'm done with sideboarding) get to some experimentation in this regard as well, but I wanted to post my considerations and ask if it'd be possible and/or viable to do this:

1) ...
In ComputerUtilBlock there is an int variable called diff. In the makeGoodBlocks function (and some other places) both attacker and blocker are evaluated with evaluateCreature and if the attacker is worth more than the blocker plus diff, the AI will consider it a good trade.
Currently the diff is generated by "(ai.getLife() * 2) - 5", which looks pretty stupid (especially for opponents with more than 20 starting life). I think setting this to cap at 15 would be much better. It would also be a good start for the AI "personalities" to influence this value.
You can toy around with this as much as you want Agetian. I would be happy to not be alone tinkering with the AI.

friarsol wrote:The AI should block more proactively with creatures Enchanted By Pattern of Rebirth (do we have an SVar for that already? Maybe the SacMe SVar?)
Done. Are there similar cards that could use this too?
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 krevett » 11 Dec 2012, 10:32

AI tries to Wasteland my fetchlands...It should be set to target mana producing lands and manlands and perhaps enemy wastelands if they're tapped out!
Last edited by krevett on 11 Dec 2012, 11:36, edited 1 time in total.
krevett
 
Posts: 109
Joined: 21 Feb 2012, 22:24
Location: France
Has thanked: 18 times
Been thanked: 9 times

Re: Card AI (Improvements) Requests

Postby Bundy » 11 Dec 2012, 11:28

Computer has Story Circle in play and picked green as the color. I attack with big green creatures and instead of activating the Story Circle the computer decides to block my creatures. Only when it has nothing left to block with the computer uses Story Circle.

I attack with 2 big green creatures, the computer has 1 blocker left and activates Story Circle for the other 3 times. Next turn the computer has nothing left to block with and i attack again with 2 green creatures. Computer activates Story Circle again 3 times and loses the game. So i think it targeted the same creature 3 times, instead of activating Story Circle only once for each creature :?
Bundy
 
Posts: 348
Joined: 17 Dec 2010, 17:32
Location: The netherlands
Has thanked: 23 times
Been thanked: 3 times

Re: Card AI (Improvements) Requests

Postby gos » 11 Dec 2012, 12:25

The AI repeatedly attacks with Crypt Sliver when I have blockers that will easily kill it, without being able to regenerate it or any combat tricks.
gos
 
Posts: 4369
Joined: 03 Mar 2011, 15:21
Location: Reykjavík, Iceland
Has thanked: 231 times
Been thanked: 232 times

Re: Card AI (Improvements) Requests

Postby gos » 11 Dec 2012, 18:47

AI pays {3} for Pearl Shard 's ability with 2 Plains on the battlefield.
gos
 
Posts: 4369
Joined: 03 Mar 2011, 15:21
Location: Reykjavík, Iceland
Has thanked: 231 times
Been thanked: 232 times

Re: Card AI (Improvements) Requests

Postby krevett » 11 Dec 2012, 19:20

AI search for Darksteel Colossus with Enlightened Tutor (I know that Oath of Druids is in AI's deck...)
krevett
 
Posts: 109
Joined: 21 Feb 2012, 22:24
Location: France
Has thanked: 18 times
Been thanked: 9 times

Re: Card AI (Improvements) Requests

Postby krevett » 11 Dec 2012, 19:26

AI search for 3 more Squadron Hawk even if his hand will excess 7 cards by the cleanup step, and is thus forced to discard.
krevett
 
Posts: 109
Joined: 21 Feb 2012, 22:24
Location: France
Has thanked: 18 times
Been thanked: 9 times

Re: Card AI (Improvements) Requests

Postby Zirbert » 12 Dec 2012, 01:22

The AI and I were in a drawn-out creature stalemate. We each had lots of creatures of various sizes, and life in the mid-teens.

The AI then played Thundermare, tapping all other creatures, and didn't attack with it. My turn came, my creatures untapped, and I easily swarmed the almost-defenseless AI.

The best part is, the AI did this two games in a row, handing me the match.

This could be very tricky to check for... the logic, in non-computer terms, would need to be something like "If the human player has enough creatures (total power) to kill me if I can only block one of his attackers, don't play Thundermare (or creatures with similar ETB effects)."
Zirbert
 
Posts: 512
Joined: 13 Oct 2010, 16:04
Has thanked: 104 times
Been thanked: 19 times

Re: Card AI (Improvements) Requests

Postby gos » 12 Dec 2012, 17:13

I controlled the AI's Kjeldoran Royal Guard through Control Magic. He had enchanted it with a Blessing earlier. Every time the Guard was about to deal combat damage, the AI spent all of its available white mana to activate the Blessing.
gos
 
Posts: 4369
Joined: 03 Mar 2011, 15:21
Location: Reykjavík, Iceland
Has thanked: 231 times
Been thanked: 232 times

PreviousNext

Return to Forge

Who is online

Users browsing this forum: No registered users and 99 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 99 users online :: 0 registered, 0 hidden and 99 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 99 guests

Login Form