Suggestion on AI Algorithm in game like Magic The Gathering

Started by
11 comments, last by cklim78 22 years, 11 months ago
quote:Original post by cklim78

OK, I''m kinda stuck right now and looking for some suggestions
My questions are :
1 ) In game like Magic, should the AI be well informed on what''s the player''s cards on hand and the incoming card in future?

2 ) Do a rule-based + learning algorithm seems to be a good solution in game like Magic?


2)
Again, I''ll assume that you have a good knowledge of the game itself. I think it REALLY helps if you do.
Why ? Because the best method for figuring out what to do is generally to think about what *you* are actually doing when you play.
Now think about it. When you play, what do you generally ask your opponent before you play ? The colors they play. And eventually if they are nice what "style" of deck. But generally, knowing the colors gives you a fair idea of the kinda guy you are against.
Red ? Direct damage and land destruction.
Green ? Mana plentyful to summon PHat creatures.
Blue ? Counterspells, and flying creatures.
White ? Defense and counter-attack, White weenies.
Black ? Antiplay and suffering.
you get the idea.
Blue-black is usually an annoying deck with denial spells (counterspell and "discard cards") and the creatures to go with, usually flying.
Green-Red is fast and furious (a horde of little creatures and direct damage)

You get the picture.

The way I see it, you hav to study the game to see different areas that can be used to win. Think about it, how do you win ? By killing your opponent, or him running out of cards.
How do you do that ?
Damage : Direct damage, creatures.
Running out of cards is a bit more straightforward.
To damage your opponent, you have to choose diverse methods. Do you want to go for pure direct damage, do you want to use massive creatures, do you prefer a horde of little ones, or other methods.
Rather than rely on your own strength, you could just deny your opponent play, by destroying his lands, by countering him constantly, by making him lose cards, etc, etc

See, there are plenty of ways to reach your goal, and these different ways are all different styles of play that you could give your AI.
My idea is that you should define some sort of personality to your AIs. That conditions the strategy that you will chose to play, which conditions the type of cards you will need.
This works backwards, of course. Looking at one''s cards, one will quickly catch an idea of the strategy the opponent will use.

How can you code that ???
I would use a rule-based approach.
something like
"killing your opponent is good"
"direct damage spells hurt your opponent"
"spells costs mana"
"lands produce mana"
"Artifact A produces 3 mana, costs 1"

And use good old logic to let the computer figure out that
"In order to win, I need to hurt the player, hence I need to cast spells, hence I need mana, hence I need land."
"If I have one land already out, casting Artifact A is better than playing another land, as it gives me more mana"

Does that make any sense to you ?

1) Now to answer your first question, if the computer knows the hand of the player and his deck... this kill the use of cards like Urza Glasses (your opponent shows his hands), or other nice spells that let people play with their hand up. As well, it kills the side effect of some spells that let you search your opponent library that they let you look at the opponent library ("Hey! I thought you didnt play with that card!")
So it seems quite obvious that it''s a Bad Idea (tm) to let the computer cheat.
Use the above ideas to figure out what the opponent has.
He is playing blue ? He probably has some counterspell up his sleeve. He''s green, I betcha he has some Fog waiting for my horde to attack. Etc

youpla :-P

Hope I am of some help


Sancte Isidore ora pro nobis !
-----------------------------Sancte Isidore ora pro nobis !
Advertisement
Wow, thx for all the reply guys, especially youpla, thx for all the help. I get the idea of letting AI knows all the card a player had will spoil the fun. Hmm, seems too early to say I fully understand the whole picture on the rule based approach, gonna take me some time to come out idea and clearer picture to implement them. But I really appreciate all your help and idea.
I''ll still welcome any invaluable opinion as it definetely will help my project. Thx again guys
I was thinking about this thread and thought I might post another idea I had for your cklim.

Rather than aim very high, why not start with something equally interesting but maybe more feasible : a deck designer.
Basically you would give the system criteria for your deck, and it would give you a list of cards that match those criteria, and eventually why they are there ?
Imagine this : "I want a 60 cards deck, Green Red, fast, Kavu based". You could choose criteria such as color, extensions allowed (for tournaments decks), eventually styles of play (Denial decks, Burn decks, Weenie hordes, etc)

This would still imply a good amount of work, but it cut the part of playing the game. I think designing a deck is 80 % of the job in MAgic. Playing is jsut a question of getting the cards you want at the good time, and that''s what good design of deck do, get you the cards you need, when you need them.

So why not focus on that part. I am sure it would teach you a lot. And it''s very much a "classic" AI problem : designing an expert system. Now go and get a good book like that one. It''s the basics, it goesn''t go into games, but it will give you good basis for knowing where to go next.

Good luck

youpla :-P

PS: "youpla" is not my name, it''s just a stupid thing I say like other people say "Regards"


Sancte Isidore ora pro nobis !
-----------------------------Sancte Isidore ora pro nobis !

This topic is closed to new replies.

Advertisement