Page 1 of 1

new deck file format

PostPosted: 30 Oct 2009, 10:25
by silly freak
that's my suggestion for the deck format:
Code: Select all
Deckname
[general]
constructed
[main]
20 Plains
38 Squire
1 Absolute Grace
Absolute Law
[sideboard]
Every deck starts with a deck name, then come three sections: [general] for the format, [main] for the main deck, [sideboard] for the sideboard. the last one is obviously empty in this example.
The cards are there as a number, a space and the name. If there's no number, it's assumed as one.
what do you think about individual files for each deck, or should it all be in one file?

also, i'm not sure about booster decks. does every one of the 8 decks have a name, or not?

Re: new deck file format

PostPosted: 30 Oct 2009, 10:34
by Marek14
silly freak wrote:that's my suggestion for the deck format:
Code: Select all
Deckname
[general]
constructed
[main]
20 Plains
38 Squire
1 Absolute Grace
Absolute Law
[sideboard]
Every deck starts with a deck name, then come three sections: [general] for the format, [main] for the main deck, [sideboard] for the sideboard. the last one is obviously empty in this example.
The cards are there as a number, a space and the name. If there's no number, it's assumed as one.
what do you think about individual files for each deck, or should it all be in one file?

also, i'm not sure about booster decks. does every one of the 8 decks have a name, or not?
I would definitely add a comment rule (like "lines starting with // are ignored") to allow things like commenting on individual cards in deck etc.

Re: new deck file format

PostPosted: 30 Oct 2009, 10:40
by silly freak
comments are a little hard, because currently all decks are written back to the file, and the comment would be dropped. We could add an attribute that takes extra lines before [general], but per card would be hard to store and write back...

Re: new deck file format

PostPosted: 30 Oct 2009, 13:52
by Chris H.
Rares wants to have deck files as individual text file in version two. He had mentioned wanting to have a comment section for a description. I wonder if Rares has any ideas that might be helpful. It might prevent us from "re-inventing the wheel". :wink:

Re: new deck file format

PostPosted: 30 Oct 2009, 17:41
by mtgrares
My ideas for version 2 deck file is basically that each deck is stored separately and different directories would hold different "formats" such as sealed, limited, constructed, or anything else that the user wants to create. And to explain this again, there would be a "deck" directory and in that directory it would have the sub-directories "sealed", "limited", "draft" and "constructed". Also, I think that by putting each deck in a separate file would make downloading new decks easy, because the file is downloaded and doesn't have to be added to the "central repository" that holds all decks. AND the user could download a zip file with tons of decks and could easily unzip them into a new directory. (Putting the decks in a new directory would be good because you know that you wouldn't be overwriting any previous decks.)

The user interface (Gui_NewGame and Gui_DeckEditor) would have to be updated to enable the user to change directories.

I've feel that having deck comments would be useful because you could read about a deck that someone else created or make your own comments such as having different versions of the same deck. It would be nice if you could display and edit the comments through the user interface.

If the decks were stored using human, readable plaintext it would be easy to post the decks contents to forums. Currently right now I store the decks in only a computer readable format (I write the Deck object to a HashMap I think, and then write HashMap to the hard drive).

Warning, if you redo MTG Forge's deck system you might have to throw out most (if not all) of the current Deck system. I have done wierd, nastry things to the nice Deck object in order to make it work. On the surface the current Deck class looks very simple but it isn't. In most of the program, I try to use the "higher level" DeckIO class, so if I wanted to update MTG Forge's deck system, I would just write a better DeckIO class.

(This is what I remember that this information may be a little wrong but it will at least point you in the right direction.)

For draft, sealed, and quest I use Deck's object sideboard to hold the total cardpool and I can't remember if the sideboard DOES or DOES NOT include the card that are in the Deck object's main deck. Draft decks are different because they also hold the 8 computer decks that are also generated.

-------------------------------------
And in conclusion, I hope that helps at little. :)

p.s.
You could sideboard during a match if you updated the Deck system to have a sideboard. Gui_WinLose.java would need to have a sideboard button added, Gui_WinLose is what pops up when you win or lose, and Gui_DeckEditor would have to be updated a little.

Re: new deck file format

PostPosted: 30 Oct 2009, 17:52
by mtgrares
Also, i'm not sure about booster decks. does every one of the 8 decks have a name, or not?
No, I forget where I generate the "names" for the computer decks for Gui_NewGame to read, maybe in Gui_BoosterDraft? Also see DeckIO.readBoosterDeck() and writeBoosterDeck() for more details.

You might also want to checkout class BoosterDraft_1 (which is BoosterDraft.java) also controls how the draft works but doesn't do any reading or writing to the hard drive.

And just for kicks check this out from BoosterDraft_1, the blanks is when the user chooses a card.

Code: Select all
  //helps the computer choose which booster packs to pick from
  //the first row says "pick from boosters 1-7, skip 0" since the players picks from 0
  //the second row says "pick from 0 and 2-7 boosters, skip 1" - player chooses from 1
  private final int computerChoose[][] = {
    {  1,2,3,4,5,6,7},
    {0,  2,3,4,5,6,7},
    {0,1,  3,4,5,6,7},
    {0,1,2,  4,5,6,7},
    {0,1,2,3,  5,6,7},
    {0,1,2,3,4,  6,7},
    {0,1,2,3,4,5,  7},
    {0,1,2,3,4,5,6  }
  };

Re: new deck file format

PostPosted: 01 Nov 2009, 20:42
by silly freak
yeah, that looks nice^^
i've looked it up, only the human deck has the name.
my structure now looks like this:
a normal (constructed/sealed) deck is a single file, ending with ".dck"
a booster draft is a directory ending with ".bdk", and containing files 0.dck to 7.dck, where 0.dck is the player's deck, which contains the human's deck

the .dck files look as described above, with the addition of any number of comment lines between the name and [general]
unfortunately, the comment is currently cleared if you edit a deck, because the deck editor creates a new deck object and discards the old one.

Re: new deck file format

PostPosted: 08 Nov 2009, 16:44
by silly freak
okay, deck migration is now running and on SVN. maybe that's a reason to release a new beta ;)

Re: new deck file format

PostPosted: 08 Nov 2009, 19:27
by zerker2000
Since I think I've fixed the reported mana pool bugs, it probably is.

Re: new deck file format

PostPosted: 08 Nov 2009, 19:55
by DennisBergkamp
I agree, both great reasons :)
Hopefully I'll have time to do it today, otherwise sometime this coming week.