It is currently 21 Nov 2018, 14:07
   
Text Size

Tempest world development

Post MTG Forge Related Programming Questions Here

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

Re: Tempest world development

Postby Seravy » 18 Sep 2017, 08:39

ok, downloading to test those cards/decks then.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 18 Sep 2017, 09:41

Hermit Druid is broken now - AI sends it attacking instead of using the ability. (same problem as Ertai, Wizard Adept and Master Decoy. Should be an AILogic for this "don't attack if enough mana to use ability" tho it should still allow attacks if the damage dealt is very significant (I'd put it at 1/3 of enemy life or higher).
Survival of the Fittest is also broken - The AI activates it at the right time, but it's duplicating the discarded card : it appears in the grave but the AI still has it in hand too.
Spike Weaver seems to be used correctly, don't know if the AI is also able to save mana for it in emergencies? Also don't know if this extends to Constant Mists as well.
Skyshroud War Beast - AI still played it against zero nonbasic lands.
Sudden Impact - AI now plays it at the correct timing but doesn't seem to hold back on playing cards in main phase for it. It really should, every turn of delay allows the enemy to deplete their hand by several cards. Still, this is at least playable now.
Evacuation - AI bounced a Nekrataal which it stole from me along with two 2/2s from my side, and wasn't at risk. Very bad play. I believe it's not worth testing this card further until the generic bounce priorities are implemented.
Storm Seeker - AI didn't play this card (tho I only tried it once as it's not relevant to the current quest world)

I'll update the list with these changes.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Agetian » 18 Sep 2017, 12:30

I'll take a look at Survival of the Fittest, that's a weird problem :) EDIT: Fixed it, I accidentally coded it in such a way that the AI started grabbing discard targets from the library instead of from the hand, lol.

About other things - nope, the AI doesn't hold mana for spells or hold out on attacking with creatures for the sake of using the ability - like I said before, the AI model we're using is, for the most part, deciding on a step-by-step basis, each decision being separate (unfortunately, but it is what it is). It's not even a bug, it's just a quirk of how the AI is coded until we have a better one, if ever (I'm not talking about a better AI logic for a card in this case, I'm actually talking about a better AI with some kind of a coordinated strategy controller for it, or one of those minmax/Monte Carlo things that some other games use that can actually truly predict stuff by playing out scenarios). I tried implementing a simple "conserve mana for Main 2" system a while ago, but that didn't work reliably and crashed more often than not, so it's disabled for the time being. There are some hacks here and there in the code that emulate simple "coordination" for things, such as the recent "hold a combat trick pump until declare blockers" I implemented, but those things, being hacks and all, are not universally applicable to everything and are trickier to code in some places compared to other places. Not saying that it's completely impossible, just that I don't really have a very good idea how to do that without introducing big bugs and/or tangling the code beyond recognition, so... could use some help from someone who maybe has a better idea :D Speaking of which, since you have a really long list of things you'd like to see improved, you're welcome to help along too, you know ;)

Storm Seeker - will see if the AI doesn't specifically play it for some odd reason, but the most likely reason is that it just didn't have the mana at the right [new] timing, since it doesn't save for it (but maybe not). Its implementation appears to mirror that of the Sudden Impact on the superficial side of things though, so it'd be a surprise if these two cards worked differently from each other for the AI (then again, with Forge, you never know :) ). EDIT: It was missing a References declaration in the script, which made the AI unable to find the relevant variable that was used to count the damage dealt to player, so it always thought that it'd deal 0 damage (and spammed the console with a missing reference warning).

Might take a look at why Evacuation was used in that specific spot (seems too suboptimal to be valid for what the original code was meant to do; most likely the AI was just unaware for some reason that Nekrataal was temporarily controlled or something). EDIT: Looked at the code and tested this a bit; basically, in the general (not threatened) case, the AI decides to bounce if the opponent's creatures are worth more than the AI's creatures by the evaluation threshold of about 200, which may be too low (it's about the equivalent of maybe a 3/3 creature or so). I guess that maybe this threshold should be raised to at least 450 or so, which would be equivalent to a 4/4 flyer of Serra Angel caliber. Not sure though, it's difficult to say - this kind of AI is too generic to universally say what is a bad play and what isn't, since it's too situational (and, like you said, requires better bounce priorities in general, which would be somewhat tricky to code and might, thus, take time).

- Agetian
Agetian
Programmer
 
Posts: 3279
Joined: 14 Mar 2011, 05:58
Has thanked: 629 times
Been thanked: 477 times

Re: Tempest world development

Postby Seravy » 18 Sep 2017, 13:32

Speaking of which, since you have a really long list of things you'd like to see improved, you're welcome to help along too, you know ;)
Well, yeah, I intended to do all of this myself in the first place but the project is in a limbo state right now on my side.
I don't have commit rights in the old system and the new system is STILL not functional - migration has taken over 2 full months now without any visible progress.

(Knowing from experience how much detail goes into AI, using patches is absolutely impossible on that - it's unrealistic to expect you to process a dozen new patches every day.)

So instead of what I really want, I'm making quest worlds... but that also needs AI...

...oh well, more time for my Caster of Magic project. That one isn't any less of a time drain than this so I don't mind.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Agetian » 18 Sep 2017, 13:46

Yeah, I can understand that :) And yep, the migration is, sadly, taking a long time to complete - I'm also looking forward to Git, which seems much more advanced and open for the kind of project we're designing. Here's hoping we're going to migrate eventually :)

I'll keep you posted on some of the other AI advances I may have in the meantime ;) They're likely to be rather minor due to RL job pressure, but I'll try to implement a thing or two when I have time :)

- Agetian
Agetian
Programmer
 
Posts: 3279
Joined: 14 Mar 2011, 05:58
Has thanked: 629 times
Been thanked: 477 times

Re: Tempest world development

Postby Seravy » 18 Sep 2017, 14:54

To be sure I don't accidentally lose the files while waiting, here are all the quest world decks made and categorized so far, both AI playable and not.
(rename to zip)
Tempest.txt
(20.09 KiB) Downloaded 49 times
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Agetian » 18 Sep 2017, 15:15

Thanks! This will be handy in some of the further AI experiments I may conduct (always nice to see what exactly you're working with such that cards can be tested in context).

- Agetian
Agetian
Programmer
 
Posts: 3279
Joined: 14 Mar 2011, 05:58
Has thanked: 629 times
Been thanked: 477 times

Re: Tempest world development

Postby Seravy » 13 Feb 2018, 19:19

Now that Git is finally here, I can continue making progress with this one!

Done so far :
-Creatures with important tap abilities that often shouldn't be used precombat like Hermit Druid and Ertai, Wizard Adept got AI that prevents them from attacking unless there is a very good reason to. (this is still being tested as it is added to a fairly large amount of cards)
-AI won't untap Coffin Queen if it reanimates a creature (sent merge request)
-AI plays Necrologia correctly (sent merge request)
-AI doesn't play multiple copies of cards it isn't supposed to, unless the copy in play is enchanted by an opponent (I believe this is as good as we can get it in a reasonable amount of time but we can always impove it more later) - improvement to the "NonStackingEffect" SVar. (this is also still being tested but appears to work fine)
-AI will always activate abilities that counter spells even if it would have a percentage chance to do so normally if it was a spell - improves Null Brooch and Ertai, Wizard Adept. (still need to test this more)

Not much but even these few were enough to make 4 more decks playable. I won't say the AI is very good at playing them, but it meets the bare minimum needed.

At this rate, I don't expect to complete the world any faster than two weeks and might even take months, but there is progress.

A new issue I noticed, the AI doesn't recognize Knight of Dusk 's ability to destroy things, and is afraid to send it to attack. Fortunately I needed the slots for other cards and removed them from the deck, so we can ignore it for now.

Edit : Also done Dream Halls, and the 3 Oaths, testing those in actual games tomorrow. Dream Halls was a huge pain do to but it's a unique and interesting deck so it's probably worth it. We don't get many blocks that have TWO cards that allow putting huge creatures into play without paying their mana cost.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 15 Feb 2018, 01:04

Today's progress, added AI for

Price of Progress
Fireslinger
and improved Sudden Impact , merge requests sent for all three.

Unsure how much of the discussed bounce priorities have been implemented yet. Assuming there is still work to do there, I'd like to ask what functions I can call to determine if a card has a positive or negative enters the battlefield effect? Assuming those functions exist, otherwise, idk, any ideas how to tell them apart? I guess I can detect if it has an enters battle trigger, but telling apart positive and negative effects, idk.(other than marking all cards with an svar which definitely should work as a last resort. Which might be the safest solution in the end otherwise the AI might think of some useless effect like "gain 1 life" as beneficial.)
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby friarsol » 15 Feb 2018, 04:42

Seravy wrote:Today's progress, added AI for

Price of Progress
Fireslinger
and improved Sudden Impact , merge requests sent for all three.

Unsure how much of the discussed bounce priorities have been implemented yet. Assuming there is still work to do there, I'd like to ask what functions I can call to determine if a card has a positive or negative enters the battlefield effect? Assuming those functions exist, otherwise, idk, any ideas how to tell them apart? I guess I can detect if it has an enters battle trigger, but telling apart positive and negative effects, idk.(other than marking all cards with an svar which definitely should work as a last resort. Which might be the safest solution in the end otherwise the AI might think of some useless effect like "gain 1 life" as beneficial.)
Typically negative effects have a "Curse" parameter. Although that might be mostly true for things with targets.
friarsol
Global Moderator
 
Posts: 7306
Joined: 15 May 2010, 04:20
Has thanked: 235 times
Been thanked: 904 times

Re: Tempest world development

Postby Seravy » 15 Feb 2018, 09:16

Checked a random card, Eviscreator, it does not have a curse parameter, so yeah this seems to only be for targeted effects.

I guess I'll have to use Svars then.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 16 Feb 2018, 00:45

Status update : 29 deck tested, working and categorized.
15 decks still require card AI.
A large portion of them have blue - those will need the bounce AI.
I'll probably give up on the Dracoplasm combo deck - it's fun but really weak and would be hard to teach the AI.
The rest I'll probably do after the bounce cards as they generally only affect one or two decks.

Today I made the AI use Spirit Mirror better, had no time for any other cards unfortunately. (try to use up the token actively, and destroy it to trigger grave pacts)

If the amount of blocked decks drop to like 5 or below and doesn't contain decks that are easy to implement AI for, I might proceed to start designing challenges, release the world, and finish up AI for the remaining ones later - depends on how important those decks feel.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 16 Feb 2018, 20:19

Made some pretty good progress on bounce priorities.
It is by no means complete or fully tested yet, but if anyone wants to take a look, this is the branch : https://git.cardforge.org/Seravy/forge/tree/AIBonuce

Haven't yet implemented details needed for Evacuation and Capsize specifically.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 17 Feb 2018, 22:13

Today's progress :
-AI is now saving mana for fog effects until enemy combat phase
-AI will now activate saved fog effect if the source would be destroyed by an enemy spell
-AI will now not send the fog source to attack, but will not keep blockers as it knows there will be no combat damage dealt
-AI now reacts to Awakening with using Tradewind Rider and Capsize (latter not tested yet)
-AI and autopayment no longer fails on Reflecting Pool
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Tempest world development

Postby Seravy » 20 Feb 2018, 11:49

World is ready and will be submitted as soon as the AI changes are all merged.
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 10 guests


Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 10 guests

Login Form