Computer Science Canada
|Author:||Azzy [ Sat Nov 15, 2003 9:51 pm ]|
can anyone help me make an AI program?
i need it for a Magic the Gathering game i'm making.
i need it to choose one of the cards to play.
i also need it to be able to attack with the creatures and be able to use instants.
if you don't know what magic the gathering is but would like to help check www.wizards.com
|Author:||Chimaera [ Sat Nov 15, 2003 10:25 pm ]|
that'd be one heckuva program you're building right there. Type 2? XD Well, I've tried making 'A.I' routines for turing and they've pretty much just dissolved into becoming randomly selected personalities for various things and I would have to code as many things for them to say as possible, while staying true to their personas.
My suggestion for you is to make it have percentages as to how it decides to go about playing the user. And make it difficulty level oriented so the user doesnt' have to keep playing the same easy computer once they figure out how to get around them, like real magic players. Usually real magic players have 1 style of playing and you have to devise a way or make a deck and a style that obliterates them.
Btw when I say difficulty level oriented, I mean, let it have a few options of what it could do with its cards, same goes for instants. Randint the possibility of them having it played with a higher range of possibilities.
|Author:||thoughtful [ Sat Nov 15, 2003 11:07 pm ]|
hmm i dont know much about that game but here is how ou can make the AI
First categorize your cards. As in you can have like attack points or special abilities. Now use if commands, for example if some one plays a card with small attack points you use a card which has bigger attack points than that one. But if some one uses a card which is bigger than all ur card the computer should play the lowest card, so that it doesnt lose a good card.
It all in the if statement..you need quite a bit of them. And store ur card in arrays.
|Author:||AsianSensation [ Sun Nov 16, 2003 6:18 pm ]|
yeah.............good AI for Magic will be one hard program
You can make an AI, it just won't be good. Examples for AI something like this:
Begin AI turn:
AI: Do I have land in hand?
AI play Land if yes
AI: Do I have enough mana to play spell in hand?
AI check mana amount, if enough, AI play spell (this step, you have specify what kind of spells the AI can play, like creatures or sorceries)
AI: Do I have creatures? (in other word, Can I attack?)
AI check for creatures on board
AI: Is it bigger than their creatures?
AI: check attack vs defense
If creature have lower attack power, than check for instants, enchantments in hand that could power up creature
AI attacks if possible
That's just the basics to how an AI might play Magic, then you need to get into strategies for different types of cards, like counterspells should be played when they play a card, small creatures with abilities should not attack, instead, tap them for their abilities.
after that, then go into specific card strategies. Birds of Paradise should produce what mana under what condition. When should I use Psychatog's ability (combat tricks) and how many cards do I pitch to it.
As you can see, Magic is too complicate a game to make good AI for it, because for each different deck, there is a different strategy to playing it. Stasis deck is played very differently from Weenie decks, so good luck making the AI.
|Author:||Andy [ Mon Nov 17, 2003 6:36 pm ]|
lol, i love these noob programmers... they fantasize such sweet dreams... and azn ur ai would suck so much cuz it'd have no strategy whats so ever, you'll need way more if statements than that. i suggest you create a huge record containing every single possible abilities, like plus attack plus defence plus life minus attack minus defence lock down mosnter and stuff like that and for each card define each to be true or false
|Author:||Chimaera [ Mon Nov 17, 2003 7:14 pm ]|
Your magic program would be 10% actual code and 90% database of strategy for various decks...
|Author:||Andy [ Mon Nov 17, 2003 7:16 pm ]|
i wouldnt go that far, 50% is more like it cuz who wants to play a text magic card game? if hes gonna make it, he better make it pretty. the thing with my method is that you can easily add new cards into the database, just read the card things from a text file or binary
|Author:||thoughtful [ Mon Nov 17, 2003 7:35 pm ]|
hey dodge don't be so hard on these guys i mean its going to be hard for them to program so much. Thats why i told him a simple easy path. otherwise they might not be able to finish this AI in this year. But if this guy feels like he can finish the AI and he want to learn than he might take on the challenge.
|Author:||AsianSensation [ Mon Nov 17, 2003 8:19 pm ]|
lol, I know my AI is a piece of crap, I haven't played Magic for so long
anyways, if you want a good AI, check out the Magic: The Gathering game, I'm not sure if it's open sourced or not, but anyways, check it out to see what their AI do, then use it for yourself.
One very very very big hint: Don't have too much cards, and if you do, get simple cards, not weird cards with strange abilities.
if you know how, create classes for these, and make the cards into objects, and each card could function on it's own.
|Author:||Andy [ Tue Nov 18, 2003 7:16 pm ]|
azn, u can categorize the magic abilities in about what 26 catetories?
play more land
creature cant block
creature cant attack
give color walk