Here’s my take on a new updater.
I like the idea of PieceSlot ID’s a lot. I don’t think this will really be a problem. I don’t think PieceSlots should share ID’s. If you create a new PieceSlot, then it gets a new ID. End of Story.
A Cut followed by a Paste would copy the ID, but a Paste not preceded by a Cut would copy the Piece, but generate a new ID.
I agree with displaying the PieceSlot ID’s in the PieceDefiner and perhaps exposing it with a $PieceId$ property, but I don’t see any reason at all to allow PieceSlot ID’s to be manually changed. If there are 15 identical pieces in a Deck, and they have 15 different PieceSlot ID’s, it really doesn’t matter - an updater will still work perfectly.
BTW, as well as PieceSlot’s in GamePiece Palettes and At-Start Stacks and CardSlots’s in Decks, pieces can also be created from the Piece Definitions stored in Place Marker and Replace counter traits. The updater needs to these as well.
The big problem with ID’s I see is how do you ensure ID’s in extensions are unique? Include the Internal Extension name in the ID? Change the internal name of the extension and the updater is blown.
The online updater I wrote is conceptually pretty straight-forward:
Process each GamePiece in play in turn:
a) Locate the Definition in the current module that was probably used to create it. This may not be possible if the module has changed enough.
b) Create a new GamePiece from the Definition
c) Process each trait in the new GamePiece and try and find a matching trait in the old Gamepiece based on getType (i.e. with all the same properties). If a match is found, then copy the State from the old piece to the new piece (This handles updating which layer is currently showing etc.)
d) Replace the old piece with the new piece.[/list]
Item B is the what we are discussing. Given a GamePiece on a Map, we need to find the ‘best’ definition that can be used to recreate it. I think Unique Id’s for PieceSlots saved into BasicPiece at piece creation time will work most of the time for most people for most modules.
For compatibility, we can include a backup scheme where if a GamePiece does not have an ID, then we use a scheme similiar to that which I use now:
Find all candidate PieceSlots where the Name in the BasicPiece is the same as that in the BasicPiece of our target piece. Hopefully there will be only one
Rank each candidate on similiarity to our target by comparing trait’s between the two.
Choose one to use to update.
Ultimately, there will be GamePieces that cannot be updated because the module has changed too much. Basically, that’s tough. If a Module is going to be seriously hacked about, then there has to be an understanding that the ability to update saved games will be limited. Even so, I think PieceSlot ID’s (maintained accross cut/paste) will still work most of the time.
I would see this Update available as an option on the main VASSAL menu to update the current game, or on an Editor menu to update a Batch of games in a directory.