Create account / Log in

How do you upgrade a saved game

Discussion area for the development team.

Moderators: uckelman, Tim M

How do you upgrade a saved game

Postby fil512 » July 27th, 2010, 11:59 pm

I'm fixing a bug in the TTA module. It has prefab games with reduced number of cards for 2 player and 3 player games. These are vsav files. Problem is, when I run my upgraded version of the TTA module, as soon as I select 2 player game, it loads the 2 player save file which does not contain any of my fixes. I could rebuild the 2 player and 3 player start games, but it would be a lot of work. Is there a way to upgrade a save file to a newer version?

P.S. I tried creating and running an updater.jar, but when I ran it alone nothing happened. When I ran it as java -jar updater.jar I got the following error. But I figured it was a longshot to expect updater.jar to look inside the module for saved games and update all of them...

Exception in thread "main" java.lang.NoClassDefFoundError: VASSAL/tools/io/IOUti
ls
at VASSAL.tools.ZipUpdater.write(ZipUpdater.java:150)
at VASSAL.tools.ZipUpdater.main(ZipUpdater.java:386)
Caused by: java.lang.ClassNotFoundException: VASSAL.tools.io.IOUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] How do you upgrade a saved game

Postby tmccarron » July 28th, 2010, 12:05 am

You would run the saved game updater that is built in but it isn't 100%
reliable imo.
Its been awhile but if I remember correctly you need a copy of the old
module plus its build file to create the updater against. Then while in the
editer again with the new module run the updater on the saved games

The only other way is to manually rebuild the saved game to be sure it is
done right, and I find easier :)

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of fil512
Sent: Tuesday, July 27, 2010 6:59 PM
To: messages@vassalengine.org
Subject: [messages] [Developers] How do you upgrade a saved game

I'm fixing a bug in the TTA module. It has prefab games with reduced
number of cards for 2 player and 3 player games. These are vsav files.
Problem is, when I run my upgraded version of the TTA module, as soon as
I select 2 player game, it loads the 2 player save file which does not
contain any of my fixes. I could rebuild the 2 player and 3 player
start games, but it would be a lot of work. Is there a way to upgrade a
save file to a newer version?

P.S. I tried creating and running an updater.jar, but when I ran it
alone nothing happened. When I ran it as java -jar updater.jar I got
the following error. But I figured it was a longshot to expect
updater.jar to look inside the module for saved games and update all of
them...

Exception in thread "main" java.lang.NoClassDefFoundError:
VASSAL/tools/io/IOUti
ls
at VASSAL.tools.ZipUpdater.write(ZipUpdater.java:150)
at VASSAL.tools.ZipUpdater.main(ZipUpdater.java:386)
Caused by: java.lang.ClassNotFoundException: VASSAL.tools.io.IOUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more

_______________________________________________
Read this topic online here:
viewtopic.php?p=18904#p18904
I'm doing something Vassal related all the time
User avatar
tmccarron
 
Posts: 19
Joined: July 17th, 2010, 12:36 pm

Re: How do you upgrade a saved game

Postby fil512 » July 28th, 2010, 12:43 am

Thanks for the quick answer! Guess the docs are wrong.

The help page here file:///C:/Program%20Files/VASSAL/doc/ReferenceManual/ModuleUpdater.htm says you just need to "place the updater file in the same folder as the old module file. Double-clicking on the updater file will replace the old module file with the new version."

Thanks again for the help.
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] How do you upgrade a saved game

Postby fil512 » August 14th, 2010, 10:20 pm

tmccarron wrote:You would run the saved game updater that is built in but it isn't 100%
reliable imo.
Its been awhile but if I remember correctly you need a copy of the old
module plus its build file to create the updater against. Then while in the
editer again with the new module run the updater on the saved games

The only other way is to manually rebuild the saved game to be sure it is
done right, and I find easier :)


I'm in the process of trying to fix the TTA bug. I've fixed the bug but am stuck on creating the 2p and 3p saved games. I tried upgrading the existing ones, but that didn't work (taking the start player card didn't seed the current event deck as it should have).

So now we're trying to manually rebuild the saved game as you suggest, but the problem is I don't know how to create the 2p saved game to begin with. I tried starting with a 4p game (which doesn't load a save file) but that resulted in a saved game file with players = 4 which is not what I want. I was hoping that setting it as the file to load in the 2p predefined setup would reset the value of players to 2 when the user selected a 2 player game, but it stays as 4.

HELP!
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] Re: [Developers] How do you upgr

Postby Tim M » August 14th, 2010, 11:41 pm

My guess is that to limit the players, Dave created 2 new sessions of Vassal
that each had their own username/pw and joined the game taking up 2 of the
sides, then saved the game without retiring the players and used this file
for the 2p version.

Thereafter anytime a user would use this Saved game start file they would
only see the availability of 2 players

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of fil512
Sent: Saturday, August 14, 2010 5:21 PM
To: messages@vassalengine.org
Subject: [messages] [Developers] Re: [Developers] How do you upgrade a
savedgame


"tmccarron" wrote:
> You would run the saved game updater that is built in but it isn't
> 100%
> reliable imo.
> Its been awhile but if I remember correctly you need a copy of the old
> module plus its build file to create the updater against. Then while
> in the
> editer again with the new module run the updater on the saved games
>
> The only other way is to manually rebuild the saved game to be sure it
> is
> done right, and I find easier :)
>


I'm in the process of trying to fix the TTA bug. I've fixed the bug but
am stuck on creating the 2p and 3p saved games. I tried upgrading the
existing ones, but that didn't work (taking the start player card didn't
seed the current event deck as it should have).

So now we're trying to manually rebuild the saved game as you suggest,
but the problem is I don't know how to create the 2p saved game to begin
with. I tried starting with a 4p game (which doesn't load a save file)
but that resulted in a saved game file with players = 4 which is not
what I want. I was hoping that setting it as the file to load in the 2p
predefined setup would reset the value of players to 2 when the user
selected a 2 player game, but it stays as 4.

HELP!

_______________________________________________
Read this topic online here:
viewtopic.php?p=19229#p19229
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1816
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: [messages] [Developers] Re: [Developers] How do you upgr

Postby Brent Easton » August 15th, 2010, 12:02 am

>My guess is that to limit the players, Dave created 2 new sessions of
>Vassal
>that each had their own username/pw and joined the game taking up 2 of the
>sides, then saved the game without retiring the players and used this file
>for the 2p version.
>
>Thereafter anytime a user would use this Saved game start file they would
>only see the availability of 2 players

Yes, that is how I do it.
User avatar
Brent Easton
 
Posts: 3176
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: [messages] [Developers] Re: [Developers] How do you upgr

Postby fil512 » August 15th, 2010, 12:38 am

swampwallaby wrote:>My guess is that to limit the players, Dave created 2 new sessions of
>Vassal
>that each had their own username/pw and joined the game taking up 2 of the
>sides, then saved the game without retiring the players and used this file
>for the 2p version.
>
>Thereafter anytime a user would use this Saved game start file they would
>only see the availability of 2 players

Yes, that is how I do it.


No for TTA that's not going to solve my problem. The problem is that there's a global variable called Players that represents the number of players. It's used to determine the number of cards dealt to a certain deck. I can't for the life of me figure out how to create a save game with players = 3.
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] Re: [Developers] How do you upgr

Postby fil512 » August 15th, 2010, 1:04 am

fil512 wrote:
No for TTA that's not going to solve my problem. The problem is that there's a global variable called Players that represents the number of players. It's used to determine the number of cards dealt to a certain deck. I can't for the life of me figure out how to create a save game with players = 3.


Ugh. Well I think I found a way to do it. But it's U.G.L.Y. There's a global variable in the module called Players that has an initial value of 4. It looks like I have to manually edit the module, change the 4 to a 3, then save the module, then create a 4 player game (because a 3 player game would load a save file which I don't want), then save the game. That looks like it's the only way to set the #players to 3 in TTA.

-K
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] Re: [Developers] Re: [Developers

Postby Brent Easton » August 15th, 2010, 1:22 am

I am presuming the orginal module developer is not contactable and has left no documentation?

Yet another nail in the 'super automation' coffin?

My guess is there is some control counter defined somewhere that has an option to set the value of the number of players property. If there isn't, you could create one. When you create a setup, create one of the counters, set the number of players, then delete it. I would else check counters like the Turn Counter in case there is a Command defined there that does it.

B.

*********** REPLY SEPARATOR ***********

On 14/08/2010 at 6:04 PM fil512 wrote:

>"fil512" wrote:
>>
>>
>> No for TTA that's not going to solve my problem. The problem is that
>> there's a global variable called Players that represents the number of
>> players. It's used to determine the number of cards dealt to a
>> certain deck. I can't for the life of me figure out how to create a
>> save game with players = 3.
>
>
>Ugh. Well I think I found a way to do it. But it's U.G.L.Y. There's a
>global variable in the module called Players that has an initial value
>of 4. It looks like I have to manually edit the module, change the 4 to
>a 3, then save the module, then create a 4 player game (because a 3
>player game would load a save file which I don't want), then save the
>game. That looks like it's the only way to set the #players to 3 in
>TTA.
>
>-K
User avatar
Brent Easton
 
Posts: 3176
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: [messages] [Developers] Re: [Developers] Re: [Developers

Postby fil512 » August 15th, 2010, 1:56 am

swampwallaby wrote:I am presuming the orginal module developer is not contactable and has left no documentation?

Yet another nail in the 'super automation' coffin?

My guess is there is some control counter defined somewhere that has an option to set the value of the number of players property. If there isn't, you could create one. When you create a setup, create one of the counters, set the number of players, then delete it. I would else check counters like the Turn Counter in case there is a Command defined there that does it.

B.


He responded to my first message a few months ago, but once I started talking seriously about fixing his module he stopped responding. Not sure what you mean by "super automation"...

Not sure if you read my other post, but I wrote a module reverse-compiler that creates a searchable, human-readable xml file describing everything that happens in a module. I searched it for the variable in question and could not see anywhere where it was set...

I like your idea of adding some admin functions like that.

I wish the module upgrader worked--then I could just upgrade the 2p and 3p saved games from the previous versions... Upgrading 2p and 3p games has been way more work than it should have. I don't understand why saving game state required saving the module code along with it. Was it just a quick-and-dirty way to do it? Normally one would want to keep state data separate from code...
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto

Re: [messages] [Developers] Re: [Developers] Re: [Developers

Postby Brent Easton » August 15th, 2010, 2:05 am

> Not sure what you mean by "super automation"...

Old discussion...don't worry.

>Not sure if you read my other post, but I wrote a module
>reverse-compiler that creates a searchable, human-readable xml file
>describing everything that happens in a module. I searched it for the
>variable in question and could not see anywhere where it was set...

Yes, I saw this. We will have to build this sort of thing into Vassal, because at the moment, you are probably the only person with the skills to run it. Not to mention that it will break at the sound of someone breathing on a trait.



>I like your idea of adding some admin functions like that.
>
>I wish the module upgrader worked--then I could just upgrade the 2p and
>3p saved games from the previous versions... Upgrading 2p and 3p games
>has been way more work than it should have. I don't understand why
>saving game state required saving the module code along with it.

I am not sure what you are mean here? What 'module code' are you talking about?

>Was it
>just a quick-and-dirty way to do it? Normally one would want to keep
>state data separate from code...

I will send you my Game updater. It is the precursor of the version in 3.2. It basically looks at each counter in the current setup and replaces it with the equivalent counter defined currently in the palette
User avatar
Brent Easton
 
Posts: 3176
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: [messages] [Developers] Re: [Developers] Re: [Developers

Postby Tim M » August 15th, 2010, 2:26 am

swampwallaby wrote:I am presuming the orginal module developer is not contactable and has left no documentation?

Yet another nail in the 'super automation' coffin?

My guess is there is some control counter defined somewhere that has an option to set the value of the number of players property. If there isn't, you could create one. When you create a setup, create one of the counters, set the number of players, then delete it. I would else check counters like the Turn Counter in case there is a Command defined there that does it.

B.


Nothing super automated about the At start Stack "No of players" with the player piece counter on the main map that sets the value.
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1816
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: [messages] [Developers] Re: [Developers] Re: [Developers

Postby fil512 » August 15th, 2010, 2:48 am

swampwallaby wrote:>
>
>I wish the module upgrader worked--then I could just upgrade the 2p and
>3p saved games from the previous versions... Upgrading 2p and 3p games
>has been way more work than it should have. I don't understand why
>saving game state required saving the module code along with it. Was it
>just a quick-and-dirty way to do it? Normally one would want to keep
>state data separate from code...

I am not sure what you are mean here? What 'module code' are you talking about?



I was shocked when I fixed a bug in the TTA module and my fix worked only for 4 player games. I learned later that the reason is that for 2p and 3p games, a save file is loaded. And I was shocked to discover that loading a save file would clobber my bug fix. The save file should only have game state data in it, not code, so why is it clobbering my bugfix?

Normally in computer systems, data is kept separate from code, often in a database or XML. This allows admins to release fixes to code without affecting saved data. A saved game should just include saved game state data. But instead, it also includes the module code.

More specifically, when you save a game, it should only care about WHERE all the pieces are and WHAT current values they have for their properties. It should not save what HAPPENS when you click on a piece--that's code.

But I suspect that it was too much work to separate state from function, and so the VASSAL coders took the quick and dirty route and serialized games by serializing the java classes. Rather than doing something more sophisticated like what the module editor does (it has a custom serializer for reading/writing module code as xml).

One response to my quibble would be to say, "well the module itself is data." But I don't think that holds a lot of water. I think it's more helpful to think of VASSAL as being a programming language (a declarative language like lisp), a module is a program written in the VASSAL programming language, and a game is the state of that program at a point in time. It should be possible to save/load state independent of fixing bugs in the code.

Is that more clear?

-K
fil512
 
Posts: 160
Joined: June 27th, 2010, 5:10 pm
Location: Toronto


Return to Developers

Who is online

Users browsing this forum: Google [Bot] and 3 guests