Mask with custom layout

I’m a bit frustrated trying to get masks working for my module. The units of each side will be concealed from the other side until they come within close range. Until then I want the other player to just see a generic unit of that type (leader, infantry, cavalry, artillery) but I want the owning player to see the full counter without having portions obscured by an insert, etc.

The way the current insert method works for the Mask trait is that it forces the layer to appear on the left side of the counter - which for my counter obscures important information even at high transparency.

It would help if there were offset x,y options so that it wasn’t forced to be in one position.

The option I would prefer would be for the option to display a tiny label on the counter to indicate concealed units but for the enemy to see the generic counter.

Using the peek option will be too painful given the sheer number of units involved on both sides.

I wonder if there are any existing modules that already have custom classes for such concealment. Or perhaps, I’ll just have to recode the Mask trait for 3.6.1? jas…

I’m making some inferences here, but it sounds like the image you’re using as your Mask does not share the same pixel dimensions as your unit images? Couldn’t you just make the Mask be an image precisely matching the dimensions of the units and fully transparent, except for the opaque portion that obscures things being wherever in the canvas it needs to be?

Some graphic examples of your units and what the Mask trait is currently doing would help demonstrate your needs. This new forum software is dramatically improved with regard to putting images in posts.

1 Like

Hey Joel, thanks for the reply!

Sorry for the confusion. I can generate any mask image I need to with GIMP, so that’s not the problem. I’m struggling to understand the ins and outs of the current Mask trait options.

Here are some units unmasked:

I want the opponent to see a generic counter - no text information about the unit, such as:

Here’s what they look like using inset:

Notice, that the weapon-type, ‘M’, is covered by the mask inset. I can improve this by using transparency:

This is for one side, the CSA, for the Union side it is worse:

Because the Union counter image has the man firing in the opposite direction - the unit name is located on the left side of the counter and even at high transparency, the name is occluded.

Because the inset method forces the image to be on the left side with no offset options it means that the Union counters are illegible.

If I using the ‘background’ option the unit text becomes too tiny to be legible when masked:

The ‘plain’ option I want to avoid because then I see no unit details and am forced to peek at every unit.

The ‘image’ option I want to avoid because I don’t want to generate a new image for each unit.

So what I’d really like is an option to use a different image for the inset than the image I show the opponent - that way I could just have a very transparent marker so I know which of my units are concealed. But my opponent sees the generic counter with no transparency. At the moment, the inset method attempts to use the opponents image on top of the existing counter and that obscures information.

A possible alternative could be giving x,y offset options for inset - so I can move the Union inset image enough to view the unit name when masked. Not the best, but I think it would give enough flexibility.

Hope this is enough info to help understand my challenge or what I’m doing wrong. Cheers! jas…

I think you want the “Use Image” setting on the Mask trait. The non-owning player sees your generic counter image and that’s it. Set this in the upper portion of the Mask trait config: “View when masked”.

Seems like you basically want to see the unit with some minimal indicator that it is hidden to others. Wouldn’t a mostly transparent image with some text like “CONCEALED” or similar do the trick? Just size the image and place the text where it makes the most sense for you–above, below, off to the side, whatever. Perhaps I’m missing why one image can’t work for all units (assuming they’re all the same size).

1 Like

Hi Joel, Thanks for getting back.

I think I can make the ‘image’ option work. I had a closer look at it - and I misunderstood the documentation - I thought it replaced the existing counter image with the image provided (just as the ‘plain’ option does). But upon testing it, it places the image in a layer above the existing image so you with transparency in the correct places, the desired information can show through leaving a small marker behind that displays the concealment status.

It’s OK and I can make it work - it gives me what I said I wanted which was the ability to choose one concealment image for myself and one for the opponent. The only issue there is no offset option. I’d rather have a very small image (or even just a text label really) that indicates the status. Maybe what I’ll try to do is combine a 1px transparent image with a text label trait that is de/activated by the same command. That might be good.

Thanks for slapping some sense into me and getting me to look more closely at the image option.

EDIT: Here is the finished look using your image suggestion:


I might offer to contribute a commit to the docs with some images for using masks. Thanks again, jas…