ID:153189
 
How do you go about making complicated AI? I know how to make basic AI, that follow the same basic procedures and walk about like zombies - that's all easy. But currently I am attempting to make a Trading Card game, somewhat alike Magic Cards, YuGiOH, Pokemon, e.t.c. But I can't think of a way to make the computer smart enough to play me! Or anyone really!

In the game one turn follows like this;
Pick up one card.
Play one/none monster(s).
Play as many magic cards as you want (including none).
Get any/all/some of your monsters to attack the opponents monster.
End Turn.

What I want to know is; is it even possible to make a comptuer smart enough to judge the cards in his hand, compare them to the ones on the table, make the best judgement (or 2nd best, to give the player a chance!) and play it? How should I go about doing it?

Thank you for your time!
Fuzzy AI is probably your best bet. Gazoot wrote a BYONDscape article on it, here: http://www.byondscape.com/ascape.dmb/Gazoot.2004-0315/
AI doesn't really need to be complicated in order to be good...

The trick to making good AI is to have it make decisions in the same way a human player would (with a bit of randomness thrown in for good measure)...

For each decision the AI needs to make per turn, you need to think about how you would make that decision, and try to emulate it...

Now, what does a human base their decisions off of? Current conditions, with a touch of future planning... If you get really into it, players also learn from past mistakes and situations to make better predictions, but that's probably getting a bit too involved...

But anyways, a player will look at the current state of the game, then see what moves will help them the most, both right now, and down the road...

So, make your AI do that...

Have a system that feeds them all relevant data from the game (life totals, monsters on field, other resources each player has, etc)... Then, use that data to see what their highest priority is (for instance, if they're outnumbered in creatures, they might want to either destroy some of the opponent's creatures, or summon more of their own to make up the difference... one of these two goals would be more important than playing less useful magic cards, or whatnot...)

Anyways, once you figure out what they want/need to do the most, then you check the cards in their hand, and see which ones will help them the most to meet that goal...

Using our example above, once the AI figures out that it needs to get rid of enemy creatures more than anything, it looks at its cards and finds a spell that destroys a creature... That card gets their priority, so they'll play it...
In response to SuperSaiyanGokuX
SuperSaiyanGokuX wrote:
AI doesn't really need to be complicated in order to be good...

The trick to making good AI is to have it make decisions in the same way a human player would (with a bit of randomness thrown in for good measure)...

For each decision the AI needs to make per turn, you need to think about how you would make that decision, and try to emulate it...

Now, what does a human base their decisions off of? Current conditions, with a touch of future planning... If you get really into it, players also learn from past mistakes and situations to make better predictions, but that's probably getting a bit too involved...

But anyways, a player will look at the current state of the game, then see what moves will help them the most, both right now, and down the road...

So, make your AI do that...

Have a system that feeds them all relevant data from the game (life totals, monsters on field, other resources each player has, etc)... Then, use that data to see what their highest priority is (for instance, if they're outnumbered in creatures, they might want to either destroy some of the opponent's creatures, or summon more of their own to make up the difference... one of these two goals would be more important than playing less useful magic cards, or whatnot...)

Anyways, once you figure out what they want/need to do the most, then you check the cards in their hand, and see which ones will help them the most to meet that goal...

Using our example above, once the AI figures out that it needs to get rid of enemy creatures more than anything, it looks at its cards and finds a spell that destroys a creature... That card gets their priority, so they'll play it...

To add to what was said here, you are making a really difficult to create AI. How many cards in the deck? How many cards exist? Would you expect a player to keep track of what he has in his deck, knowing from what's played, what is still left to be turned up?

AI for this type of game is difficult to make. The combinations of what to do and when are huge. It would be best to make a simplistic AI and hope it gets lucky. That, or work out what I stated above(and more) and work that into code. It's not an easy task.

AI example. In my magestones game, there are 3 AIs. A random play AI. An attack the first visible attack if not play random AI. Last, an attack the leader, if not then attack the most stone take down, if not attack where ever, if not play defensive, if not random.

Where AI 1 is about 4 lines, AI 2 is about 20, AI 3 is about 50+ and still going(still have to do the defensive). And in magestones, you roll to see where to play, then you have a choice of about 9 spots(if they are free).

As you see, something as simple as placing a stone in one of 9 spots can get very complex depending on how you want the AI to react. With the amount of options with cards, it gets even more complex....

In response to Jik
Jik wrote:
As you see, something as simple as placing a stone in one of 9 spots can get very complex depending on how you want the AI to react. With the amount of options with cards, it gets even more complex....

Which is why you use fuzzy logic (see my earlier post). =)