Page 1 of 3

Getting started - hello

PostPosted: 25 Jun 2012, 18:54
by mcrawford620
Hi all,

I'm really liking Forge and having a lot of fun with it. I actually like the Draft way of playing the best, which sounds like I'm in the minority. It's because the computer still beats me sometimes in the Draft, and the Quest mode is overwhelming.

For me, I'd like to make the Draft mode a little more fun, by trying to make it so that we can remove some of the RemAIDeck flags so the computer will consider them. And tweaking the BoosterDraftAI as I can.

I work as a web developer, which meant a lot of Java programming at first. But now almost all of our websites are done in PHP. The exception is when I'm working on my company's Android app.

Here's a couple of cards I noticed that seem feasible:
Diabolic Tutor -- pull a card from your library -- this actually seems to work fine. Is there a reason the AI shouldn't use this card?
All the Phantasm blue cards like Phantasm Bear -- apparently the AI will target these cards with pump-up spells, destroying them. Is this an easy fix?
Timely Reinforcements -- a simple check of comparing life and comparing creatures should make this playable.

Any suggestions?

Re: Getting started - hello

PostPosted: 25 Jun 2012, 19:14
by friarsol
Welcome mcrawford,

I believe Diabolic Tutor is marked because it will always search suboptimally in a "drafted/random" deck. Perhaps a better way of tutoring would be to check the game state to see which category of card we need, and

Phantasm cards: We can probably add a "Targeting$Dies" SVar for these guys so the AI can filter these guys for Pump spells (or pick them out better for Curses)

This thread probably should be moved to the dev forum.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 19:44
by mcrawford620
You're right, sorry, I thought I HAD posted it in the dev forum.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 19:53
by Chris H.
mcrawford620 wrote:You're right, sorry, I thought I HAD posted it in the dev forum.
 
I will try to move this topic over to the developer forum.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 19:55
by Chris H.
Chris H. wrote:
mcrawford620 wrote:You're right, sorry, I thought I HAD posted it in the dev forum.
 
I will try to move this topic over to the developer forum.
 
Ah, succeeded in the move.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 20:31
by friarsol
Ok, apparently my original post got cut off a bit.

But basically: Tutors don't really check game state. Conditionals don't currently get tested in AI specific code.

It would be great to get some more hands on the AI side of things. Sloth does a large majority of the work there, when I was more active I was doing some baselines inside the AbilityFactories, but haven't really been able to improve those things in a while.

As far as Drafting goes, there's two main fronts that need to be improved: Deciding which cards are "better" and playing the cards "smarter" in game

But anyway, welcome aboard. Feel free to ask about if you have any questions.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 20:59
by Chris H.
Rob did some initial work on creating a draft mode AI for the computer.

Forge has a preferences option for uploading draft picks to Rob's server and this data would then help to weigh the importance of the cards that were picked.

I will let Rob chime in and give a more thorough explanation on how his system works.

Re: Getting started - hello

PostPosted: 25 Jun 2012, 22:59
by mcrawford620
Re: Phantasms and similar cards:
Adding the SVar:Targeting:Dies is straightforward, but I'm not sure where all to check it. I added a check to AbilityFactoryPump.pumpTgtAI(), and that works for Pumps. But should I add checks to a bunch of other AbilityFactory's? Or is there somewhere better to put the check?

Also, I wasn't sure if you meant literally adding a SVar:Targeting:Dies, or if it's feasible to check the existing stuff, which looks like
Code: Select all
T:Mode$ BecomesTarget | ValidTarget$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ When CARDNAME becomes the target of a spell or ability, sacrifice it.
SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ Self
Thanks for any help!

Re: Getting started - hello

PostPosted: 25 Jun 2012, 23:40
by friarsol
mcrawford620 wrote:Also, I wasn't sure if you meant literally adding a SVar:Targeting:Dies, or if it's feasible to check the existing stuff, which looks like
I was literally saying create an SVar to help with that. We have other AI friendly svars for certain things (http://www.slightlymagic.net/wiki/Forge_API#SVars). The way I was picturing it was just like that, putting them in the AI Targeting spots so the AI would consider it better. And it's quicker than parsing triggers.

Re: Getting started - hello

PostPosted: 26 Jun 2012, 00:39
by mcrawford620
OK, makes sense. I've added checks to all the AbilityFactory's that I could find that seemed relevant:
Pump, Attach, Protection, and ChangeZone (computer shouldn't try to Unsummon something if it's going to die, but it still likes to Unsummon my stuff).
But I have no idea if that is really all the relevant AbilityFactory's. Would it be better to commit what I have going, or do something else?

Re: Getting started - hello

PostPosted: 26 Jun 2012, 01:42
by friarsol
mcrawford620 wrote:OK, makes sense. I've added checks to all the AbilityFactory's that I could find that seemed relevant:
Pump, Attach, Protection, and ChangeZone (computer shouldn't try to Unsummon something if it's going to die, but it still likes to Unsummon my stuff).
But I have no idea if that is really all the relevant AbilityFactory's. Would it be better to commit what I have going, or do something else?
That should be fine to commit, it's more than we have now and can continue to fill the gaps as other relevant ones popup. Have you requested commit access already?

Re: Getting started - hello

PostPosted: 26 Jun 2012, 02:22
by Chris H.
friarsol wrote:Have you requested commit access already?
 
I received the request and approved it earlier today.

Re: Getting started - hello

PostPosted: 26 Jun 2012, 19:09
by mcrawford620
friarsol wrote:That should be fine to commit, it's more than we have now and can continue to fill the gaps as other relevant ones popup.
OK, I cleaned things up and committed the fix. It affects about a dozen cards and was relatively easy, so that was a good one to start with. Thanks for your help!

Re: Getting started - hello

PostPosted: 26 Jun 2012, 19:25
by mcrawford620
Timely Reinforcements seems to be used pretty well by the AI. He used it to gain life sometimes, and sometimes to gain the 3 soldier tokens. Can I remove the RemAIDeck flag, or is there something I'm missing that the AI should be doing differently? Maybe the original scripter of the card just put the flag in there as a precaution.

Re: Getting started - hello

PostPosted: 26 Jun 2012, 20:38
by ArsenalNut
mcrawford620 wrote:Timely Reinforcements seems to be used pretty well by the AI. He used it to gain life sometimes, and sometimes to gain the 3 soldier tokens. Can I remove the RemAIDeck flag, or is there something I'm missing that the AI should be doing differently? Maybe the original scripter of the card just put the flag in there as a precaution.
In general, the AI will cast anything that it has the mana to cast. Have you tested a situation where the AI has the resources to cast Timely Reinforcements but shouldn't? Here's how I would setup a test. Give the AI a deck with 3x Plains, 1x Doomed Traveler, and 1x Timely Reinforcements. Then don't cast anything and see what the AI does after it has its third Plains in play. Given that the ability scripts don't contain any AI directives, I would be surprised if the AI doesn't cast it even though the AI won't get any benefit.