Options for changing game piece backgrounds during a game?

The basic problem is that I have a lot of very similar units that only differ in their background colours. I would like to arrange things so that I only have to set up one base unit set of game pieces and then just change the background colour by a right mouse command to activate a different coloured background via a layer.

I suspect that it is not possible to change the colour of a game piece background during a game if I use the Vassal NATO symbols as they end up in game piece images which are always overlaid, correct?

However if I use my own NATO and background colour images I should be able to do this as both the background colour images and the NATO symbol images could both be accessed via different prototype layers with the NATO symbols applied after the background colour, correct?

Or is there an easier way? Can the Vassel NATO symbol images be extracted as .png files?

You definitely can get the images out of an existing .vmod
Vmod files are just .zip files by another name. For example here is what I see in an images sub-directory in the Luzon module (using 7-Zip).
image

If your NATO symbols were made with a transparent background, you should also be able to change the color of the counter easily.

Thanks for that, it might be very useful later. I was looking for how to simplify the creation of lots of units that are the same except for background color, but I think the simplest way, for me at least is probably just to create the set of game piece images I want, then duplicate the game piece definition with those images in and go into each one and change the name and the background color.

Have you tried creating semi-transparent layers? If the background of the piece is white, you could overlay semi-transparent .png’s to make the piece any color you want.

I did try using overlays but I had some issues with the .png files and a number of overlays had dark fringes. I also realized that it would be best to have all of the pieces fully defined in the module rather than having to define them in the game.

Semi-transparent layers is an interesting idea though.

I’m now trying to sort out the best combination and arrangement of game piece containers for a few hundred units it doesn’t seem that obvious

Perhaps, if I read what you are after correctly, something like

  • BasicTrait with a transparent layer
  • PrototypeTrait for background/faction/nationality
  • PrototypeTrait for unit type/NATO symbol
  • LabelTrait(s) for unit ID, parent ID, etc.
  • LabelTrait(s) for unit factors, etc.

The the background prototypes could be

  • LayerTrait holding a single image of the appropriate colour

and the unit type prototypes could be

  • LayerTrait hold a single, semi-transparent, image of the NATO symbol

Thus, to build a German infantry corps unit with factors 4-3, you would have

  • BasicTrait
  • MarkTrait with name 'CF, value 4`
  • MarkTrait with name MF value 3
  • MarkTrait with name UniqueID valule 'XXIV`
  • MarkTrait with name ParentID value S
  • PrototypeTrait - with name German
  • PrototypeTrait - with name infantry corps
  • LabelTrait with text {CF+"-"+MF} placed at the bottom
  • LabelTrait with text {UniqueID} placed to the right, and rotated
  • LabelTrait with text {ParentID} placed to the left and rotated

In fact, the last three traits could be put into a Prototype that would be used in all units, and configured for each unit by MarkTrait.

In fact, one could make the CF, MF traits CalculatedPropertyTrait so that the displayed values depends on some other state - for example a step reduction or similar.

Just an idea.

Yours,
Christian

Thanks for that Christian, I am new to Vasal and it’s always good to have some advice and suggestions when you get stuck. I’m still experimenting so I will try out some of the things you suggest to see what I can do.

1 Like

You’re welcome

Perhaps you want to take a look at this GitLab snippet I made.

Yours,
Christian

Have you thought about using a Scalable Vector Graphics (SVG) graphic layer* which will eliminate all jagged edges and dark fringes and they scale well. The background can be either part of the SVG or you can make it semi transparent and have the background as a seperate layer. SVG files can be used in the same way as PNGs.

I also agree with Christian’s suggestion of putting common elements (such as unit symbols and backgrounds) as prototypes in the counter definitions. The biggest advantage of this is visual consistency and if you need to make a global change (such as tweaking a side’s background colour), you just update the one prototype definition and the change ripples across all the counters using that prototype. Believe me, it saves a lot typing and heartache…

  • SVG graphics can be created with Inkscape which is freeware and available for most platforms.

Best of Luck. :slightly_smiling_face:
Reg.

Yes that is a good idea. I’m familiar with Viso and that can save images in svg format so I will give it a go. It will take me a little time to get my head around it all and put it together.

just the job!