It is currently 29 Oct 2025, 07:04
   
Text Size

AI Play Improvements

Post MTG Forge Related Programming Questions Here

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

AI Play Improvements

Postby friarsol » 01 Apr 2011, 13:09

The current system we have for AI is to have it check for everything in canPlayAI, leaving a very bloated function and a system that doesn't know which SA is "best" to play. We just know all of them that we can play and take one at random.

As per Issue http://code.google.com/p/cardforge/issues/detail?id=124 I'd like to start a discussion about the possibility of moving over to a two pronged system.

The first prong will be the same as the structure we currently have in place. canPlayAI will check to see if the AI is able to play a spellAbility. This would take care of things that the AI would never play. And also handle situations where the AI is unable to play them due to lack of resources.

The second prong would be a new set of functions that would be called for each SA that passes the canPlayAI step. Let's tentatively call this "shouldPlayAI()". Basically in the AF we would "rate" how good this AF would be. If our rating is <= 0, this represents something that is a waste of resources or bad for the AI. The higher our rating goes represents positive use of an ability. Of course casting Terror on a Shivan Dragon should have a much better rating then casting Terror on a Llanowar Elves. Each AF could have a base rating and gain or lose points on the situation.

Casting Fog? The rating should be improved based on how much damage relative to your current life you would take.

Feel free to add any other thoughts or ways to go about things here, since this is probably even more complex than that.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: AI Play Improvements

Postby Sloth » 01 Apr 2011, 14:20

I support this!
We currently have one evaluation system in place: evaluateCreature
The AI could use it to decide which creature to cast (at the moment it would cast Scathe Zombies before Garruk's Companion just because it costs more) and if it is better to destroy an opponents creature.

Other effects could use the same metric, to be evaluated agains each other.

The base number for creatures is 100.
A lot of guessing and fine tuning is required to evaluate other effects.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: AI Play Improvements

Postby friarsol » 01 Apr 2011, 15:14

Sloth wrote:The base number for creatures is 100.
A lot of guessing and fine tuning is required to evaluate other effects.
I wonder if it would be worth it to put the base values into a file to be read either when the program starts, or better at the beginning of a game. This way we could tweak on the fly for many of these values.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: AI Play Improvements

Postby Jaedayr » 02 Apr 2011, 03:08

All the cards in the game have one or more abilities/keywords. What about giving each of these a standard value, with the actual value of a specific card varying according to game conditions? For example, the AI has mana to cast Abyssal Nightstalker or Abyssal Specter. The value of each could be affected by power, toughness or specific keywords.

AI can cast Absolute Grace or Abolish. The value of abolish would be affected by the best target available (based on creature value described above) while grace would depend on the presence or absence of black creatures.

Within each category - creatures, perm enchantments, temp enchantments, etc. it would not be too hard to come up with a system of ranking the possibilities. What will be a bit more of a challenge is to compare casting a creature to casting an enchantment, especially when you start considering saving mana for an ability later in your turn or during the player turn.
Jaedayr
Tester
 
Posts: 523
Joined: 08 Jul 2010, 00:06
Has thanked: 16 times
Been thanked: 13 times

Re: AI Play Improvements

Postby lazylockie » 19 Apr 2011, 01:48

I've seen somewhere (on this forum perhaps?) something about ranking cards. There was a software under development that the user had to choose between two cards the one he liked the most. After gathering the data it was possible to do some calculations and get a ranking. I remember clearly that there was an example that Baneslayer Angel had (at that time) a ranking of 10/10, based on the data.

I'm talking about this because ranking will always be subjective, as been discussed earlier - why Royal Assassin is 5 to you, when it's 8 to me?
lazylockie
 
Posts: 508
Joined: 13 Jul 2010, 22:44
Has thanked: 74 times
Been thanked: 15 times

Re: AI Play Improvements

Postby Huggybaby » 19 Apr 2011, 03:16

lazylockie, pls see viewtopic.php?f=45&t=3656
User avatar
Huggybaby
Administrator
 
Posts: 3229
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 754 times
Been thanked: 601 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 7 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 7 guests

Login Form