It is currently 11 Sep 2025, 19:16
   
Text Size

Scry

Post MTG Forge Related Programming Questions Here

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

Re: Scry

Postby Marek14 » 29 Jan 2010, 07:01

Rob Cashwalker wrote:Making these abilities function is one thing.... Coming up with some logical rules to make educated plays is insanity.
Without look-ahead, it's hard... the best I can come up with would be to give each card a function to determine its worth based on the actual game state (simple things, like Goblin King adds points for Goblins on your side, and substracts points for opponent's ones, etc.). I could come up with some plausible ones. Even static numbers would be ok for start.

With scry, the algorithm would go like this:

Compute the average value of a card in your library (based on deck contents and cards that are already in other zones).
Every card seen with scry whose value is LOWER than average goes on the bottom.
Cards with HIGHER than average values are left on top, with the highest-valued card first.
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Scry

Postby zerker2000 » 29 Jan 2010, 07:39

This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Scry

Postby Marek14 » 29 Jan 2010, 09:50

zerker2000 wrote:This "value" would probably be quite useful in many other cases, the most obvious being AI currently picking all discards at random.
Yes, the problem is that card values are all conditional - and I am not very good player so I really can't determine them.

But let's say, for example, that a value of land depends on how many lands you already have on the battlefield (i.e. first land has value 10, each other value equal to previous times 0.9). That would give an useful rule when to wish for more lands and when not.

The basic value of a creature could take into account the sum of its power and toughness, since those can change (and frequently do).
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Scry

Postby Rob Cashwalker » 29 Jan 2010, 16:41

The AI doesn't have to discard at random. I wrote an AI routine to discard cards based on certain elements of the game state. Just some basic logic based on lands in play and the ability to play spells in hand. If it seems too dumb, then the great thing is, it only needs to be changed in one place.

The problem with a general value is that it does need to be constantly recalculated anyway, and the value would be different in different scenarios. The value on a 8/8 monster is different when deciding to discard on turn 3 or deciding to attack with it, or deciding on using it for a sacrifice effect.
A number of these types of decisions are too card-specific, so the AI for those decisions is localized. Some of the situations can be generalized into a central method, so we at least have consistency and a bit of code reduction. Like I did with discard... however, I did not change any of the existing spells that involve discard decisions, and I don't know of any new code that has made use of it other than when discard is used as a Drawback$.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Scry

Postby Chris H. » 21 Feb 2010, 01:15

I finally got around to making a commit with the 4 new scry cards. They look good except for:


The spell description looks like:

Destroy target artifact.Scry 2 (To scry X, look at the top X cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.)
`
I am assuming that the spell description builder code needs to add a new line to the end and that this will take care of this merging of the two text strings. Is that a good idea or am I missing something?
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: Scry

Postby Rob Cashwalker » 21 Feb 2010, 04:35

The new line thing needs to be in Card.getText, I think.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 41 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 41 users online :: 0 registered, 0 hidden and 41 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 41 guests

Login Form