Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Adding creature subtypes dynamically/AI playtime delay
Moderator: CCGHQ Admins
Adding creature subtypes dynamically/AI playtime delay
by shyguysonstilts » 12 Nov 2010, 00:33
Hey all, I've been coding some cards on my own for a while now and have run into some interesting engine limitations that I was wondering whether anybody had managed to get around.
I've been working on programming some standard Constructed decks that my friends and I have built, and ran into an interesting issue while coding Captivating Vampire. I've gotten everything to work so far (fun fact, you can use <COST type="Tap"> for an ability, even though no official cards currently use this), and have even gone so far as to disable using the ability unless you actually have 5 untapped Vampires in play, but I haven't figured out a good way to make the creature you take control of a Vampire in addition to its other creature types.
I've come up with two solutions, but both are both mere workarounds:
1) Since the deck I'm using has only Vampires, assume that any creature that you have control of is a Vampire and give it the bonuses/allow it as a creature you may tap to invoke Captivating Vampire's ability.
2) Mark a random register on each card that indicates that the creature is a "Vampire". This could work for cards I code (Captivating Vampire, Kalastria Highborn), but not for other cards that actually check the creature type (Feast of Blood, Coat of Arms, etc.)
Just wondering if anyone has found an alternative to this problem yet.
Another issue with this card is that the AI seems to be extremely slow in deliberating its actions with my implementation. I know next to nothing about how the AI works in this game, does anyone have any suggestions on how to make it more responsive? I'm guessing now that it's trying to parse all of the code in the card and determine its score but is taking too long to do so, and is taking the full 10 seconds before every action during every stage (provided it has actions available to it). I tried giving it a random <AI_CUSTOM_SCORE> node, but it doesn't seem to do anything. Suggestions?
I've currently coded both Divine vs. Demonic duel decks (except Oni Possession doesn't turn the enchanted creature's type to Demon Spirit, for the same reasons as above), as well as a custom Lifegain deck and a Vampire deck, I can try uploading later if people are interested.
Thanks in advance!
I've been working on programming some standard Constructed decks that my friends and I have built, and ran into an interesting issue while coding Captivating Vampire. I've gotten everything to work so far (fun fact, you can use <COST type="Tap"> for an ability, even though no official cards currently use this), and have even gone so far as to disable using the ability unless you actually have 5 untapped Vampires in play, but I haven't figured out a good way to make the creature you take control of a Vampire in addition to its other creature types.
I've come up with two solutions, but both are both mere workarounds:
1) Since the deck I'm using has only Vampires, assume that any creature that you have control of is a Vampire and give it the bonuses/allow it as a creature you may tap to invoke Captivating Vampire's ability.
2) Mark a random register on each card that indicates that the creature is a "Vampire". This could work for cards I code (Captivating Vampire, Kalastria Highborn), but not for other cards that actually check the creature type (Feast of Blood, Coat of Arms, etc.)
Just wondering if anyone has found an alternative to this problem yet.
Another issue with this card is that the AI seems to be extremely slow in deliberating its actions with my implementation. I know next to nothing about how the AI works in this game, does anyone have any suggestions on how to make it more responsive? I'm guessing now that it's trying to parse all of the code in the card and determine its score but is taking too long to do so, and is taking the full 10 seconds before every action during every stage (provided it has actions available to it). I tried giving it a random <AI_CUSTOM_SCORE> node, but it doesn't seem to do anything. Suggestions?
I've currently coded both Divine vs. Demonic duel decks (except Oni Possession doesn't turn the enchanted creature's type to Demon Spirit, for the same reasons as above), as well as a custom Lifegain deck and a Vampire deck, I can try uploading later if people are interested.
Thanks in advance!
- shyguysonstilts
- Posts: 3
- Joined: 23 Apr 2009, 06:42
- Has thanked: 1 time
- Been thanked: 0 time
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests