Masking and layers

I have limited experience in module design.

I am building a module for Triumphant Fox (MiH). In this game both players have a roster sheet with checkboxes you check off to keep track of losses. It is kept hidden from your opponent at all times so he cannot guess the current combat strength of your units. The units lose strength points one by one, being the stronger 15 points when fresh. I first thought about giving each player a private window with his roster, which can be easily done, but it would be much nicer to keep track of the current strength of each unit in the unit itself so players will not need to refer to the roster constantly. I have figured out how to do that through a layer using transparent counters with a solid area displaying the actual combat strength.

What I would like to do but don’t know how:

1.- Every combat unit has two sides (normal and disrupted) that have nothing to do with its strength level. The combat strength is the same regardless which side is showing. The disrupted side background color is a lighter tone of the normal side. The “strength” layer uses the “normal” side background color and I would like to have a different layer set with the correct shading to apply when the units are disrupted, but can’t figure out how to implement it. I could live without this if there is no easy solution.

2.- Important for gameplay: Keep this “strength” layer hidden from the opponent at all times. He should always see full strength units (the base piece image for each side, normal or disrupted).

Just in case someone points me in that direction, I have tried the property sheet trait to keep track of units’ strength but don’t like that solution. I also believe there are some other ways like assigning properties to units and then have their values displayed in labels. Besides not knowing how to implement those either, my preferred solution would be the one I am asking help for as I find it much more visually appealing.

Anyway, any suggestions will be of course most welcomed. Thanks in advance for your help!


The easiest way would be to keep the “strength” value in a dynamic property: the owner could check it through a “prompt user” key command, that would have a restricted access.
But you won’t like it, as it’s neither convenient nor nice (the strength value wouldn’t be displayed on units).

What you want is not “natural” in Vassal, and you would have the same problems with images (layer) or text (label): to my knowledge there are only two ways to display different things on the same board to different players: “mask” and “invisible” traits. Thus I can think of two solutions, but they’re tricky!

    1. Use two mask traits within the same game piece
      Each mask is a background: normal and disrupted. When the piece is created, the normal mask is activated.
      Then, use only a trigger to switch between normal and disrupted: the trigger shall command both masks (so that only one mask is active at the same time).
      A problem is that “mask” will only mask the layers below itself, but you want the strength to be displayed above the background… a workaround is to use the mask “display style = Background”: your layer with strength markers will be reduced (you may find it too small…) and displayed in the middle of the game piece (you may be able to tweak this position by adding transparent padding)
    1. Use two game pieces, one visible base and one invisible marker
      The visible base manages the background (normal/disrupted) and whatever is seen by both players.
      The invisible marker is created and set invisible when the base is created. It displays the “strength” value.
      [list][*]A basic flavour of this solution is to have these pieces to stack, then “hope” that they won’t get separated: when you click on the base, you’ll select both pieces (then you’ll move and send orders to both of them). If you’re careful and if you don’t need to stack several units, it may be fine.
  • A more robust (and complicated!) solution is to have the invisible piece “does not stack” and not selectable. The base piece and its invisible marker share a unique identifier. All actions on the marker (including to make it follow the base piece each time it moves) are done through GKC, thanks to this identifier.
    Caveat with stacking: the “mouse-over stack display” won’t display the strength values, and I don’t think it’s possible to manage the display order for the markers (i.e. the unit on top of stack may display the strength value of any unit in the stack, and you cannot see the right marker without dragging the base piece outside of the stack)

Both solutions work (at least for the basic functions: devil is in the details) but each has its advantages and drawbacks… and both are tricky!
I think I would go for solution 1, even if graphic setup is more restricted: it allows stacking, it’s more computation-friendly, and may be easier to add functionalities.

If you need more help, and if you’re not afraid of developing such a dirty module, I can explain more gory details ;o)

Thanks a lot for your tips and excuse me for not replying earlier, have been really busy with real life and have not looked again into this till now.

I would also go with the first of your solutions but the strength values are on the left down corner of the counters as usual and I don’t think I would be able to tweak the mask graphics to its right position. Another thing I didn’t mention is that thes trength mask needs to cover the fresh value on the main counter (both sides). Add to that the normal and disrupted sides of the counters are not very well aligned and it becomes a real issue wothout redoing all the counters, which I am not up to now.

I have finished the module besides those details and will upload it here soon. If you feel like, please take a look at it and let me know if you come up with any new ideas. I guess you are right about what I am trying to do is not natural to Vassal.

A perfect solution would be some function that could “print” the basic piece (either side) when a piece is owned by the other player, efectively ignoring the strength layer.I have not find nothing like that in the manual

Never mind, I’m slow-paced anyway ;o)
I think you’ve understood the problems perfectly well… It would be “easier” to have the counters freshly built from scratch rather than scanned (or let’s say the actual strength should not mask the initial value in order to keep it visible as reference :wink:

What you want to do might be easier to set up in a future Vassal 4 (the internal state of pieces and their display should be separated: there may be more freedom for custom display)
But until then… don’t wait but play!

I’ll happily have a look at your module when it’s ready (but don’t expect too many brilliant new solutions from me ;o)