It is currently 19 Apr 2024, 22:49
   
Text Size

About merging Draft and Sealed decks

Post MTG Forge Related Programming Questions Here

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

About merging Draft and Sealed decks

Postby Max mtg » 07 Feb 2012, 21:11

I've been refactoring deckmanager, and found out that sealed and draft decks are technically the same thing. Both represent a set of decks which were build up from a limited cardpool and are supposed to play against each other. The number of decks in a set does not really play any role. We got used that draft is made for 8 players and sealed is played by two, but this can be changed with ease.

So I came up to a conclusion that we don't need the PlayerType, GameType and isCustomCube fields in deckfiles anymore.
A deck is a deck, no matter how it was created or which player should play it. To distinguish them, we'll use different folders for decks.
As for cubes, a decksection can be added into the very limited setup file.

So, I'm about to develop a branch that eliminates deckmanager, allows deckeditor to edit any collections (decks, decksets, limitedSetup)
Last edited by Max mtg on 09 Feb 2012, 20:18, edited 1 time in total.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby Rob Cashwalker » 08 Feb 2012, 15:06

I would tread carefully here. Sealed and Draft Decks have "Sideboards" which are all the extra cards not currently in the "Main" deck. A Constructed deck can't have a sideboard (yet). The deck editor needs to know that it's editing a draft or sealed deck in order to populate the Available Cards grid. A constructed deck would populate the grid with the entire card list.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: About merging Draft and Sealed decks

Postby silly freak » 08 Feb 2012, 16:38

I think max mistyped constructed for draft, and if that's it, unifying those two as "decks with a non infinite card pool" seems a good idea. in theory, at least
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: About merging Draft and Sealed decks

Postby friarsol » 08 Feb 2012, 17:04

silly freak wrote:I think max mistyped constructed for draft, and if that's it, unifying those two as "decks with a non infinite card pool" seems a good idea. in theory, at least
Yea that's how I took it as well, since I was reading it and constructed didn't make sense, but draft would have made sense.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: About merging Draft and Sealed decks

Postby Max mtg » 09 Feb 2012, 07:22

Sure, I'll proceed with care.

No, there was no mistype. Both draft and sealed are just a set of decks built from a limited cardpool. They are technica,lly the same entity - a few decks (2 or 8 for now, but these constants that can be changed with some effort), each deck contains a cardpool for chosen cards and another one (sideboard, yes) for the rest. Draft of sealed - are just different ways how the cards are chosen. You have to pick them one by one or just get the assorted cards, and the the paths are the same. We don't have to restrict sealed to 2 players, there may be 15 ai players for instance, assuming they recieve different boosters thier decks will we interesting to duel against (I wish they could compete each other to make a little tournament, but the AI, hardcoded to play against human, does not allow us to do so yet).
Anyway, after cards are distributed, sealed and drated decks are just the same thing. That's what I would love to implement.

Some people thanked me for the original post, I'm not sure it's a right time. Because that was just an announce to highlight the direction and ask other developers not to tough deck editors for a couple of weeks.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby friarsol » 09 Feb 2012, 13:11

I believe the mistype that we are referring to is the following

I've been refactoring deckmanager, and found out that sealed and constructed decks are technically the same thing
whereas the title of the post says Draft and Sealed. And you just stated Draft and Sealed again right now.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: About merging Draft and Sealed decks

Postby Max mtg » 09 Feb 2012, 20:18

friarsol wrote:I believe the mistype that we are referring to is the following

I've been refactoring deckmanager, and found out that sealed and constructed decks are technically the same thing
whereas the title of the post says Draft and Sealed. And you just stated Draft and Sealed again right now.
Right, there was one - will fix right now in original post.


Add: DeckEditors ... I guess they should be divided too. Constructed will have unlimited cardpool to take cards from, and limited might provide some tools to edit/view ai-picked decks from sealed/draft mode.

Building up a new constructed deck and re-arranging sealed mode deck are quite different paths and they might be found in different places of menu, so it seems to me, they don't have to be together.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby Max mtg » 16 Feb 2012, 19:34

I am still working on it.
There was made a huge refactoring of deck-editor, its menus and even limited game ui was affected

I merge every day and hope it will work the day of commit.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby Chris H. » 19 Feb 2012, 00:32

Should we go ahead and update the SVN by adding the four new subdirectories to the deck folder?

constructed
cube
draft
sealed

What about the three files that are located inside of the decks folder?

JuzamjediCube.dck
SkieraCube-cards_not_supported_yet.txt
SkieraCube.dck

Should we move these three files into the cube folder on the SVN?
User avatar
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: About merging Draft and Sealed decks

Postby Doublestrike » 19 Feb 2012, 02:08

I just upgraded the constructed submenu. Hopefully it will mesh neatly with Max's changes. I'll update as needed once this final folder structure is decided. Quest events will be available soon, after I examine the pre-game inits and whatnot (today).

FYI I'm getting an NPE in OldDeckParser. I've fixed it locally on my machine using a hack around line 126 (below).

Code: Select all
List<String> fileLines = FileUtil.readFile(f);
           Map<String, List<String>> sections = SectionUtil.parseSections(fileLines);
           DeckFileHeader dh = DeckSerializer.readDeckMetadata(sections);
           //////////////////TEMPORARY BUGFIX
           if (dh == null) {
               continue;
           }
           /////////////////
           String name = dh.getName();
           if (dh.isCustomPool()) {
               continue;
           }
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: About merging Draft and Sealed decks

Postby Max mtg » 19 Feb 2012, 06:30

Chris,

Yes, feel free to commit the folders to SVN. Forge will create them anyway if they are missing.

I have to write the conversion code for cubes, their serializer and a dialog with some options in their personal deck editor. Don't move the three files that remain, they will be converted automatically when the code is ready. I'll merge cube into individual files (1-per-cube) from that 2 .dck files and options actually stored in /res/draft and/or /res/sealed folders.

Doublestrike,
There is a deck file that causes the exception, please send it to me.

The folder structure with deck/(gametype) is final. But that is not significant, because a developer who works with decks can use the FolderMap<T> collections to access all decks formerly managed by DeckManager. The collections that are returned from AllZone.getDecks().get(GameType) are instantly syncrhonized to disk. Once you add an item, it gets saved right away, so your code doesn't need to care about the path where they are saved.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby Chris H. » 19 Feb 2012, 13:08

Max mtg wrote:Chris,

Yes, feel free to commit the folders to SVN. Forge will create them anyway if they are missing.
`
When I added the four subdirectories to the decks folder on the SVN all four of these folders are given a hidden file named ".svn". The Mac OS will also give these folders a hidden file named ".DS_Store".

It appears that these hidden files are being read in and handled as a deck file and this may be causing the crash reports.
User avatar
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: About merging Draft and Sealed decks

Postby Max mtg » 19 Feb 2012, 14:41

Chris H. wrote:When I added the four subdirectories to the decks folder on the SVN all four of these folders are given a hidden file named ".svn". The Mac OS will also give these folders a hidden file named ".DS_Store".

It appears that these hidden files are being read in and handled as a deck file and this may be causing the crash reports.
This .svn directory might be the case for draft/sealed decks.
I'll improve the filter to accept only non-hidden directories as potential decksets
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: About merging Draft and Sealed decks

Postby Chris H. » 19 Feb 2012, 15:07

Thank you. :)
User avatar
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: About merging Draft and Sealed decks

Postby Max mtg » 19 Feb 2012, 17:20

Ok, looks like I'm done with deck management.

What was done:
- Eliminated DeckManager class which was a container for all kinds of decks. Now decks are stored in their individual folders arranaged by type. Each folder is read by appropriate deserializer
- Created serializer classes which are to support the FolderMap class that makes changes to disk as items are added/removed to the collection it represents.
- DeckController class is the interface between deckeditors' menus and objects being edited collection. Editors and menus no longer interact with DeckManager directly and do their job (of presenting user an interface to interact with) only
- Refactored DeckEditors' menus, derived a base class and removed duplicate code.
- FileSection utility will help in parses of key-value sections, such as deck metadata or quest challenge options. It reads all K-V pairs to a map with case insensitive keys and allows us to retrieve thier values as strings, boolean or integers.
- There is also a convertor class that will arrange unsorted decks from /res/decks folder to a right folder.

It's time to catch bugs now. I'll keep an eye on this topic and nighty-bugs one.
If you report a crash, the deck-file that caused the problem will be highly appreciated.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 103 guests


Who is online

In total there are 103 users online :: 0 registered, 0 hidden and 103 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 103 guests

Login Form