Elements the Game Forum - Free Online Fantasy Card Game

Elements the Game => General Discussion => Topic started by: Xenocidius on November 05, 2011, 01:57:51 am

Title: Coding of the Game's AI (v1.293)
Post by: Xenocidius on November 05, 2011, 01:57:51 am
Here (http://elementscommunity.org/wiki/articles/coding-of-the-game-ai/) is the Wiki article I wrote on the coding of the game's AI.

It is basically an updated version of Chriskang's Sandbox (http://elementsthegame.wikia.com/wiki/User:Chriskang).

If you have any questions feel free to ask.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Brontos on November 05, 2011, 02:21:06 am
Very informative! Thanks.

Why don't you check hand size before playing Shard of Serendipity?
Right now, AI wastes cards by playing it with hand full, and the algo line confirms this.

Adding random is good for variety, but creates "AI mistakes", like when AI doesn't use a free hostile skill it can use. Why don't you run another check at the end of the target finding to be sure that the skill has been used (or reduce the random factor influence)? I see flying Eternity with SoR not using their skill on my creatures quite frequently.

Hope I didn't miss something when I looked into this. :)
Title: Re: Coding of the Game's AI (v1.293)
Post by: Xenocidius on November 05, 2011, 02:29:44 am
Why don't you check hand size before playing Shard of Serendipity?
Because I'm not zanzarino.

I imagine it will do that soon, but for now ... the AI's just stupid with SoSe.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Brontos on November 05, 2011, 02:57:12 am
That's the answer I was waiting for.  :P
Thanks for sharing anyway. ;)
Title: Re: Coding of the Game's AI (v1.293)
Post by: OldTrees on November 05, 2011, 03:50:22 am
Wow the AI has learned a lot since the last sandbox update.

Is there any place in the AI code that you think the AI is mistaken?
Title: Re: Coding of the Game's AI (v1.293)
Post by: Xenocidius on November 05, 2011, 03:59:35 am
Considering that sandbox was written, what, before version 1? It has learned quite a bit. ::)

As mentioned, it's not very smart with Shard of Serendipity. This should and probably will be fixed.

Strangely, it seems that it now plays Purify with no regard for poison damage. It used to play it if (poison currently suffered by AI > AI HP/20). Considering few decks use poison, maybe playing Purify immediately is smarter. Or maybe not.

By mistaken do you mean the coding is wrong/buggy or just that there could be a better way of doing it?
Title: Re: Coding of the Game's AI (v1.293)
Post by: OldTrees on November 05, 2011, 04:23:00 am
Considering that sandbox was written, what, before version 1? It has learned quite a bit. ::)

As mentioned, it's not very smart with Shard of Serendipity. This should and probably will be fixed.

Strangely, it seems that it now plays Purify with no regard for poison damage. It used to play it if (poison currently suffered by AI > AI HP/20). Considering few decks use poison, maybe playing Purify immediately is smarter. Or maybe not.

By mistaken do you mean the coding is wrong/buggy or just that there could be a better way of doing it?
You answered my question. I was wondering where the AI might have room for improvement. SoSer looks likely. Purify might be changed to a hybrid of the two strategies if poison gains more popularity from SoSac.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Xenocidius on November 05, 2011, 04:32:35 am
Hybrid of the two strategies ... that would be good. I'd do something like:
And for SoSe, a rough idea would be:
Fun speculation, anyway.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Jocko on November 05, 2011, 04:47:09 pm
Maybe play purify according to the quanta production of the enemy, or the cards he play. Wouldn't work against rainbows, but it could hold purify if in presence of a death, life or time deck.
Title: Re: Coding of the Game's AI (v1.293)
Post by: TheonlyrealBeef on November 05, 2011, 04:57:32 pm
Maybe play purify according to the quanta production of the enemy, or the cards he play. Wouldn't work against rainbows, but it could hold purify if in presence of a death, life or time deck.
Suddenly, Mono Darkness spamming Liquid Shadow from Nymphs onto a Voodoo Doll.
Most Life or Time decks don't use Poison either, making it hold it for no good reason, not to mention it might only lead to more waste if other elements end up getting cards that can cause Poison.
Title: Re: Coding of the Game's AI (v1.293)
Post by: furballdn on November 06, 2011, 01:35:04 am
Very useful. Thanks Xeno!
Title: Re: Coding of the Game's AI (v1.293)
Post by: antiaverage on February 02, 2013, 03:39:58 pm
The page on coding the AI is gone, any chance we could have it put back up?
Title: Re: Coding of the Game's AI (v1.293)
Post by: ElementalDearWatson on February 02, 2013, 05:11:51 pm
It'd be long out of date.  This thread is over a year old.
Title: Re: Coding of the Game's AI (v1.293)
Post by: antiaverage on February 13, 2013, 08:11:35 am
It'd be long out of date.  This thread is over a year old.

Indeed, but no other resources I know of on the game AI. Can you point me to one?
Title: Re: Coding of the Game's AI (v1.293)
Post by: Drake_XIV on February 13, 2013, 08:53:43 am
The AI should not have changed much.  Just changing in PC priorities, if I remember correctly?  As well as playing habits of shards like SoSac.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Tirear on February 13, 2013, 06:45:53 pm
The AI should not have changed much.  Just changing in PC priorities, if I remember correctly?  As well as playing habits of shards like SoSac.
Remember the massive change with how the AI treats negative attack creatures? That was after the latest update to the article (Jan 2012). There are also several new cards that didn't exist back then.
Title: Re: Coding of the Game's AI (v1.293)
Post by: Drake_XIV on February 13, 2013, 07:07:13 pm
Ah, yes, Antimatter Priority...
Title: Re: Coding of the Game's AI (v1.293)
Post by: shadow303 on February 13, 2013, 07:40:56 pm
It would be interesting to read about the AI coding, too bad that the links in the first post are dead..
Title: Re: Coding of the Game's AI (v1.293)
Post by: antiaverage on February 14, 2013, 08:29:07 pm
It would be interesting to read about the AI coding, too bad that the links in the first post are dead..

You can still read them via archive. Here:
http://web.archive.org/web/20120329152323/http://elementscommunity.com/wiki/articles/coding-of-the-game-ai/
5 January, 2012 @ 23:32 [Current Revision] by Xenocidius
Title: Re: Coding of the Game's AI (v1.293)
Post by: shadow303 on February 14, 2013, 08:39:31 pm
You can still read them via archive. Here:
http://web.archive.org/web/20120329152323/http://elementscommunity.com/wiki/articles/coding-of-the-game-ai/
5 January, 2012 @ 23:32 [Current Revision] by Xenocidius
Cool, thanks for the information!
blarg: