DeckWants SVar
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
12 posts
• Page 1 of 1
DeckWants SVar
by mcrawford620 » 15 Jul 2012, 05:44
I checked in a little class DeckWants and an accompanying SVar in a handful of cards, to try to give the AI a way to use some of the RemRandomDeck cards. Basically it's a way to give a little instruction to the construction of Limited or random decks (I only put it in Booster Draft decks so far), so that if a card requires other kinds of cards to be useful in a deck, the AI can add those cards to the deck as well.
I just started on the M12 and M13 cards which seemed easy to do. It doesn't cover all possibilities of course. Let me know if you find any problems, or suggestions, or don't think it's helpful. I think overall it's pretty unobtrusive and just gives the AI a few more options in the booster draft.
I just started on the M12 and M13 cards which seemed easy to do. It doesn't cover all possibilities of course. Let me know if you find any problems, or suggestions, or don't think it's helpful. I think overall it's pretty unobtrusive and just gives the AI a few more options in the booster draft.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by Hellfish » 15 Jul 2012, 08:29
Forgive the blatant self-promotion, but I started a topic some time ago with plans for an archetype recognition AI which would help in deckbuilding,drafting and even sideboarding when that gets added.I got distracted by the much more interesting ability-copying and,well,AI is hard, but maybe some of it could be of use?
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: DeckWants SVar
by mcrawford620 » 15 Jul 2012, 21:41
I took a quick look at the Archetype thread you had going. It looks like you took a larger, deck-centric crack at the problem whereas I was just trying to solve individual cards.
I think at least some of what you were getting at could be put into the system I have and it's similar to some things I was thinking of but haven't gotten to yet.
Basically, my system now just solves the small problem of cards that are terrible by themselves, and need other things to be useful in the deck. So if the other things aren't available, the AI doesn't put the original card into the deck at all.
But more generally, lots of cards are fine by themselves (no RemRandomDeck tag) but would be even better if paired up with other cards. So lots of DeckWants Svars could be added to other cards if I wasn't *requiring* the Wants in order to put the original card in. They would just be *suggestions* -- basically, instead of requiring 1+ other cards in order to use the original card, I should be able to require 0-X other cards, with the min and max defined in the Svar if desired.
I think at least some of what you were getting at could be put into the system I have and it's similar to some things I was thinking of but haven't gotten to yet.
Basically, my system now just solves the small problem of cards that are terrible by themselves, and need other things to be useful in the deck. So if the other things aren't available, the AI doesn't put the original card into the deck at all.
But more generally, lots of cards are fine by themselves (no RemRandomDeck tag) but would be even better if paired up with other cards. So lots of DeckWants Svars could be added to other cards if I wasn't *requiring* the Wants in order to put the original card in. They would just be *suggestions* -- basically, instead of requiring 1+ other cards in order to use the original card, I should be able to require 0-X other cards, with the min and max defined in the Svar if desired.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by Rob Cashwalker » 18 Jul 2012, 16:54
Would you want to consider making use of the database to store all sorts of AI info? Adding and maintaining SVars on this kind of magnitude would really, really suck. Using a central database, we can all participate in building lists of favorable card interactions... "Plays Well With Others"
Some interactions can be learned by adding code to the UI to spy on what the humans do.. more than just card ratings, (though those are still important) when the human drafts cards together; or plays (and wins) each card in the deck is added to each other's lists; or even during the game, when the human targets cards, or uses spells and abilities in particular ways, all that kind of information can be exported to the AI database
Some interactions can be learned by adding code to the UI to spy on what the humans do.. more than just card ratings, (though those are still important) when the human drafts cards together; or plays (and wins) each card in the deck is added to each other's lists; or even during the game, when the human targets cards, or uses spells and abilities in particular ways, all that kind of information can be exported to the AI database
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: DeckWants SVar
by mcrawford620 » 18 Jul 2012, 21:14
Yeah, that sounds much more awesomer. I just have no idea how to go about doing so. I'm still just poking around the edges of Forge.
I might be able to do it with some direction, or if you laid out the groundwork in terms of Java classes I could flesh it out. But starting from scratch I wouldn't be about to do it. What do you think?
I might be able to do it with some direction, or if you laid out the groundwork in terms of Java classes I could flesh it out. But starting from scratch I wouldn't be about to do it. What do you think?
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by mcrawford620 » 20 Jul 2012, 16:07
Really, it's very similar to the Drafting improvements we were talking about. My feeling is that the biggest bang for our buck would be to do one of the solutions we were talking about here -- either getting the draft data from some site, or using our own data.
That would help the AI actually pick better cards, and to me that is the bigger issue, and is more easily solved. Since the AI has no way of evaluating spells, it just doesn't pick good ones.
The issue of cards that work well together is a more subtle issue and seems more difficult.
That would help the AI actually pick better cards, and to me that is the bigger issue, and is more easily solved. Since the AI has no way of evaluating spells, it just doesn't pick good ones.
The issue of cards that work well together is a more subtle issue and seems more difficult.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by Sloth » 24 Aug 2012, 17:46
There is an error in the logic of buildDeck() in LimitedDeck. Cards with SVar:RemRandomDeck:True are no longer filtered out, which leads to very bad card choices by the AI.
I will try to fix this without breaking the DeckHints. Maybe you can take a look at it too mcrawford.
EDIT: revision 16545 and 16546 fixed the problem and added the new option DeckNeeds.
I will try to fix this without breaking the DeckHints. Maybe you can take a look at it too mcrawford.
EDIT: revision 16545 and 16546 fixed the problem and added the new option DeckNeeds.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: DeckWants SVar
by mcrawford620 » 24 Aug 2012, 22:09
OK, that looks good to me. Thanks for cleaning it up and building out the DeckNeeds.
My original thinking was that the RemRandomDeck cards would generally be filtered out of Limited Decks when the cards get sorted by ranking. That eliminates cards like Battle of Wits because those are ranked really low. But you're right, some medium-ranked cards like Angel's Feather were still getting in.
How would you differentiate between assigning a DeckNeeds and a DeckHints? Just thinking out loud...I think if a card is completely worthless without the supporting cards, it should be a DeckNeeds. This seems more applicable to colors, where the card is useful if you are playing the specified color, otherwise it's useless. Angel's Feather is a good example of this -- you're not going to actively add white cards to your deck just because you have Angel's Feather. What about Vigor Mortis, though? It seems good even without green. I would put that in my black deck even without green.
On the other hand, a DeckHints means the AI will actively look for combo cards to put in there. The card by itself has to be (at least marginally) useful by itself. That's like Scepter of Empires -- it's not a great card but it's at least playable without its companions.
My original thinking was that the RemRandomDeck cards would generally be filtered out of Limited Decks when the cards get sorted by ranking. That eliminates cards like Battle of Wits because those are ranked really low. But you're right, some medium-ranked cards like Angel's Feather were still getting in.
How would you differentiate between assigning a DeckNeeds and a DeckHints? Just thinking out loud...I think if a card is completely worthless without the supporting cards, it should be a DeckNeeds. This seems more applicable to colors, where the card is useful if you are playing the specified color, otherwise it's useless. Angel's Feather is a good example of this -- you're not going to actively add white cards to your deck just because you have Angel's Feather. What about Vigor Mortis, though? It seems good even without green. I would put that in my black deck even without green.
On the other hand, a DeckHints means the AI will actively look for combo cards to put in there. The card by itself has to be (at least marginally) useful by itself. That's like Scepter of Empires -- it's not a great card but it's at least playable without its companions.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by mcrawford620 » 24 Aug 2012, 23:01
I think some cards could even be both. I'm looking at Phylactery Lich, for instance. It's good if you have artifacts, but unplayable without them. It's good enough that if the AI is thinking about adding it to the deck, it should try to add artifacts if it needs to. But if it can't find anything, it has to take the Lich out of the deck, it's just worthless.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by mcrawford620 » 25 Aug 2012, 04:51
OK, I worked on the code a little bit. Here's my current thinking on how to use the different tags:
RemRandomDeck -- this is the baseline, since it's well established. Any card marked will be checked at the end of building the LimitedDeck, and will be removed unless it's also marked with a DeckNeeds or DeckHints.
DeckNeeds -- This only makes sense to use with RemRandomDeck:True. AI will put the card in. Then at the end if it's marked as RemRandomDeck, check to make sure a DeckNeeds card is in there. If not, it will remove the card. This is for cards that are only useful in combination with something else that is already in the deck. Farseek and Angel's Feather are good examples.
DeckHints -- AI will put the card in and then actively try to add the DeckHints cards. This makes sense to be used with or without RemRandomDeck. Cards that are useful by themselves can just use DeckHints, and will be left in even if no complementary cards are found. But if it's marked RemRandomDeck, it is subject to removal from the deck if nothing can be found.
Phylactery Lich is actually a good example of this, I think. I was wrong when I said it needs both. It should simply be marked with both DeckHints (to actively try to add artifacts) and RemRandomDeck, to remove it if no artifacts are in there.
Elvish Archdruid just has DeckHints (try to put in Elves) but it's not terrible by itself, so no RemRandomDeck.
RemRandomDeck -- this is the baseline, since it's well established. Any card marked will be checked at the end of building the LimitedDeck, and will be removed unless it's also marked with a DeckNeeds or DeckHints.
DeckNeeds -- This only makes sense to use with RemRandomDeck:True. AI will put the card in. Then at the end if it's marked as RemRandomDeck, check to make sure a DeckNeeds card is in there. If not, it will remove the card. This is for cards that are only useful in combination with something else that is already in the deck. Farseek and Angel's Feather are good examples.
DeckHints -- AI will put the card in and then actively try to add the DeckHints cards. This makes sense to be used with or without RemRandomDeck. Cards that are useful by themselves can just use DeckHints, and will be left in even if no complementary cards are found. But if it's marked RemRandomDeck, it is subject to removal from the deck if nothing can be found.
Phylactery Lich is actually a good example of this, I think. I was wrong when I said it needs both. It should simply be marked with both DeckHints (to actively try to add artifacts) and RemRandomDeck, to remove it if no artifacts are in there.
Elvish Archdruid just has DeckHints (try to put in Elves) but it's not terrible by itself, so no RemRandomDeck.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: DeckWants SVar
by Sloth » 25 Aug 2012, 09:06
Very good solution mcrawford. Thumbs up!
I will test it and some more cards with DeckNeeds later today.
Just some notes on specific cards:
- Arms Dealer doesn't need SVar:RemRandomDeck:True, it's already a good limited card on it's own since it can sac itself.
- Door to Nothingness should not have "DeckNeeds:Color$white|blue|black|red|green", it will end up in any deck that has one of the colors (maybe a future feature can cover this case).
- Sunscape Master and Thunderscape Master didn't have the green DeckHint because the AI can't use the mass pump ability very well.
EDIT: Another thought: Does DeckHints check for colors, when adding cards? Should it?
I will test it and some more cards with DeckNeeds later today.
Just some notes on specific cards:
- Arms Dealer doesn't need SVar:RemRandomDeck:True, it's already a good limited card on it's own since it can sac itself.
- Door to Nothingness should not have "DeckNeeds:Color$white|blue|black|red|green", it will end up in any deck that has one of the colors (maybe a future feature can cover this case).
- Sunscape Master and Thunderscape Master didn't have the green DeckHint because the AI can't use the mass pump ability very well.
EDIT: Another thought: Does DeckHints check for colors, when adding cards? Should it?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: DeckWants SVar
by mcrawford620 » 26 Aug 2012, 04:57
Good points about those cards, I see you've already cleaned them up. Door to Nothingness will never get added to an AI's Limited Deck anyways because I think it's ranked 227th out of 234 cards in the set. Just ahead of Battle of Wits and basic lands.
Understood about Sunscape Master and Thunderscape Master -- that must be the same problem as with Overrun, where the AI will cast it and then not attack.
DeckHints does now check for colors when adding cards. I had the same thought last night when I saw a stray color in an AI deck, and fixed it.
Understood about Sunscape Master and Thunderscape Master -- that must be the same problem as with Overrun, where the AI will cast it and then not attack.
DeckHints does now check for colors when adding cards. I had the same thought last night when I saw a stray color in an AI deck, and fixed it.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
12 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 50 guests