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

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 :slight_smile:

-----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:
https://forum.vassalengine.org/t/how-do-you-upgrade-a-saved-game/3125/1

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.

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!

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 :slight_smile:

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:

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.

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

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

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…

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

Nothing super automated about the At start Stack “No of players” with the player piece counter on the main map that sets the value.

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