It is currently 12 Sep 2025, 22:16
   
Text Size

Encapsulate Quest Opponents in Deck Files

Post MTG Forge Related Programming Questions Here

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

Encapsulate Quest Opponents in Deck Files

Postby Sloth » 05 Sep 2011, 07:02

To get this controversial issue done, I started this topic for a constructive discussion on how to handle this.

Here's how I imagine this:
- The contents of the special quest files (quest1.dck,...) stay as they are (maybe change Deck Type to something else than constructed), but they may get another file type (like .qst).
- Some class in the quest department will read the additional information from the files, the decklist will still be read by the deckManager.

Is this doable doublestrike?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Encapsulate Quest Opponents in Deck Files

Postby Doublestrike » 05 Sep 2011, 09:30

@Sloth - definitely doable, but I'd like to get some confirmation from others before I start.

=======

Another option I was thinking of that may work with Max mtg's vision is to have regular dck files be handled in the quest. These files could have a standard piece of metadata that referred to a "helper" file.

When that piece of metadata is retrieved, it moves to a class that handles the various types of extras that files need (now and in the future, for the fun possibilities).

For example
Code: Select all
[metadata]
foo=bar
Name=detective.dck
DisplayName=Adrian Monk
HelperFile=puzzles/puzzle172.pzl
[main]
========

I'd also like to tentatively suggest a second option: Introduce a new deck type :dodging-rotten-fruit: that could allow departures from the standard MTG rules, into the flexibility of a digital environment. Limiting ourselves to cardboard rules seems...well...then we should play with cardboard.

For example
Code: Select all
[metadata]
foo=bar
Name=kingofplop.dck
DisplayName=Michael Jackson
DeckType=gauntlet
[main]
========

While we're here, you may have noticed I decoupled the file name from the display name using the metadata. Curious to know the opinion on that.
---
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: Encapsulate Quest Opponents in Deck Files

Postby Sloth » 05 Sep 2011, 09:54

The second option sounds like the way to go (the first is a little bit too clunky for my taste). Clean decklists will be dck files and those with additional metadata will get another file type.

Doublestrike wrote:While we're here, you may have noticed I decoupled the file name from the display name using the metadata. Curious to know the opinion on that.
Don't know if we ever need this, but definitely can't hurt.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 05 Sep 2011, 10:04

Doublestrike wrote:Another option I was thinking of that may work with Max mtg's vision is to have regular dck files be handled in the quest. These files could have a standard piece of metadata that referred to a "helper" file.

When that piece of metadata is retrieved, it moves to a class that handles the various types of extras that files need (now and in the future, for the fun possibilities).
No need for helper file. The same file can be passed to different parsers, one of which would read the deck into its class and another(s) the quest's difficulty, aiLife, extraCards and so on...

That will keep all data in one file and the classes involved clean and simple.
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: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 05 Sep 2011, 10:50

Just commited a fix to Deck class removing metadata, which could contain a lot of data unrelated to deck.

There is a class QuestEvent = it holds the extra data for a battle, not read by DeckManager

In order to complete DoubleStrike's task, he might want to read the extra fields form the quest challenge deckfile into Quest_Assignment class
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: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 05 Sep 2011, 10:58

Moreover, given that QuestQuest decks are moved to a separate directory, we'll no longer need files like easy.txt - these lists will be filled just by iterating over every deck in folder, reading its difficulty and then grouping things into a map difficulty -> list<string> or event list of QuestEvents
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: Encapsulate Quest Opponents in Deck Files

Postby Chris H. » 05 Sep 2011, 12:23

We now have a large number of decks (battle format) that are playable by the AI. Do we want to consider using these decks elsewhere in forge?

People have suggested a gauntlet mode. The AI battle format quest decks could be used here as well.

We also have an option in constructed deck mode where we can select "Random" in the deck selector for ourself and the computer.

Currently, the code randomly selects from among the decks located in the /res/forge/ folder. It might be nice to have an option to have the computer select from among the quest mode battle decks instead.

It might be worthwhile to add a difficulty metadata field to the normal Deck class. Or the difficulty setting could be parsed by looking at the number at the end of the deck name.

Whatever decisions that we make at this time, it would be nice if we could also plan for a system which allows the AI battle format quest decks to be used elsewhere in the game.
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: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 05 Sep 2011, 12:39

Chris H. wrote:It might be worthwhile to add a difficulty metadata field to the normal Deck class. Or the difficulty setting could be parsed by looking at the number at the end of the deck name.

Whatever decisions that we make at this time, it would be nice if we could also plan for a system which allows the AI battle format quest decks to be used elsewhere in the game.
Chris, please... stop mixing up deck with predefined challenge or something else.
I've just REMOVED metadata map from decks, replaced it by some fixed fields, because people start adding there (into the deck class I mean) a lot of unrelated to deck fields, such as opponent's starting lives.

Let's define deck as a set of cards that become player's library when the game starts. All other data is not part of deck - well, it may be stored in one file with deck, but it should have no place in the class.

The difficulty field is already in the deck files, but it's stored into QuestEvent class, which is kinda model for the panels representing opponents in quest mode.
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: Encapsulate Quest Opponents in Deck Files

Postby Chris H. » 05 Sep 2011, 12:55

I am sorry for the confusion.

We have two different types of quest decks. The first is the battle decks and the second type is the special quest decks. My last message is in reference to the battle decks only.

The special quest decks are only useful in the quest mode. These decks all have the file name convention of "quest" + number + ".txt".

The battle decks do not have cards that start in play. These decks start with 20 life and there are no extra reward for beating them. The battle decks all have the file name convention of opponent name + number(1 through 4) + ".txt".

The battle decks are basically a normal deck that contains cards that the computer can use to good effect and therefore provides a good challenge. I am suggesting that we may be able to re-use the battle decks elsewhere in the game.

The special quest decks would be treated differently and they would not be used in a gauntlet mode or as a random deck in constructed mode.
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: Encapsulate Quest Opponents in Deck Files

Postby Sloth » 05 Sep 2011, 13:10

The question is, if we also want to convert the "battle" quest decks to the new file type, because they have some metadata stored in them (like diffifculty) that's only used in quest mode.

I think it would be a good idea. Then all files in the quest\decks folder will have the same file type.

Max mtg wrote:I've just REMOVED metadata map from decks, replaced it by some fixed fields, because people start adding there (into the deck class I mean) a lot of unrelated to deck fields, such as opponent's starting lives.

Let's define deck as a set of cards that become player's library when the game starts. All other data is not part of deck - well, it may be stored in one file with deck, but it should have no place in the class.
Maybe we should leave the Description in the normal deck files too. Maybe we can show it when selcting a deck in the future (some users tend to have hundrets of decks in their folder and I doubt they can remember what deck they were).
Last edited by Sloth on 05 Sep 2011, 13:14, edited 1 time in total.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 05 Sep 2011, 13:11

we may just put those into different folders and neither convention will be needed nor easy.txt hard.txt medium.txt veryhard.txt files.

Yes, that would be nice if these decks were offered for playing in constructed mode.

Sloth wrote:Then all files in the quest\decks folder will have the same file type.
Really all?

Sloth wrote:Maybe we should leave the Description in the normal deck files too. Maybe we can show it when selcting a deck in the future (some users tend to have hundrets of decks in their folder and I doubt they can remember what deck they were).
Comment is still there - well, it can be renamed to description if you'd like to.
Or that separate description field may be added - no matter, the main thing that deck class (not file) should not contain any data affecting match rules.
Last edited by Max mtg on 05 Sep 2011, 14:24, edited 3 times 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: Encapsulate Quest Opponents in Deck Files

Postby friarsol » 05 Sep 2011, 14:02

It sounds like this discussion is suggesting how I originally pictured this feature request in my head.

The Quest Files itself will be one file (including removal of easy.txt, etc). This file will Be parsed by the Quest object that contains a Deck object, which will parse out the deck from that same file. This Deck object will work as Max set it up to work currently. The Quest Object will hold specific metadata about where it can be used.

It might be worth allowing each file to have metadata for all of the non-standard forms of play. That way these Quest files will be available in more than one play-mode at different difficulty levels.

Considering that a Gauntlet mode is for loading a Constructed deck and playing against increasingly difficult opponents, the starting deck is going to be much much better than the starting Quest deck. Some of the Easy Quest Battle decks aren't even appropriate for Gauntlet Mode (such as the Leprechaun deck).

Example:
Code: Select all
[metadata]
Decktype=quest,gauntlet
QuestDifficulty=hard
GauntletDifficulty=medium
[/metadata]
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Encapsulate Quest Opponents in Deck Files

Postby Doublestrike » 06 Sep 2011, 00:25

Max mtg wrote:Let's define deck as a set of cards that become player's library when the game starts. All other data is not part of deck - well, it may be stored in one file with deck, but it should have no place in the class.
Max mtg wrote:the main thing that deck class (not file) should not contain any data affecting match rules.
This sounds like something everyone agrees on, and is a good idea, and should be included in the class documentation somewhere.

So, to further define what we're talking about, it sounds like the metadata can hold any information. Of course, the deck class has a "new" format that can retrieve any meta attribute, instead of the "old" which had specified metadata.

friarsol wrote:It might be worth allowing each file to have metadata for all of the non-standard forms of play.
Max mtg wrote:Comment is still there - well, it can be renamed to description if you'd like to. Or that separate description field may be added
=========

OK, so we've got:
Code: Select all
[metadata] //parsed and returned by deck class but never used by deck class
can=put
anything=relevant
to=the
match=parameters
or=display
[main]
1 only
1 legal
1 cards
4 here
[sideboard]
1 usually
1 strangely
1 empty
1 but
1 has
1 potential
=======

The remaining two questions, for me, are:

1) What to do about starting cards for AI(s) and Human?

2) Where to store tokens?
---
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: Encapsulate Quest Opponents in Deck Files

Postby Max mtg » 06 Sep 2011, 00:34

You may add new sections for them, deckmanager will read only the data it needs (name, main & side). Your parser will grab the rest

You are really free to add anything to metadata, yet I'd suggest storing challenge-related data in its own section.

Also, be sure you have updated your codebase to 10249 at least, where Deck has fixed fields instead of too flexible metadata map.
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: Encapsulate Quest Opponents in Deck Files

Postby Doublestrike » 06 Sep 2011, 01:04

OK, so the structure

Code: Select all
[metadata]
[main]
[sideboard]
[ai_extra_cards]
[human_extra_cards]
is now acceptable?

And, those fields are retrieved by the deck manager class?

And, may "illegal" tokens be stored there with the pattern I described? (as long as they are processed by a non-deck class, like QuestUtil)

Max mtg wrote:Also, be sure you have updated your codebase to 10249 at least
Won't be making that mistake again. :)

Max mtg wrote:where Deck has fixed fields instead of too flexible metadata map
Not sure what you mean by this? It was sounding like the flexible meta was a positive thing?
---
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

Next

Return to Developer's Corner

Who is online

Users browsing this forum: Bing [Bot] and 33 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 34 users online :: 1 registered, 0 hidden and 33 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: Bing [Bot] and 33 guests

Login Form