Quest classes refactoring
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
32 posts
• Page 1 of 3 • 1, 2, 3
Quest classes refactoring
by Max mtg » 10 Mar 2012, 04:37
This is a topic to report problems with the new quest save format.
Commited in 14687
Done:
- separate general quest model from their controllers (to save only model)
- move bazaar settings to separate file
- move items properties to file(s)
- store in quest saves only item level
- move pets and plant properties to files
- enable pet tokens to be read from files of same format as cards
To do:
- fix bugs
- release 1.2.6
- have fun
In some next version:
Set up separate class for quest decks, add pet and plant to quest deck editor
Commited in 14687
Done:
- separate general quest model from their controllers (to save only model)
- move bazaar settings to separate file
- move items properties to file(s)
- store in quest saves only item level
- move pets and plant properties to files
- enable pet tokens to be read from files of same format as cards
To do:
- fix bugs
- release 1.2.6
- have fun
In some next version:
Set up separate class for quest decks, add pet and plant to quest deck editor
Last edited by Max mtg on 21 Mar 2012, 08:05, edited 8 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: Broken quest saves (commited)
by Max mtg » 10 Mar 2012, 23:22
@14707 bazaar settings moved to xml file (deserialized by xstream)
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: Broken quest saves (commited)
by Vernon » 11 Mar 2012, 07:27
Does this mean that the bazaar settings will have a separate file that we will be able to see out of the game? Ex: bazaar.xml in the quest folder in an upcoming beta?
When playing, card text is important. Read and understand it. It will usually prevent most errors.
- Vernon
- Posts: 51
- Joined: 01 Feb 2012, 23:18
- Location: Portland, OR
- Has thanked: 3 times
- Been thanked: 0 time
Re: Broken quest saves (commited)
by Max mtg » 11 Mar 2012, 10:05
It is essential that data is stored apart from code. The former approach where stall names, descriptions were typed right in source files is unacceptable, thus I perform refactoring on all such quest-related compilation units, so expect more data to be moved into external files.Vernon wrote:Does this mean that the bazaar settings will have a separate file that we will be able to see out of the game? Ex: bazaar.xml in the quest folder in an upcoming beta?
Yes, the next beta will keep bazaar settings in some external files. However many of their fields won't be safe to alter. More details will follow as I advance in my work.
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: Broken quest saves (commited)
by friarsol » 11 Mar 2012, 14:16
Hey Max,
Just curious, any reason you used XML instead of something lighter like JSON?
Just curious, any reason you used XML instead of something lighter like JSON?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Broken quest saves (commited)
by Max mtg » 11 Mar 2012, 15:09
I needed a library to read text files right into class fields. There was already XStream linked to our project (actually used for quest saves) and I spent some time digging into it to support old saves.friarsol wrote:Hey Max,
Just curious, any reason you used XML instead of something lighter like JSON?
A siutable json library yet needs to be found and learnt how to use it.
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: Quest classes refactoring
by Max mtg » 11 Mar 2012, 23:26
Ok, @14717
items properties are in file now, one may edit their prices, purchaseNames, sometimes description and maxlevel
items properties are in file now, one may edit their prices, purchaseNames, sometimes description and maxlevel
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: Quest classes refactoring
by Max mtg » 16 Mar 2012, 07:54
Please, provide me with quest-mode tokens saved as txt files in the same format as common cards.
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: Quest classes refactoring
by Chris H. » 16 Mar 2012, 13:58
`Max mtg wrote:Please, provide me with quest-mode tokens saved as txt files in the same format as common cards.
Are you asking for someone to create .txt files for the various quest mode tokens for the pets and plant using our current card scripting system?
-
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: Quest classes refactoring
by Max mtg » 16 Mar 2012, 15:26
Yes, if someone would be so kind to create them.Chris H. wrote:Are you asking for someone to create .txt files for the various quest mode tokens for the pets and plant using our current card scripting system?

This would allow me to remove their hardcoded properties and read pets and plant from external files as if they were cards.
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: Quest classes refactoring
by Chris H. » 16 Mar 2012, 18:25
I have an early first revision of the Wolf Pet for people to look at.
The plant/pets need to have their color set and I see that CardReader? (as of the flip cards) can now handle a color if a card has no mana cost as they can't be cast.
We will need a new "Level" param to be read in I see.
We will also need a specific image name to be associated with the plant/pets.
I added the level number to the file name for each of the wolf pet files to make them unique. All four levels of this pet has the same name and this might create a problem with duplicate card/tokens.
Just a few things to think about and possibly discuss.
`
The plant/pets need to have their color set and I see that CardReader? (as of the flip cards) can now handle a color if a card has no mana cost as they can't be cast.
We will need a new "Level" param to be read in I see.
We will also need a specific image name to be associated with the plant/pets.
I added the level number to the file name for each of the wolf pet files to make them unique. All four levels of this pet has the same name and this might create a problem with duplicate card/tokens.
Just a few things to think about and possibly discuss.

- Wolf Pet | Open
- wolf_pet_level_1.txt
Name:Wolf Pet
ManaCost:no cost
Colors:green
Level:1
Types:Creature Wolf Pet
Text:no text
PT:1/1
ImageName:G 1 1 Wolf Pet
End
wolf_pet_level_2.txt
Name:Wolf Pet
ManaCost:no cost
Colors:green
Level:2
Types:Creature Wolf Pet
Text:no text
PT:1/2
ImageName:G 1 2 Wolf Pet
End
wolf_pet_level_3.txt
Name:Wolf Pet
ManaCost:no cost
Colors:green
Level:3
Types:Creature Wolf Pet
Text:no text
PT:2/2
ImageName:G 2 2 Wolf Pet
End
wolf_pet_level_4.txt
Name:Wolf Pet
ManaCost:no cost
Colors:green
Level:4
Types:Creature Wolf Pet
Text:no text
PT:2/2
K:Flanking
ImageName:G 2 2 Wolf Pet Flanking
End
`
- Attachments
-
Wolf Pets.zip
- (2.43 KiB) Downloaded 262 times
-
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: Quest classes refactoring
by Max mtg » 16 Mar 2012, 18:51
Color - yes. Even wizards themselves in their Oracle DB now have a separate property 'color'.Chris H. wrote:I have an early first revision of the Wolf Pet for people to look at.
The plant/pets need to have their color set and I see that CardReader? (as of the flip cards) can now handle a color if a card has no mana cost as they can't be cast.
We will need a new "Level" param to be read in I see.
We will also need a specific image name to be associated with the plant/pets.
I added the level number to the file name for each of the wolf pet files to make them unique. All four levels of this pet has the same name and this might create a problem with duplicate card/tokens.
Just a few things to think about and possibly discuss.![]()
Level - no. These tokens are not supposed to be added into database, they don't need any unique keys to distinguish. It's ok to have six similiar Wolves in separate files. PetManager will read each card into a map keyed by pet level and return the propper one when it comes to playing a duel. So different filenames for different pet levels are enough.
Image - maybe. On one hand token filenames may be created by a rule from their properties (like color-type-Pow-Tgh-Keywords.jpg), on the other hand - some tokens look better when they have unique images so that a card from a certain set would summon tokens from the same set or a matching set from the same block.
Thank you for this beginning. I'll add code to load these files in quest mode in a day or two. CardReader already is able to instantiate a card from a Iterable<String> object, but PetManager is not prepared yet.
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: Quest classes refactoring
by moomarc » 16 Mar 2012, 19:05
I should have time tomorrow to script the pets. I'm not a frequent quest player though so would someone please confirm that the pets are still as they appear in the pets sprite sheet with regards to abilities and P/T. I know there was some discussion a while back regarding balancing them a bit more.
-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: Quest classes refactoring
by friarsol » 16 Mar 2012, 19:36
The pet balancing hasn't happened yet. Since max suggested he was going to be refactoring (and my recent slow development pace), I put it on the back burner. Once Max finishes with his work in this area, it'll be much easier to add my balancing changes.moomarc wrote:I should have time tomorrow to script the pets. I'm not a frequent quest player though so would someone please confirm that the pets are still as they appear in the pets sprite sheet with regards to abilities and P/T. I know there was some discussion a while back regarding balancing them a bit more.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Quest classes refactoring
by Chris H. » 16 Mar 2012, 19:45
`moomarc wrote:I should have time tomorrow to script the pets. I'm not a frequent quest player though so would someone please confirm that the pets are still as they appear in the pets sprite sheet with regards to abilities and P/T. I know there was some discussion a while back regarding balancing them a bit more.
The code for the current pets can be found at:
src.main.java.forge.quest.data.pet.QuestPetBird
src.main.java.forge.quest.data.pet.QuestPetCrocodile
src.main.java.forge.quest.data.pet.QuestPetHound
src.main.java.forge.quest.data.pet.QuestPetPlant
src.main.java.forge.quest.data.pet.QuestPetWolf
-
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
32 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 29 guests