Page 1 of 3

Quest classes refactoring

PostPosted: 10 Mar 2012, 04:37
by Max mtg
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

Re: Broken quest saves (commited)

PostPosted: 10 Mar 2012, 23:22
by Max mtg
@14707 bazaar settings moved to xml file (deserialized by xstream)

Re: Broken quest saves (commited)

PostPosted: 11 Mar 2012, 07:27
by Vernon
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?

Re: Broken quest saves (commited)

PostPosted: 11 Mar 2012, 10:05
by Max mtg
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?
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.

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.

Re: Broken quest saves (commited)

PostPosted: 11 Mar 2012, 14:16
by friarsol
Hey Max,

Just curious, any reason you used XML instead of something lighter like JSON?

Re: Broken quest saves (commited)

PostPosted: 11 Mar 2012, 15:09
by Max mtg
friarsol wrote:Hey Max,

Just curious, any reason you used XML instead of something lighter like JSON?
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.
A siutable json library yet needs to be found and learnt how to use it.

Re: Quest classes refactoring

PostPosted: 11 Mar 2012, 23:26
by Max mtg
Ok, @14717
items properties are in file now, one may edit their prices, purchaseNames, sometimes description and maxlevel

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 07:54
by Max mtg
Please, provide me with quest-mode tokens saved as txt files in the same format as common cards.

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 13:58
by Chris H.
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?

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 15:26
by Max mtg
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?
Yes, if someone would be so kind to create them. :)

This would allow me to remove their hardcoded properties and read pets and plant from external files as if they were cards.

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 18:25
by Chris H.
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. :)


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



`

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 18:51
by Max mtg
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. :)
Color - yes. Even wizards themselves in their Oracle DB now have a separate property 'color'.

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.

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 19:05
by moomarc
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.

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 19:36
by friarsol
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 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.

Re: Quest classes refactoring

PostPosted: 16 Mar 2012, 19:45
by Chris H.
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