New Testing Facility: Setup Battlefield
 Posted: 31 May 2011, 14:42
Posted: 31 May 2011, 14:42UPDATED 01 JUN 2011: New, more intuitive file format, graveyard modification support
UPDATE 2: Setup Battlefield uses a standard file open dialog to open battlefield configurations from custom-named text files.
UPDATE 3: Reflected the modification by keybone in SVN r9251 in this documentation
UPDATE 4: Massive changes to the Setup Battlefield mode, it's now known as Setup Game State and is no longer dependent on order of lines in the text file.
UPDATE 5: Added the ActivePlayer option that allows to define the active player.
UPDATE 6: Added the ActivePhase option that allows to define the current phase.
UPDATE 7: The END tag is no longer required, game state files can contain empty lines and comments preceded by the pound sign (#). Old state setup files are still compatible.
UPDATE 8: Added a possibility to change cards in Exile areas for Human and AI, added an optional ability to specify a specific set for cards spawned through Setup Game State.
UPDATE 9: Made the set info definition for Setup Game State consistent with the deck file format (using the pipe symbol now, e.g. Forest|4ED instead of Forest@4ED).
Hi,
I wanted to inform you that I have successfully coded the initial working implementation of a new testing facility which I'm going to use for my AI improvement experiments and that I believe may be useful to the other developers as well. It's called Setup Game State and may be accessed through the Developer menu when the Forge developer mode is on.
Setup Game State allows you to set up a specific battlefield situation by adding cards onto the battlefield (both human and computer), changing the cards in the human's and computer's hands, and setting up the precise values for the human's and computer's life. Any creatures spawned through Setup Game State will come into play without summoning sickness in order to make the testing of combat situations easier.
Currently the command uses an external text file that is opened through a file open dialog when you click on the Setup Game State menu item. The file structure is simple. It must contain any of the following lines defining what needs to be changed in the current game state:
1) HumanLife=<value> - defines the value to set the human's current life to. Example: HumanLife=6
2) AILife=<value> - defines the value to set the computer opponent's life to. Example: AILife=14
3) HumanCardsInPlay=<card name>; <card name>; <card name>; ... - defines the cards that are to be placed under Human's control on the battlefield. Can be just one card name or a list of card names separated with semicolons. Example: HumanCardsInPlay=Swamp; Swamp; Drudge Skeletons
4) AICardsInPlay=<card name>; <card name>; <card name>; ... - defines the cards that are to be placed under Computer's control on the battlefield. Can be just one card name or a list of card names separated with semicolons. Example: AICardsInPlay=Island
5) HumanCardsInHand=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current hand. Old cards in the Human's card will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
6) AICardsInHand=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current hand. Old cards in the Computer's card will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
7) HumanCardsInGraveyard=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current graveyard. Old cards in the Human's graveyard will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
8] AICardsInGraveyard=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current graveyard. Old cards in the Computer's graveyard will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
9) HumanCardsInLibrary=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current library. Old cards in the Human's library will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
10) AICardsInLibrary=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current library. Old cards in the Computer's library will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
11) HumanCardsInExile=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current exile area. Old cards in the Human's exile area will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
12) AICardsInExile=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current exile area. Old cards in the Computer's exile area will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
13) ActivePlayer=<active_player> - defines the active player that must be given priority when the game state is set up. If this line is absent, the current player is not changed. There are two valid values for this option: Human and AI. Note that this option does not change the current phase, only the current player. Example: ActivePlayer=AI
14) ActivePhase=<current_phase> - changes the current phase of the game to the one specified. The valid values are Untap, Upkeep, Draw, Main1, Declare Attackers, Declare Blockers, Main2, End of Turn, and Cleanup. Note that the phase names are case-sensitive!
SPECIFYING SETS FOR CARDS: When specifying card names, you can optionally add the set code by appending the pipe sign (|) and the three-letter set code to the card name you are spawning. That will allow you to spawn cards from specific sets. For example, HumanCardsInPlay=Mountain; Mountain will just spawn two Mountains on the human battlefield, using the latest possible set for them, while HumanCardsInPlay=Mountain|4ED; Mountain|4ED will spawn two Mountains from the 4th Edition on the human battlefield.
Here are two examples of valid state configuration files:
I hope you'll find this command useful! Currently it's somewhat limited because it doesn't allow you to attach auras and equipments to cards and do other various things like that. Also, note that if the human and/or AI hands, graveyards, exiles, or libraries are replaced with cards through this mode, the cards that were in the respective hands, graveyards, exiles, or libraries before the Setup Game State was called will "disappear" instead of going to the graveyard, exile, or other places. Feel free to expand as necessary.
- Agetian
			UPDATE 2: Setup Battlefield uses a standard file open dialog to open battlefield configurations from custom-named text files.
UPDATE 3: Reflected the modification by keybone in SVN r9251 in this documentation
UPDATE 4: Massive changes to the Setup Battlefield mode, it's now known as Setup Game State and is no longer dependent on order of lines in the text file.
UPDATE 5: Added the ActivePlayer option that allows to define the active player.
UPDATE 6: Added the ActivePhase option that allows to define the current phase.
UPDATE 7: The END tag is no longer required, game state files can contain empty lines and comments preceded by the pound sign (#). Old state setup files are still compatible.
UPDATE 8: Added a possibility to change cards in Exile areas for Human and AI, added an optional ability to specify a specific set for cards spawned through Setup Game State.
UPDATE 9: Made the set info definition for Setup Game State consistent with the deck file format (using the pipe symbol now, e.g. Forest|4ED instead of Forest@4ED).
Hi,
I wanted to inform you that I have successfully coded the initial working implementation of a new testing facility which I'm going to use for my AI improvement experiments and that I believe may be useful to the other developers as well. It's called Setup Game State and may be accessed through the Developer menu when the Forge developer mode is on.
Setup Game State allows you to set up a specific battlefield situation by adding cards onto the battlefield (both human and computer), changing the cards in the human's and computer's hands, and setting up the precise values for the human's and computer's life. Any creatures spawned through Setup Game State will come into play without summoning sickness in order to make the testing of combat situations easier.
Currently the command uses an external text file that is opened through a file open dialog when you click on the Setup Game State menu item. The file structure is simple. It must contain any of the following lines defining what needs to be changed in the current game state:
1) HumanLife=<value> - defines the value to set the human's current life to. Example: HumanLife=6
2) AILife=<value> - defines the value to set the computer opponent's life to. Example: AILife=14
3) HumanCardsInPlay=<card name>; <card name>; <card name>; ... - defines the cards that are to be placed under Human's control on the battlefield. Can be just one card name or a list of card names separated with semicolons. Example: HumanCardsInPlay=Swamp; Swamp; Drudge Skeletons
4) AICardsInPlay=<card name>; <card name>; <card name>; ... - defines the cards that are to be placed under Computer's control on the battlefield. Can be just one card name or a list of card names separated with semicolons. Example: AICardsInPlay=Island
5) HumanCardsInHand=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current hand. Old cards in the Human's card will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
6) AICardsInHand=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current hand. Old cards in the Computer's card will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
7) HumanCardsInGraveyard=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current graveyard. Old cards in the Human's graveyard will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
8] AICardsInGraveyard=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current graveyard. Old cards in the Computer's graveyard will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
9) HumanCardsInLibrary=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current library. Old cards in the Human's library will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
10) AICardsInLibrary=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current library. Old cards in the Computer's library will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
11) HumanCardsInExile=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Human's current exile area. Old cards in the Human's exile area will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
12) AICardsInExile=<card name>; <card name>; <card name>; ... - defines the cards that are to replace the Computer's current exile area. Old cards in the Computer's exile area will be removed. Can be just one card name or a list of card names separated with semicolons, see [3] or [4] for examples.
13) ActivePlayer=<active_player> - defines the active player that must be given priority when the game state is set up. If this line is absent, the current player is not changed. There are two valid values for this option: Human and AI. Note that this option does not change the current phase, only the current player. Example: ActivePlayer=AI
14) ActivePhase=<current_phase> - changes the current phase of the game to the one specified. The valid values are Untap, Upkeep, Draw, Main1, Declare Attackers, Declare Blockers, Main2, End of Turn, and Cleanup. Note that the phase names are case-sensitive!
SPECIFYING SETS FOR CARDS: When specifying card names, you can optionally add the set code by appending the pipe sign (|) and the three-letter set code to the card name you are spawning. That will allow you to spawn cards from specific sets. For example, HumanCardsInPlay=Mountain; Mountain will just spawn two Mountains on the human battlefield, using the latest possible set for them, while HumanCardsInPlay=Mountain|4ED; Mountain|4ED will spawn two Mountains from the 4th Edition on the human battlefield.
Here are two examples of valid state configuration files:
- Code: Select all
- HumanLife=5
 AILife=6
 HumanCardsInPlay=Forest; Forest; Forest; Llanowar Elves
 AICardsInPlay=Mountain; Mountain; Mountain
 HumanCardsInHand=Island; Raging Goblin
 AICardsInHand=Swamp; Swamp; Forest
- Code: Select all
- HumanCardsInPlay=Plains|10E
 AICardsInPlay=Mountain; Raging Goblin
 AICardsInGraveyard=Force of Nature; Raging Goblin; Amulet of Kroog
 ActivePlayer=Human
 ActivePhase=Main1
I hope you'll find this command useful! Currently it's somewhat limited because it doesn't allow you to attach auras and equipments to cards and do other various things like that. Also, note that if the human and/or AI hands, graveyards, exiles, or libraries are replaced with cards through this mode, the cards that were in the respective hands, graveyards, exiles, or libraries before the Setup Game State was called will "disappear" instead of going to the graveyard, exile, or other places. Feel free to expand as necessary.

- Agetian

