PieceID from saved games

While doing some debugging, I notice that the PieceID’s for multiple units of the same type lose their uniqueness. I find that several squadron counters (each is a copy of the same unit) will have the same PieceID when loading a saved game. Before the save, the ID’s are unique, after there are duplicates.

This behavior is expressed in at least 3.2.14 and 3.1.15 (I hoped it would clear with the new build).

Thanks

Flaney

Thus spake Flaney via messages:

While doing some debugging, I notice that the PieceID’s for multiple
units of the same type lose their uniqueness. I find that several
squadron counters (each is a copy of the same unit) will have the same
PieceID when loading a saved game. Before the save, the ID’s are unique,
after there are duplicates.

This behavior is expressed in at least 3.2.14 and 3.1.15 (I hoped it
would clear with the new build).

What’s the oldest version in which you can reproduce this?


J.

I will load older vassal versions and try the test again. But, can you point (link) to the older vassal builds (win)?

Thanks,

Flaney

Thus spake Flaney via messages:

I will load older vassal versions and try the test again. But, can you
point (link) to the older vassal builds (win)?

Every version we’ve released since around 2005 is here:

vassalengine.org/releases/


J.

I’ve loaded a couple of older versions. After going through the process of starting a game, I’d save game and later reload.

I don’t think the problem is with the save/load game command. Let me explain.

I start with units on a map window that will contain all available build-able units(Forcepool). When one of these units is dragged to to Main Map, the piece is replaced with a duplicate unit that has the on-board properties needed during the game. When the unit is eliminated, it is sent back to the available builds window AND is replaced with a duplicate unit with properties specific to that map:

vSquadron (Replace with Other)-> Squadron when moved to Main Map.
Squadron (Replace with Other) → vSquadron when moved to ForcePool Map.

During these transitions, some pieceID’s get duplicated.

This was discovered since I was using pieceID to send GKC’s to other units in a stack on the Forcepool window to make the those others shift a hex to the right spreading out the stack: for pieceID != $pieceID$. Initially, the units in the Forcepool window behaved as expected: I could drag a unit and drop it on another unit and the new stack would spread out. I saved the game to be used later to test other behaviors.

So when I built a unit by placing it on the MainMap, it was replaced by the ‘real’ unit. When testing the death of units, I found that the dead unit sent back to the Forcepool would not unstack. It seems the pieceID would sometimes duplicate a unit already in the Forcepool window. The logic I used to send that GKC to other units only would fail, often with infinite loop.

In conclusion, the pieceID update for Replace With Other seems to have a glitch.

I hope this clarifies the issue.

Please feel free to let me help in solving this.

thanks

flaney

Thus spake Flaney via messages:

I’ve loaded a couple of older versions. After going through the process
of starting a game, I’d save game and later reload.

Ok. So, you didn’t find a change in behavior? How far back did you
check?

Would you make a minimal test module showing the problem?


J.

I went back to 3.2.11 when I noted the distinction.

I was planning to continue though to 3.2.8

Give me a little time to build a test module. Probably scrape down the module I’ve been working on…

Here it is.

Instructions:

  • Test1 version
    - Click Empires and select Narn
    - Select each Squadron and hit CTRL-R
    - =====
  • Row = 0, Column = 1, 354, 118 ; PieceId = 7578, Stacked=false
  • Row = 0, Column = 1, 354, 354 ; PieceId = 7580, Stacked=false
  • Row = 0, Column = 1, 354, 590 ; PieceId = 7582, Stacked=false
  • Row = 0, Column = 1, 354, 826 ; PieceId = 7584, Stacked=false
    - ====
    - Each piece has unique pieceID
    - ----
    - Drag and drop each squadron to Main Window
    - =====
    - Each unit is replaced with the Main Map version
    - Select each squadron and hit CTRL-UP
  • PieceId=1266
  • PieceId=1266
  • PieceId=1266
  • PieceId=1266
    - Each unit has the same pieceId.
    - ----
    - Drag and drop each Squadron back to ForcePool
  • moved from sector14 to Narn ForcePool
  • moved from sector14 to Narn ForcePool
  • moved from Sector10 to Narn ForcePool
  • moved from Sector10 to Narn ForcePool
    - (if placed on top of another, it will move to right)
    - Select each Squadron and hit CTLR-R
  • Row = 0, Column = 1, 354, 118 ; PieceId = 7609, Stacked=false
  • Row = 2, Column = 2, 354, 354 ; PieceId = 7609, Stacked=false
  • Row = 2, Column = 3, 354, 590 ; PieceId = 7609, Stacked=false
  • Row = 2, Column = 4, 354, 826 ; PieceId = 7609, Stacked=false
    - Each piece has same pieceId.
    - Note: I have changed the shift logic to key on DynamicProperty Flags instead of pieceId’s so the shift right still works

I used upload attachment to include Test1.vmod (it’s too big: 2314 kb) Please check your email for I have attached it to a message.

Flaney