Monday, November 29, 2010

AI - Continuing saga

(Here is an article written by lazylockie, which is his username on the forums.  You may think this is a cop-out and that I'm extremely lazy and you would be correct on both accounts.  So without further ado...)

In this article I’ll talk about Forge – yeah, obviously – but more specifically about some aspects of Forge’s AI.

Why is the AI weak?
I think the main reason sometimes the AI is so weak is because it doesn’t interact the human on any other phase other Main. This limits a lot the card pool they can effectively use. We know the developers are working on this, but it’s a nice advantage that we players have against them.

For example stuff like Giant Growth, Basking Rootwalla and Sorceress Queen are usually the Achilles Tendon of AI. AI happily attacks with a White Knight onto your Basking Rootwalla and suddenly you’ve gained advantage on a situation that in real life wouldn’t have happened. Stalemates are more easily broken and often lead into human victory.


AI needs to be generic
How is your general behavior when playing with Jace, the Mind Sculptor? I assume it would be something like: If you’re not playing against burn or there’s no threat on opponent’s field, Brainstorm. This could be, in pseudo code – albeit probably codeable on Forge:

Jace, the Mind Sculptor behavior
if (there’s a “dangerous” creature on opponent’s field)
  -1 ability targeting that creature

if (loyalty == 1) OR (opponent has a basic land AND loyalty <= 3)
   +2 ability targeting opponent
else
   +0 ability //Brainstorm for card advantage

 The pseudocode above isn’t perfect, but practically covers all common sense functionality of Jace. However, as mtgrares (the author of this bog) already mentioned on past articles, designing an AI behavior for each card created is hard/confusing and even then it might not work as expected, since Magic involves interactions between many cards at same time.

Another example that is often seen is Baneslayer Angel. The little lady is almost auto-win on the hands of a human player if it connects, because common sense says that that gal must attack every turn, even when on board disadvantage, because it has evasion and lifelink. However, AI doesn’t comprehend that Baneslayer has a 10 point life swing, so in dire situations he’ll often leave it for blocking, when he could have attacked and won the battle.

Why the AI prefers simple decks
If there’s one thing that AI is good at is brute force. Anything that is big and cheap is often a good deal for AI. That’s why Affinity decks are so hard on the hands of AI, especially at early levels of Quest mode: big stuff like Myr Enforcer is free and the deck is pretty straightforward. The fewer decisions the deck needs to make, the better AI will handle that deck. Tarmogoyf, considered one of the best creatures on Legacy, fits this function of brute force quite well: easily splashable, low mana investment, grows quickly as game progresses. It amuses me why Tarmogoyf isn’t widely used on AI decks.

(This is mtgrares talking now)
Let me briefly critique the pseudocode.   The AI has a hard time determining if you (the opponent) has a dangerous creature on the field.  How dangerous is dangerous?  Is a flying 2/2 dangerous or does it have to be a flying 4/4?  Royal Assassin is very dangerous bit the AI won't recognize it has dangerous, since it is only a 1/1 and the AI cannot "see" activated abilities.

I would suggest using Jace to look at his opponents library.  If the opponent has less than 6 lands the AI would put basic lands on the bottom of your library and if the opponent has more than 6 lands, do the opposite, put any spell on the bottom of your library.  Then use Jace's ultimate ability to win the game.

And to finish the article on a funny note, "I am the mustard seed of your doom" which is taken from the videogame Mario and Luigi: Bowser's Inside Story. 

--mtgrares

3 comments:

E-mannen said...

Jace is a dream to play with as a human against AI in Quest-mode.

It makes it fairly easy to mill the AI which gives +100gold.

Anonymous said...

Newer build on the forum please! I don't need any new cards just lots of bug fixes!

Chris H said...

The next beta will be released very soon. Over 400+ new cards. Dozens of bug fixes. Several new features made possible by recent developments.

:)