Monday, April 7, 2008

AI Fix

I fixed this in the most recent version of MTG Forge, but the computer AI used to stumble when playing mono-colored decks. The AI seemed slow and would actually play the same land twice, the cards ID numbers were the same. The problem was in the code that smoothed the computer’s land, also known as mana threading. The code presumed a two color deck. I fixed the code and now it will worked with 1,2,3,4 or 5 color decks. With a 2 color deck the computer’s mana is threaded like 1,2,1,2,1,2.

The computer’s land is threaded in a very particular order. The computer’s opening hand has no lands and then draws a land for the next 5 turns. You may be asking yourself, why? The idea is to increase the number of spells the computer has an opportunity to play. On the computer’s first turn he has 7 spells and 1 land. So hopefully he has a one mana spell in his hand. On the computer’s second turn, he draws a land and plays it. So now he has 6 or 7 spells in his hand, depending if he played a spell. The computer’s hand is all spells, increasing the “quality” of cards he has. Being technical, I guess the computer has “virtual card advantage,” but I don’t really know, lol.

The computer draws an additional land on his 8th and 11th turn. The computer will never have more than 7 lands in play at a time, assuming he doesn’t play cards that fetch lands. Threading the computer’s land like Forest, Mountain, Forest, Mountain, gives it an advantage. Assuming a 2 color deck, the computer can play any double-costed spell like RR as early as turn 3 and always by turn 4.

5 comments:

Anonymous said...

Hi. I haven't followed MTG Forge since I recently discovered it, but I think it has the greatest magic AI I've seen so far, good job on that! I'm just wondering why is the need for the computer to actually "cheat" this way? Isn't it more realistic to simply let him draw lands like we humans do?

Anonymous said...

The reason i'm asking is that it allows two-way cheating... With that information in mind, let's say i could play a destroy land card by turn 3, then i would know exactly which land to destroy that will hurt him most since he's drawing them in a precise order.

Unknown said...

As you play the AI more, you'll find there are a number of quirks you will learn to take advantage of. It's not so much cheating, no more so than when you play against the same friend so much, that you tend to expect certain responses and play accordingly. It's adaptation.

For a while, I was "cheating" the computer because I knew there was a bug in trample damage... so I purposely was using a trampler to block the computer's attacks. As soon as that was fixed, it wasn't so viable a strategy anymore.

When the ability of the AI increases, the tricks Forge has to use to make the computer more challenging will be reduced. Right now the AI is only good to play aggro decks. If you give it an average control deck, it will do poorly. It could probably handle a burn deck though.

Forge said...

Hey Alex, I'm glad you like MTG Forge and that the AI is enjoyable, no Magic AI is every going to be a world champion. (I can see it now, the John Finkel AI, you may never win another game of Magic again.)

The truth is the computer doesn't need to cheat, it does pretty good without it, but it does make the computer a little more challenging.

You can cheat the computer by destroying a land, but it doesn't always help. Maybe the computer doesn't need that mana source?

Theoretically you should be able to turn this option on or off and compare the results. Or the AI would only cheat like this 50% of the time.

Some of my observations pull back the magic curtain, like the mighty Wizard of Oz. The AI now seems alittle less smart, now that you know it doesn't get mana screwed. When I am in the moment, I tend to forget about the AI deficiencies and concentrate on what is my the correct play.

Anonymous said...

Where i can download this game with the AI?