Sealed Deck development part 2
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
52 posts
• Page 3 of 4 • 1, 2, 3, 4
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Sealed Deck development part 2
by RumbleBBU » 18 Sep 2012, 13:40
Just a dumb little related query...what is the easiest/preferred way to fetch a collection (List or something) of all cards in a set? I've added a function to CardDb.java to return allCardsBySet but I'm having trouble trying to do anything meaningful with the Map object that returns...
(As a workaround, I simply used getAllCards instead and then performed string comparison to get the cards for the correct edition codes...)
(As a workaround, I simply used getAllCards instead and then performed string comparison to get the cards for the correct edition codes...)
Re: Sealed Deck development part 2
by RumbleBBU » 18 Sep 2012, 16:56
I've committed my current MetaSet code now. It is fully functional, although the set combination code is not pretty (but it gets the job done). I also added a sample in the Fantasy Block that illustrates the use of each method (you'll find it in "Fantasy Blocks", it's called "(3) Metaset Sample".
Maybe I should write a short 'howto' that explains how to use MetaSets to build custom blocks?
Maybe I should write a short 'howto' that explains how to use MetaSets to build custom blocks?
Re: Sealed Deck development part 2
by friarsol » 19 Sep 2012, 17:34
I was able to get Sideboarding functional using the DualListBox, and just calling it right before the decks were placed into their respective libraries (since showing the DLB will wait until the window is closed). But actually using it to Sideboard was kind of annoying, especially for Limited where your sideboard is 100 cards, and you really only care about 5 of them. Also, since the DLB wasn't designed to take multiple instances into account like the Deck Editor is, Each Basic Land was taking up 10-20 entries in the List.friarsol wrote:Yea sideboarding is quite an endeavor. One of the reasons I started doing the Dual List Box was to see if I could get Sideboarding working, but figured I wouldn't be taking a look at it for another month or so. I should be able to add some code into DLB to have better support for using it with sideboards.RumbleBBU wrote:Well, if somebody wants to give it a try it with dual listboxes, be my guest...
ATM, I'm slightly frustrated with sideboarding after two failed attempts (both of which took quite a bit of work). I think I'll work on something different next.
If the Sideboard was only going to be 15 cards, it would probably be good enough for now. However, I think I won't commit what I have, and see if there's a slightly better way of going about Sideboarding, hopefully with reusing the Deck Editor in some form.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Sealed Deck development part 2
by Chris H. » 19 Sep 2012, 17:49
RumbleBBU wrote:I've committed my current MetaSet code now. It is fully functional, although the set combination code is not pretty (but it gets the job done). I also added a sample in the Fantasy Block that illustrates the use of each method (you'll find it in "Fantasy Blocks", it's called "(3) Metaset Sample".
Maybe I should write a short 'howto' that explains how to use MetaSets to build custom blocks?
Sounds good to me. If you put something together we can add it to the end of the readme.txt file for the moment.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Sealed Deck development part 2
by RumbleBBU » 20 Sep 2012, 09:25
My "short" howto grew in writing, so I decided to post is as an article instead:Chris H. wrote:RumbleBBU wrote:I've committed my current MetaSet code now. It is fully functional, although the set combination code is not pretty (but it gets the job done). I also added a sample in the Fantasy Block that illustrates the use of each method (you'll find it in "Fantasy Blocks", it's called "(3) Metaset Sample".
Maybe I should write a short 'howto' that explains how to use MetaSets to build custom blocks?
Sounds good to me. If you put something together we can add it to the end of the readme.txt file for the moment.
viewtopic.php?f=26&t=8164
I'm including a text version in this message in case you want to include it in the game distribution.
- Attachments
-
HOWTO_CustomizeSealedDeckFantasyBlocks.txt
- (9 KiB) Downloaded 364 times
Re: Sealed Deck development part 2
by RumbleBBU » 20 Sep 2012, 09:38
I don't know if this is of any use to you, but here are the modified files for my two failed attempts. Version 1 is the one that adds a "Sideboard" button to the win/lose view and loses track of game status after sideboarding. Version 2 is the one that asks you whether you want to sideboard and if you do, it will start spawning lots of new games.friarsol wrote:If the Sideboard was only going to be 15 cards, it would probably be good enough for now. However, I think I won't commit what I have, and see if there's a slightly better way of going about Sideboarding, hopefully with reusing the Deck Editor in some form.
Maybe you (or someone else) can figure out what went wrong with these?
- Attachments
-
sideboarding_two_nonworkingsolutions.zip
- (26.32 KiB) Downloaded 343 times
Re: Sealed Deck development part 2
by friarsol » 20 Sep 2012, 12:15
I can take a look at some point. Basically all I did is wait till the newGame was about to be actuated, checked the size of the sideboard and launched a DualListBox with the sideboard in the left list, and the main deck in the right. No asking questions, no extra buttons. If you don't want to sideboard, you can just press ok. Whatever you chose in the right box would be loaded into your deck instead of your originally saved deck.RumbleBBU wrote:I don't know if this is of any use to you, but here are the modified files for my two failed attempts. Version 1 is the one that adds a "Sideboard" button to the win/lose view and loses track of game status after sideboarding. Version 2 is the one that asks you whether you want to sideboard and if you do, it will start spawning lots of new games.
Maybe you (or someone else) can figure out what went wrong with these?
- Attachments
-
Sideboard.zip
- (1.5 KiB) Downloaded 337 times
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Sealed Deck development part 2
by Chris H. » 21 Sep 2012, 00:39
RumbleBBU wrote:My "short" howto grew in writing, so I decided to post is as an article instead:
viewtopic.php?f=26&t=8164
I'm including a text version in this message in case you want to include it in the game distribution.
Thank you BBU. I decided to add it to the new Forge User Guide section of the forge wiki.

-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Sealed Deck development part 2
by RumbleBBU » 25 Sep 2012, 10:02
I have just committed updated version of the MetaSet code, including the new UnOpenedMeta class that is required for some of the new types. This should make the guild-specific boosters in RtR possible.
The new MetaSet types are:
choose1 - the data field contains a semicolon (;) separated list of MetaSets, player gets to choose one when starting the game. The AI selects randomly but prefers to choose many of the same option if available (rather than get a totally random option every time).
random1 - like above but you get one random MetaSet from the possible options.
combo - allows you to combine all MetaSets listed in the data field into a single cardpool and build a booster from that pool.
booster, pack - these are simply helper types to allow for more options (ordinary booster, ordinary starter pack) in the above new types.
Long story short, I believe the code works now. More extensive documentation and examples to follow later.
The new MetaSet types are:
choose1 - the data field contains a semicolon (;) separated list of MetaSets, player gets to choose one when starting the game. The AI selects randomly but prefers to choose many of the same option if available (rather than get a totally random option every time).
random1 - like above but you get one random MetaSet from the possible options.
combo - allows you to combine all MetaSets listed in the data field into a single cardpool and build a booster from that pool.
booster, pack - these are simply helper types to allow for more options (ordinary booster, ordinary starter pack) in the above new types.
Long story short, I believe the code works now. More extensive documentation and examples to follow later.
Re: Sealed Deck development part 2
by RumbleBBU » 26 Sep 2012, 12:14
As promised, here is the updated 'how-to' for the new MetaSet types. I won't post this to the actual how-to thread yet, I'm waiting until the functionality is in the beta (so the how-to and the beta go in sync).
MetaSets: The Next Level
The newest versions of Forge (as of this writing, only in the svn codebase!) add 5 new MetaSet types: choose1, random1, combo, booster and pack.
The last two ("booster" and "pack") are pretty unspectacular. They are there mainly to allow more options for the first three. (You can use "booster" and "combo" to define individual MetaSets if you like, but that would be sort of pointless - easier to just use regular "Set(x)" definitions instead.)
Now what you really need to know about are the first three. They are MetaSets that contain...believe it or not, more MetaSets! The type describes what you want to do with the included MetaSets:
choose1: For this booster, you can choose which of the included MetaSets you want to use. The main purpose of this MetaSet type is to enable guild booster selection in Return to Ravnica. Since an included MetaSet can also be a cube, the different guild booster cardpools could be added as cubes, and the cube MetaSets, in turn, in a choose1 MetaSet. But you can find lots of other uses for this MetaSet type - again, use your imagination! Note that the AI is currently coded to prefer similar boosters to a totally random selection of boosters. It picks the first one at random but after that it is always more likely to pick one more similar booster (if available) than a random different one.
random1: Like above except that you do not get to choose the MetaSet. Instead, you get a booster based on one randomly picked MetaSet from those included in the random1 MetaSet definition.
combo The next step for the "meta" MetaSet type. Instead of letting you form a cardpool on free selection of different editions, this lets you build a cardpool based on MetaSets. In other words, now you can mix and match cubes and official sets to form a single booster. Note that if you include a "full" type MetaSet in the combo definition, it doesn't really matter what other MetaSets you include - full cardpool will be used anyway.
There are some limitations on what kinds of MetaSets can be included in choose1, random1 and combo MetaSets. The following types are ok:
cube
full
meta
booster
pack
The 3 special 'recursive' MetaSet types (choose1, random1, combo) should not be included. They will either be ignored, cause errors or cause unpredictable game behavior. Think of the MetaSet recursion as Flashback recursion, not Buyback!
To illustrate how the new MetaSet types work, let's look at this sample block (included in fantasyblocks.txt):
Let's dissect that block definition. The most important thing to realize is that there are only 3 top-level MetaSets defined in this block, i.e., 3 different set choices that are offered in the set distribution configuration. They are all enclosed with |'s and start "Meta(x)...". Here is the first one:
So the lengthy Meta0 definition above can be broken down into these 3 elements:
type: CHOOSE1
I.e., the new type that lets you choose one of options that are defined in the data field.
data: CUBE/ArabianExtended/ArabianExtended;FULL/*/*;META/ICE,ALL,HML,CSP/IceAgeBlockExtended;BOOSTER/2ED/Unlimited;PACK/4ED/4th Edition
This really is a list of no fewer than 5 separate MetaSets in one! In order, they are:
CUBE/ArabianExtended/ArabianExtended - the "Extended Arabian Nights" sample cube that is included to demonstrate MetaSet functionality.
FULL/*/* - the full cardpool. If you select this option, the generated booster can contain (theoretically) any implemented card.
META/ICE,ALL,HML,CSP/IceAgeBlockExtended - An ad-hoc sub-block that combines the original Ice Age block (Ice Age, Homelands, Alliances) and the retroactively added Coldsnap into a single cardpool.
BOOSTER/2ED/Unlimited - generates an Unlimited (2ED) booster.
PACK/4ED/4th Edition - generates a Fourth Edition (4ED) starter pack. Yes, this option will give you more cards than the other four.
Two important notes:
1) The Metasets in the data field must be separated with semicolons (;), otherwise they won't parse correctly! Rule of thumb: use a semicolon (;) to separate the MetaSets in a "choose1"/"random1"/"combo" type MetaSet, and a comma (,) to separate the sets in a "meta" type MetaSet.
2) The display names for included "nested" MetaSets will be displayed in a separate listbox for you to select, so it's ok to use longer and more descriptive display names here. (You don't need to worry about crowding the selection box.)
display name: CHOOSE
This is the display name that is used for the whole "choose1" type MetaSet in the normal set distribution selection box. This should be an abbreiation or the selection box will look crowded and messy.
That wasn't too bad after all, was it? Let's move on.
FULL/*/* - the full cardpool.
META/CHK,BOK,SOK/KAMI - an ad-hoc Kamigawa block.
BOOSTER/8ED/8ED - an 8th Edition booster.
For "random1" MetaSets, the display names of the included sub-MetaSets are very irrelevant, since they are never shown. You just need to put something there or the line will not parse correctly.
The final parameter, "RANDOM", is the display name of the main MetaSet, and it will displayed in the set distribution selection box.
Finally, we have an example of a "combo" type MetaSet:
COMBO/CUBE/juzamjedi/JZJEDI - The JuzamJedi cube, obviously.
META/USG,ULG,UDS/URZA - an ad-hoc Urza block.
PACK/M13/M13 - M13 starter pack (meaning any cards that could be in the pack)
BOOSTER/TSB/TimeShift - a "time-shifted" booster pack (meaning any cards that could be in the pack)
Again, the display names are pretty much irrelevant (not shown). Only the main display name ("COMBO") will be shown.
...and that's it. really. Now you know how to use the new MetaSet types.
Now, how to build "guild boosters" using them?
First, you would build cubes that contain the cards that could be included in the guild booster pack, i.e., one for each of the following guilds: Azorius, Izzet, Rakdos, Golgari, Selesnya. ...Drat, my favorite guild isn't on the list! (h, you ask what it is? Well, my username gives you a not-so-subtle clue.)
Then you would add the following MetaSet to your block definition (edit for the actual cube names, if different):
MetaSets: The Next Level
The newest versions of Forge (as of this writing, only in the svn codebase!) add 5 new MetaSet types: choose1, random1, combo, booster and pack.
The last two ("booster" and "pack") are pretty unspectacular. They are there mainly to allow more options for the first three. (You can use "booster" and "combo" to define individual MetaSets if you like, but that would be sort of pointless - easier to just use regular "Set(x)" definitions instead.)
Now what you really need to know about are the first three. They are MetaSets that contain...believe it or not, more MetaSets! The type describes what you want to do with the included MetaSets:
choose1: For this booster, you can choose which of the included MetaSets you want to use. The main purpose of this MetaSet type is to enable guild booster selection in Return to Ravnica. Since an included MetaSet can also be a cube, the different guild booster cardpools could be added as cubes, and the cube MetaSets, in turn, in a choose1 MetaSet. But you can find lots of other uses for this MetaSet type - again, use your imagination! Note that the AI is currently coded to prefer similar boosters to a totally random selection of boosters. It picks the first one at random but after that it is always more likely to pick one more similar booster (if available) than a random different one.
random1: Like above except that you do not get to choose the MetaSet. Instead, you get a booster based on one randomly picked MetaSet from those included in the random1 MetaSet definition.
combo The next step for the "meta" MetaSet type. Instead of letting you form a cardpool on free selection of different editions, this lets you build a cardpool based on MetaSets. In other words, now you can mix and match cubes and official sets to form a single booster. Note that if you include a "full" type MetaSet in the combo definition, it doesn't really matter what other MetaSets you include - full cardpool will be used anyway.
There are some limitations on what kinds of MetaSets can be included in choose1, random1 and combo MetaSets. The following types are ok:
cube
full
meta
booster
pack
The 3 special 'recursive' MetaSet types (choose1, random1, combo) should not be included. They will either be ignored, cause errors or cause unpredictable game behavior. Think of the MetaSet recursion as Flashback recursion, not Buyback!

To illustrate how the new MetaSet types work, let's look at this sample block (included in fantasyblocks.txt):
- Code: Select all
Index:27|Meta0:CHOOSE1/CUBE/ArabianExtended/ArabianExtended;FULL/*/*;META/ICE,ALL,HML,CSP/IceAgeBlockExtended;BOOSTER/2ED/Unlimited;PACK/4ED/4th Edition /CHOOSE|Meta1:RANDOM1/FULL/*/*;META/CHK,BOK,SOK/KAMI;BOOSTER/8ED/8ED/RANDOM|Meta2:COMBO/CUBE/juzamjedi/JZJEDI;META/USG,ULG,UDS/URZA;PACK/M13/M13;BOOSTER/TSB/TimeShift/COMBO|Name:(3) Metaset Sample 2|DraftPacks:3|LandSetCode:2ED|SealedPacks:6
Let's dissect that block definition. The most important thing to realize is that there are only 3 top-level MetaSets defined in this block, i.e., 3 different set choices that are offered in the set distribution configuration. They are all enclosed with |'s and start "Meta(x)...". Here is the first one:
- Code: Select all
Meta0:CHOOSE1/CUBE/ArabianExtended/ArabianExtended;FULL/*/*;META/ICE,ALL,HML,CSP/IceAgeBlockExtended;BOOSTER/2ED/Unlimited;PACK/4ED/4th Edition /CHOOSE
So the lengthy Meta0 definition above can be broken down into these 3 elements:
type: CHOOSE1
I.e., the new type that lets you choose one of options that are defined in the data field.
data: CUBE/ArabianExtended/ArabianExtended;FULL/*/*;META/ICE,ALL,HML,CSP/IceAgeBlockExtended;BOOSTER/2ED/Unlimited;PACK/4ED/4th Edition
This really is a list of no fewer than 5 separate MetaSets in one! In order, they are:
CUBE/ArabianExtended/ArabianExtended - the "Extended Arabian Nights" sample cube that is included to demonstrate MetaSet functionality.
FULL/*/* - the full cardpool. If you select this option, the generated booster can contain (theoretically) any implemented card.
META/ICE,ALL,HML,CSP/IceAgeBlockExtended - An ad-hoc sub-block that combines the original Ice Age block (Ice Age, Homelands, Alliances) and the retroactively added Coldsnap into a single cardpool.
BOOSTER/2ED/Unlimited - generates an Unlimited (2ED) booster.
PACK/4ED/4th Edition - generates a Fourth Edition (4ED) starter pack. Yes, this option will give you more cards than the other four.

Two important notes:
1) The Metasets in the data field must be separated with semicolons (;), otherwise they won't parse correctly! Rule of thumb: use a semicolon (;) to separate the MetaSets in a "choose1"/"random1"/"combo" type MetaSet, and a comma (,) to separate the sets in a "meta" type MetaSet.
2) The display names for included "nested" MetaSets will be displayed in a separate listbox for you to select, so it's ok to use longer and more descriptive display names here. (You don't need to worry about crowding the selection box.)
display name: CHOOSE
This is the display name that is used for the whole "choose1" type MetaSet in the normal set distribution selection box. This should be an abbreiation or the selection box will look crowded and messy.
That wasn't too bad after all, was it? Let's move on.
- Code: Select all
Meta1:RANDOM1/FULL/*/*;META/CHK,BOK,SOK/KAMI;BOOSTER/8ED/8ED/RANDOM
FULL/*/* - the full cardpool.
META/CHK,BOK,SOK/KAMI - an ad-hoc Kamigawa block.
BOOSTER/8ED/8ED - an 8th Edition booster.
For "random1" MetaSets, the display names of the included sub-MetaSets are very irrelevant, since they are never shown. You just need to put something there or the line will not parse correctly.
The final parameter, "RANDOM", is the display name of the main MetaSet, and it will displayed in the set distribution selection box.
Finally, we have an example of a "combo" type MetaSet:
- Code: Select all
Meta2:COMBO/CUBE/juzamjedi/JZJEDI;META/USG,ULG,UDS/URZA;PACK/M13/M13;BOOSTER/TSB/TimeShift/COMBO
COMBO/CUBE/juzamjedi/JZJEDI - The JuzamJedi cube, obviously.
META/USG,ULG,UDS/URZA - an ad-hoc Urza block.
PACK/M13/M13 - M13 starter pack (meaning any cards that could be in the pack)
BOOSTER/TSB/TimeShift - a "time-shifted" booster pack (meaning any cards that could be in the pack)
Again, the display names are pretty much irrelevant (not shown). Only the main display name ("COMBO") will be shown.
...and that's it. really. Now you know how to use the new MetaSet types.
Now, how to build "guild boosters" using them?
First, you would build cubes that contain the cards that could be included in the guild booster pack, i.e., one for each of the following guilds: Azorius, Izzet, Rakdos, Golgari, Selesnya. ...Drat, my favorite guild isn't on the list! (h, you ask what it is? Well, my username gives you a not-so-subtle clue.)
Then you would add the following MetaSet to your block definition (edit for the actual cube names, if different):
- Code: Select all
Meta0:CHOOSE1/CUBE/AzoriusCube/Azorius Guild;CUBE/IzzetCube/Izzet Guild;CUBE/RakdosCube/Rakdos Guild;CUBE/GolgariCube/Golgari Guild;CUBE/SelesnyaCube/Selesnya Guild/GUILD
Last edited by RumbleBBU on 26 Sep 2012, 17:41, edited 1 time in total.
Re: Sealed Deck development part 2
by moomarc » 26 Sep 2012, 16:32
Now if we could get someone to write a How-To like this for the rest of Forge we'd never have any confusion ever again
Thanks Rumble! Looks awesome!

Thanks Rumble! Looks awesome!
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Sealed Deck development part 2
by RumbleBBU » 26 Sep 2012, 17:40
Come to think of it, the above suggested 'guild booster' example is actually sub-optimal. Since we are talking a "choose1" type MetaSet, the display names are relevant and should definitely be more informative than "AZRC", "IZTC", and so on.RumbleBBU wrote:Then you would add the following MetaSet to your block definition (edit for the actual cube names, if different):If included in a Sealed Deck game, this would allow the player to choose one of the included guild "cubes" as the booster base. (Obviously, this is still untested.)
- Code: Select all
Meta0:CHOOSE1/CUBE/AzoriusCube/AZRC;CUBE/IzzetCube/IZTC;CUBE/RakdosCube/RKDC;CUBE/GolgariCube/GLGC;CUBE/SelesnyaCube/SLSC/GUILD
And since we have more room available in the "choose1" selection box, let's be verbose. This would be better:
- Code: Select all
Meta0:CHOOSE1/CUBE/AzoriusCube/Azorius Guild;CUBE/IzzetCube/Izzet Guild;CUBE/RakdosCube/Rakdos Guild;CUBE/GolgariCube/Golgari Guild;CUBE/SelesnyaCube/Selesnya Guild/GUILD
Of course, if the card/guild booster associations were indicated with specific set codes in the card data, it would be even simpler to use the set codes and the new "booster" MetaSet type instead of cubes. Example (with imaginary four-letter subset codes):
- Code: Select all
Meta0:CHOOSE1/BOOSTER/GAZO/Azorius Guild;BOOSTER/GIZZ/Izzet Guild;BOOSTER/GRAK/Rakdos Guild;BOOSTER/GGOL/Golgari Guild;BOOSTER/GSEL/Selesnya Guild/GUILD
Re: Sealed Deck development part 2
by mcrawford620 » 27 Sep 2012, 19:39
Sounds sweet. Are you going to actually build the guild cubes for these examples? I'd love to try out the idea.
- mcrawford620
- Posts: 112
- Joined: 25 Jun 2012, 16:59
- Has thanked: 55 times
- Been thanked: 25 times
Re: Sealed Deck development part 2
by moomarc » 27 Sep 2012, 20:08
First we need to script more of the cards. At the moment I think Azorius is the most complete with all the white cards scripted (except for the Angel which it looks like ArsenalNut is working on. I got quite far with multiple origin zones at one stage, but started running into problems with replacement effects and one or two other bits that check Origin. Good luck Arsenal!)mcrawford620 wrote:Sounds sweet. Are you going to actually build the guild cubes for these examples? I'd love to try out the idea.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
52 posts
• Page 3 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 36 guests