It is currently 20 Jul 2019, 23:57
   
Text Size

Running AI vs AI matches headless (without gui)

Post MTG Forge Related Programming Questions Here

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

Running AI vs AI matches headless (without gui)

Postby errevs » 07 Mar 2017, 14:14

Hi! I am doing my master thesis on evolutionary deckbuilding in MTG and I am trying to figure out how to calculate the strength of a deck in a population (known as a "fitness function"). Is it possible to run AI vs AI matches in forge from the command line or through an API without the need to interact with the GUI?

All other insights into this are also very welcome.
errevs
 
Posts: 4
Joined: 07 Mar 2017, 14:10
Has thanked: 0 time
Been thanked: 0 time

Re: Running AI vs AI matches headless (without gui)

Postby friarsol » 08 Mar 2017, 00:14

Yep Forge definitely has that capability. We had a pretty big discussion about it last year

viewtopic.php?f=26&t=18446

I can help with any details you can't figure out.
friarsol
Global Moderator
 
Posts: 7457
Joined: 15 May 2010, 04:20
Has thanked: 240 times
Been thanked: 930 times

Re: Running AI vs AI matches headless (without gui)

Postby errevs » 08 Mar 2017, 09:14

Thanks! I am currently trying to run the sim with the .jar file, as I am developing on a Mac. I cannot seem to get the decks loaded. I am testing with the burn deck and the goblins deck from the thread you linked. The error I get is:
Code: Select all
could not load deck - Burn.dck, match cannot start
I have tried to specify the path to load decks form with
Code: Select all
-D /absolute/path/to/decks
to no avail. Any advice?
errevs
 
Posts: 4
Joined: 07 Mar 2017, 14:10
Has thanked: 0 time
Been thanked: 0 time

Re: Running AI vs AI matches headless (without gui)

Postby friarsol » 09 Mar 2017, 00:52

What's the exact command line you are running? And can you give me an 'ls' of that decks folder?
friarsol
Global Moderator
 
Posts: 7457
Joined: 15 May 2010, 04:20
Has thanked: 240 times
Been thanked: 930 times

Re: Running AI vs AI matches headless (without gui)

Postby errevs » 09 Mar 2017, 16:56

The exact command I use is
Code: Select all
java -Xmx1024m -jar forge-gui-desktop-1.5.61-SNAPSHOT-jar-with-dependencies.jar sim -D /Users/my_username/testdecks -d Jund.dck enchantress.dck -q -n 10
I also tried
Code: Select all
java -Xmx1024m -jar forge-gui-desktop-1.5.61-SNAPSHOT-jar-with-dependencies.jar sim -d Jund.dck enchantress.dck -q -n 10 -D  /Users/my_username/testdecks
and variants with or without quotes around the path.

ls of that folder:
Code: Select all
Jund.dck
enchantress.dck
I looked a bit at the source code and it seems that the test to check if -D argument is present is not reached, but I can't be sure as I haven't had the time to dig too deep yet.

By placing the decks I want to check in /Users/my_username/Library/Application Support/Forge/decks/constructed/ I was able to test them, but ideally I would like to use a folder structure for the experiment.
errevs
 
Posts: 4
Joined: 07 Mar 2017, 14:10
Has thanked: 0 time
Been thanked: 0 time

Re: Running AI vs AI matches headless (without gui)

Postby friarsol » 11 Mar 2017, 01:48

Ah I haven't looked at this code in a while. The directory parameter is only if you are using the tournament flag. Soo.. you could either run a two deck tournament with (-t Bracket), which might not make as much sense for your setup.

It looks like the -d parameter isn't working because you just have the .dck files at a random location, and the simulator tries to infer the deck directory for you. So by saying
Code: Select all
-d Jund.dck enchantress.dck
it expects Jund.dck and enchantress.dck to be saved within the Forge structure. Most specifically, this would be inside Forge's User directory, which on a Mac should be something like => <your home directory>/Library/Application Support/Forge/

Once you have your Forge user directory, your decks should be either in decks/constructed or decks/commander as appropriate.

You can use a folder structure for the experiment as long as that folder lives within that root directory. I bet you could even just have a softlink from your existing location inside Forge's constructed folder

Code: Select all
ln -s <your home directory>/Library/Application Support/Forge/decks/constructed/testdecks <your home directory>/testdecks/
and then look for testdecks/Jund.dck
friarsol
Global Moderator
 
Posts: 7457
Joined: 15 May 2010, 04:20
Has thanked: 240 times
Been thanked: 930 times

Re: Running AI vs AI matches headless (without gui)

Postby errevs » 14 Mar 2017, 10:19

Cheers, that works! Thanks a lot for your help!
errevs
 
Posts: 4
Joined: 07 Mar 2017, 14:10
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 2 guests

Login Form