It is currently 29 Aug 2025, 13:59
   
Text Size

Getting started - hello

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Getting started - hello

Postby mcrawford620 » 25 Jun 2012, 18:54

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?
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby friarsol » 25 Jun 2012, 19:14

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Getting started - hello

Postby mcrawford620 » 25 Jun 2012, 19:44

You're right, sorry, I thought I HAD posted it in the dev forum.
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby Chris H. » 25 Jun 2012, 19:53

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.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Getting started - hello

Postby Chris H. » 25 Jun 2012, 19:55

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.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Getting started - hello

Postby friarsol » 25 Jun 2012, 20:31

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Getting started - hello

Postby Chris H. » 25 Jun 2012, 20:59

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.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Getting started - hello

Postby mcrawford620 » 25 Jun 2012, 22:59

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!
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby friarsol » 25 Jun 2012, 23:40

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Getting started - hello

Postby mcrawford620 » 26 Jun 2012, 00:39

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?
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby friarsol » 26 Jun 2012, 01:42

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?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Getting started - hello

Postby Chris H. » 26 Jun 2012, 02:22

friarsol wrote:Have you requested commit access already?
 
I received the request and approved it earlier today.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Getting started - hello

Postby mcrawford620 » 26 Jun 2012, 19:09

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!
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby mcrawford620 » 26 Jun 2012, 19:25

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.
mcrawford620
 
Posts: 112
Joined: 25 Jun 2012, 16:59
Has thanked: 55 times
Been thanked: 25 times

Re: Getting started - hello

Postby ArsenalNut » 26 Jun 2012, 20:38

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.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 52 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 52 users online :: 0 registered, 0 hidden and 52 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 52 guests

Login Form