AI mana pool
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
14 posts
• Page 1 of 1
AI mana pool
by Sloth » 08 Jun 2011, 06:58
My next plan is to add a mana pool for the AI. I think we had the consensus to put it in the player class. I want to make the following simple functions:
addToManaPool
getManaPool
removeFromManaPool
I don't plan to revolutionize the mana paying AI, but the AI should use the mana in the pool before using its mana producers. Then, at least triggered mana abilities will be avaiable for the AI: Mana Drain, Braid of Fire, Gauntlet of Might, Priest of Gix, ...
I think this is a first step and easy to pull off. But since it has to grow into something more complex I would like to hear your opinions first.
addToManaPool
getManaPool
removeFromManaPool
I don't plan to revolutionize the mana paying AI, but the AI should use the mana in the pool before using its mana producers. Then, at least triggered mana abilities will be avaiable for the AI: Mana Drain, Braid of Fire, Gauntlet of Might, Priest of Gix, ...
I think this is a first step and easy to pull off. But since it has to grow into something more complex I would like to hear your opinions first.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: AI mana pool
by slapshot5 » 08 Jun 2011, 13:05
Will you still have a mana pool class, and will it still extend Card?
I'm guessing this won't change the way it's displayed at all, will it? Just that the AI will have a mana pool "card" in his battlefield.
-slapshot5
I'm guessing this won't change the way it's displayed at all, will it? Just that the AI will have a mana pool "card" in his battlefield.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AI mana pool
by Sloth » 08 Jun 2011, 13:07
I don't plan to change anything for the human. The AI doesn't need a "card" as the mana pool. The pool will be invisible (until we can agree on a representation).slapshot5 wrote:Will you still have a mana pool class, and will it still extend Card?
I'm guessing this won't change the way it's displayed at all, will it? Just that the AI will have a mana pool "card" in his battlefield.
-slapshot5
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: AI mana pool
by slapshot5 » 08 Jun 2011, 19:16
Would the human ever want to see the AI's mana pool?
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AI mana pool
by juzamjedi » 08 Jun 2011, 19:29
It's unusual to care what is in the AI's mana pool. The typical decks where that matters are combo (ANT, Belcher, Mind's Desire, Dragonstorm, Prosbloom, and surely others I'm forgetting). At some point people will care about Mana Drain mana vs. their Spell Pierce / Daze. Overall I think it's not a big deal... I wouldn't expect AI to play combo decks, and for Mana Drain I could look at the spell I countered last turn.
Re: AI mana pool
by Sloth » 08 Jun 2011, 19:39
I can imagine getting information on the AI (including content of mana pool) by mousing over the AI life.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: AI mana pool
by Sloth » 16 Jun 2011, 12:32
Now that the mana pool is there, I will improve AI mana ability handling step by step:
1. Using mana abilities with additional (non-mana) costs (Vivid Crag, Abandoned Outpost, Horizon Canopy, ...) - DONE (note that the AI will waste limited resources)
2. Using mana abilities with subabilities (Underground River, Pristine Talisman, Rainbow Vale, ...)
3. Using mana abilities that produce more than one mana (Sol Ring, ...)
4. ???
5. Profit
1. Using mana abilities with additional (non-mana) costs (Vivid Crag, Abandoned Outpost, Horizon Canopy, ...) - DONE (note that the AI will waste limited resources)
2. Using mana abilities with subabilities (Underground River, Pristine Talisman, Rainbow Vale, ...)
3. Using mana abilities that produce more than one mana (Sol Ring, ...)
4. ???
5. Profit
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: AI mana pool
by slapshot5 » 16 Jun 2011, 20:05
Can you look at making the compy not pay mana using lands it has animated? Might be tricky differentiating a land it has specifically animated using the AF vs. lands when they are all animated by a static animation (Kormus Bell, etc).
-slapshot5
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: AI mana pool
by Sloth » 17 Jun 2011, 11:18
I will look into this.slapshot5 wrote:Can you look at making the compy not pay mana using lands it has animated? Might be tricky differentiating a land it has specifically animated using the AF vs. lands when they are all animated by a static animation (Kormus Bell, etc).
-slapshot5
Step 2 has been made. There is a problem with lands producing more than 1 color, that can lead to inefficient mana usage (and can produce a bug with X costs). I'm working on it.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: AI mana pool
by Sloth » 18 Jun 2011, 11:54
Step 1 and 2 are now well supported with close to optimal AI decision making. I'm now trying to cleanup the code and I stumbled over determineLeftoverMana. This functions needs a lot of duplicate code and is prone to causing AI cost pay errors. Isn't it better to just iterate through the X starting at 0 and run canPlayCost with the complete cost until the first cost can't be paid?
If noone objects I will test to change this.
If noone objects I will test to change this.
This proves to be very tricky indeed. I improved this situation though, by restricting the usage of AF Animate to the Combat_Begin phase.slapshot5 wrote:Can you look at making the compy not pay mana using lands it has animated? Might be tricky differentiating a land it has specifically animated using the AF vs. lands when they are all animated by a static animation (Kormus Bell, etc).
-slapshot5
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Create Player.getManaPool() ? Re: AI mana pool
by alexAG76 » 18 Jun 2011, 22:46
I need a method to fetch the ManaPool for a specific Player. Should I add a non-static getManaPool() method to Player or should I add a static one (*shudder*) to AllZone (as getManaPool(Player p) )? For the former, I can control the initialization when bootstrapping the game-state.
I need to make the code more species-agnostic for Minimax.
I couldn't stop laughing for at least 30 seconds... Underpants Gnomes!
I need to make the code more species-agnostic for Minimax.
Sloth wrote: ...
3. Using mana abilities that produce more than one mana (Sol Ring, ...)
4. ???
5. Profit
Re: Create Player.getManaPool() ? Re: AI mana pool
by slapshot5 » 19 Jun 2011, 01:08
Put it in Player. I think the mana pool access methods are going there eventually anyway.alexAG76 wrote:I need a method to fetch the ManaPool for a specific Player. Should I add a non-static getManaPool() method to Player or should I add a static one (*shudder*) to AllZone (as getManaPool(Player p) )? For the former, I can control the initialization when bootstrapping the game-state.
I need to make the code more species-agnostic for Minimax.Sloth wrote: ...
3. Using mana abilities that produce more than one mana (Sol Ring, ...)
4. ???
5. ProfitI couldn't stop laughing for at least 30 seconds... Underpants Gnomes!
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Create Player.getManaPool() ?
by alexAG76 » 19 Jun 2011, 02:38
Done... but you won't see a commit-action for a good while. Patching won't work, either, because the patch to converge the game-state into a single class is, well, huge.slapshot5 wrote:Put [getManaPool()] in Player. I think the mana pool access methods are going there eventually anyway.
Thanks for the input, though.
14 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests