Monday, June 22, 2009

Booster Draft AI - Part 1

In case you didn't know, MTG Forge supports booster drafts. The computer AI simulates the other seven players that you are drafting against. Before the draft starts each of the AI players chooses the two colors that they will draft. Each AI player picks creatures first and then spells. Each AI deck has 12-20 creatures, various spells and 18 land, 9 of each color.

The drafting AI is very weak since it only chooses a random card in one of its colors. The simplest way to improve the AI is to have a pick order for all of the cards. Each color could have a separate file and the cards at the top of the list would be chosen first. (You could have a "global pick order" by putting all of the cards into one file and but it would be hard to compare the power levels of various cards across all of the colors.)

This is a sample of what would be put into the "red-draft" file.

Lightning Bolt
Shock
etc...
2/2 creature with haste
2/2 creature

Since archetypes do exist in drafting, it would be nice if the AI could draft them. One way to implement this is to create a file that lists all of the cards that work well for a specific archetype. Another idea is that the AI could draft using a simple plan. For example an aggro AI drafter would pick many 2/2 creatures.
This article talks about both pick orders and archetypes, you can read it here.

"While I am not completely opposed to the idea of having a pick order for a specific archetype, or ranking cards for first-pick, first-pack purposes, having a "pick order" for the entire set strikes me as being more harmful than helpful.

The key to successful archetype drafting is to take cards that not only work well with what you've already drafted, but will allow you to maximize the value of cards that you will draft. So if you're trying to draft an awesome Esper deck, you need to draft artifacts—and lots of 'em."

p.s.
I'm a huge believer of using plain text files like the above example.

4 comments:

Anonymous said...

If possible the AI should choose what colors to play based on it's first few picks. Also, a simple way to prioritize is to have it pick rares first.

It shouldn't decide on colors and and number of creatures and spells before hand. You have to figure that out based on what's passed.

Forge said...

Currently the "drafting AI", if you could even call it that, can only walk and doesn't run. Many people have said that drafting is too easy, so I was looking at a few options that I knew that would improve the drafting AI. (All of the options I look at are fairly basic because I'm not a great drafter myself.)

Scott said...

Forge,

As someone who loves drafting, I might give a few considerations here.

First, pick orders are very important. You can do these in one of two ways.

1) Script. You would need to devise a 'scripting language' (a very basic one) so that you can 'check' each card in a pack against those options. Thus, in pseudocode:

for(each card in pack in your colors)
if (card == bomb)
choose(card);
else if (card == removal)
choose (card);
else...

This would require additional tags to be placed on every card in the database, which is a rather daunting task.

2) Another option (and the one that I greatly prefer) is to have 'sets' made out of the existing cards, and each 'set' comes with the pick order for the cards in its color(s). Once the interface is implemented, this puts the onus on the people creating the sets, and not the overall game designers (i.e., you et al.)

Of course, improving the combat system and allowing the AI to play cards in response would be much more useful to overall gameplay.

Abe Sargent said...

What if, instead of creating a pick order, you simply assigned a number in the code 1-10. The most powerful draft cards are given 10s, and the least powerful are given 1s, and the middle ground would obviously be in the middle. Then, you have the AI, on its first pick, to look for the highest number overall. Suppose a card rated an 8 is out there. Take the 8. It's a White card, the Ai is now White.

Then it gets the second pick. For this pick, it looks at all of the White cards and the # they were assigned. Whichever is highest, they take. If multiple #s are out there, suppose two cards are rated 7 in the pack for White, then the AI selects randomly.

When the AI looks at cards in a color it is not playing, let's say it subtracts 2 or three from the number, to decide to moving into that color is worth doing.

In our example, it picked White first and second. The third pack arrives. There is a card rated 5 in White, and the AI would normally take it, but here is this 8 rated card in Blue, and it says, hmm, 8-2 is 6. 6 is higher than White. Let's take it.

Now it's taking White and Blue cards, and in the future., it rates them equally.

Now let's move to the next level. Once it has two colors, how do you determine a splash?

Assign a really high number to those cards which have historically been taken super high in drafts and splashed, no matter the color. Example, Fireball. Give Fireball a 9. Now, after the AI has selected two colors, make it subtract 3 from all other cards. The Fireball is still rated 6 compared to White and Blue cards that may be 4s and 5s As a result, it will take and splash the Fireball over them, which is what a real life drafter would do too.

And then you can cut it off after the third color from looking for more colors.

I think this might be an easier way to give the AI some flexibility, without too much work.