Thursday, June 28, 2007

AI Good Enough?

I’m working on a new version of MTG Forge and I keep thinking about how to make the computer smarter, but I’m not sure if that is really relevant. My only thoughts are, “I wish I had more cards to play with.” I almost never think about what the computer is doing. So what is the computer isn’t that smart all the time, I am only looking for an opponent that is “good enough.” I tend to relate playing the computer like you would play with your kid brother. Your kid brother isn’t all that good at Magic, but he still can surprise you. I only expect the computer to play reasonably and to occasionally surprise me, which it does. J

So upon further reflection the AI will be the same, unless some easy method comes to me. I am all about easy coding, code it right the first time, but if it is really complicated, try to get by with simpler code, and optionally go back later to change it if I need to. In my games I don’t really care that the computer isn’t efficiently playing his cards, I’m only thinking about my strategy. My thinking and playing makes the game fun. The computer just acts like your kid brother except that he doesn’t mind losing, lol.

Although I will be programming the AI the same way, I should be able to make the computer play Instants at end of turn and hopefully program the computer to somehow respond to spells also, like bouncing a creature back to his hand. The computer should draw card at end of turn, and use burn effects at end of turn or during combat. I really would like the computer to play Giant Growth effects better also, and occasionally bluff so you don’t know if the computer really has Giant Growth in his hand or not.

7 comments:

Unknown said...

What I would like to see (and I don't know how hard this would be to implement) would be a way to play one computer AI against another. In other words, that the human player could easily be swapped out with a computer player.

If you could play one AI against another, you could make small changes in the AI and see how useful they are. For example, is it better to use some combination of attack and defense for targeting rather than just defense?

My thinking was if a computer AI could play against computer AI, then you could craft an AI that would take the current game state and copy it, using a deck and hand for the opponent that is a best guess. Then the computer could play through a turn with a few options and see which ended up being the best.

The only thing so far that really jumped out at me as far as needing improvement was the AI for dealing with "Stuffy Doll."

Anonymous said...

I am really happy with the AI. My biggest wish is to have more cards to choose and draft from. I am really happy with the entire project and thank you for putting the time in to make it. Since I am on a Mac I cannot use Magic Online and this is by far the best program that simulates the game.

Nanocore said...

Personally, I like the challenge that MTG poses for developing an AI. But, the ROI may not be worth it, unless you really do it right. I just drove 6 hours across country and didn't have the radio on because I was engrossed in thinking through some of the details on how I would program the AI. Great FUN! and made the time fly by. But, that is not for everyone.

Anonymous said...

I don't think that "improving" on the ai is really needed. Like you said, "kid brother" status. I think that it's fine the way it is for now. You should devote your time on this project to other areas.

Question: How do I import images for the cards that still don't have them. I mean, I downloaded the images but there are still a few cards without graphics. I manually placed a picture of the card in the directory but nothing. A little help?

Forge said...

Thanks for all the comments.

Question: How do I import images for the cards that still don't have them. I mean, I downloaded the images but there are still a few cards without graphics.

I think the new version of MTG Forge has pictures for all the cards. You can manually add/change cards pictures. The filename has to be exact, remove all commas, spaces are converted into _ I hope that helps.

I think about the AI, but other than some specifics, like Stuffy Doll, it generally does ok, so I am very happy with that. I want the computer to play instants and abilities better though.

And nanocore, just don't crash while you are doing all of that thinking, lol.

Forge said...

And about AI versus AI, MTG Forge can't do that. I can tweak the AI as I see it while playtesting (which I do alot) and that makes the computer more believable.

Unknown said...

Hi

My feeling is that the most important improvement would be to add the feature mentioned a few pages back: for the AI to go through it's hand and assign each card a value, then play the card with the highest value.

For instance, if it had lightning bolt, giant growth, a creature, wrath of god, and a healing salve, it would go through each asking a question:

lightning bolt: does the enemy have a creature in play with toughness 3 or less? Yes? how many? +1 for each.

giant growth: am I going to attack this turn? +1. Does the enemy have one or more creatures that are bigger than my biggest creature? +1 for each.

a creature: is my creature situation better or worse than my enemies? ie, do I have more, better creatures or not?

wrath: is my creature situation better of worse than my enemies? This card would also bump the value of any creatures in my hand down, to prevent them from being played before the wrath.

healing salve: would basically always have the lowest priority? because healing, man? oh, and instants should have lower priority than creatures and sorceries, since they can be played in more situations: it isn't as important that they get played during my main phase.

So there's my thoughts: not that I would know how to start implementing that!

z.