Create account / Log in

Multiple Layers Simultaneously

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Multiple Layers Simultaneously

Postby sgwhitley » October 25th, 2020, 11:54 pm

Is it possible to have multiple piece layers active simultaneously? I'm trying to create a bid marker with these values: 1/2/3/n Artillery, 1/2/3/n Helicopters. When a combat occurs, each player has to secretly select a certain number of artillery or helicopter support markers. The helicopter and artillery bids must be made separately. So I want bid markers where you can right-click and choose "Increase/Decrease Artillery" and "Increase/Decrease Helo". I have both layers set up and I can see the options in the right-click dialog, but only the lowest of the two layers in the piece layout window does anything. I want separate artillery/helo layers for ease of use because there are probably too many different combinations for players to do this on a single layer comfortably.
sgwhitley
 
Posts: 20
Joined: May 2nd, 2020, 11:04 pm

Re: Multiple Layers Simultaneously

Postby marktb1961 » October 26th, 2020, 12:26 am

Yes separate, multiple layers can be defined and active for a piece. There must be some other issue preventing the topmost layer doing what you want it to.
Platform: Vassal 3.4.11, MacOS Big Sur on iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 346
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Multiple Layers Simultaneously

Postby JoelCFC25 » October 26th, 2020, 1:30 am

It's hard to guess at what's going on without more details about the configuration of the basic piece and the layers, but if both layers have the same pixel dimensions and are both text/symbols set on an opaque base color, it could be as simple as one completely obscuring the other.

One of many possible approaches is to make sure your Artillery and Helicopter layers are designed in such a way that there is no overlap in the text/symbology being used. For the sake of demonstration I'll pretend each bid "token" is meant to be 60x60 pixels. If I want to control both kinds of bids on a single piece, I'd make the base bid piece be 60x120 pixels. Then all the Artillery layer images would be 60x120 pixels where all the text/symbols are stuff into the leftmost 60x60 area and the remainder is transparent--then do the opposite with the Helicopter layers. Then you have the appearance of a 60x120 token where all the info is displayed with nothing behind obscured. You could do left/right, top/bottom, everything arranged on a square piece, whatever your need happens to be.

Actually, even easier would be using the layers you already have and just applying vertical or horizontal offsets.
JoelCFC25
 
Posts: 752
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Multiple Layers Simultaneously

Postby sgwhitley » October 26th, 2020, 12:42 pm

Non-overlapping text with a transparent base is how I attempted to go about this. I'll take another look, maybe I goofed on the transparency or something. If that doesn't work, what's the best way to provide a reproducible example for this kind of thing? A test module?
sgwhitley
 
Posts: 20
Joined: May 2nd, 2020, 11:04 pm

Re: Multiple Layers Simultaneously

Postby sgwhitley » October 26th, 2020, 1:04 pm

Got it working, problem was a defective end user. :)

I was using magick to generate a mock-up of what I wanted the marker to look like, and then the layer images themselves, and accidentally passed the base layer for the mock-up to the command that generated final images. So it was indeed a case of one layer obscuring the other.
sgwhitley
 
Posts: 20
Joined: May 2nd, 2020, 11:04 pm

Re: Multiple Layers Simultaneously

Postby sgwhitley » October 26th, 2020, 4:40 pm

Semi- related question: now that I have this working, I set up a global key command to automatically move all of the bid markers to a window. This works fine until I add a restrict command trait to the pieces in question(which is set to hide, not disable). I don't want players to accidentally remove all the bid markers through an absent-minded click on the marker's context menu.

Is this expected behavior? It makes sense to me if I'd set the restrict trait to "disable", but I figured setting it to hidden would just hide it from the context menu and not from the GKC.
sgwhitley
 
Posts: 20
Joined: May 2nd, 2020, 11:04 pm

Re: Multiple Layers Simultaneously

Postby marktb1961 » October 26th, 2020, 5:06 pm

To avoid accidental use of the Keyboard Command, don't define a command name and use a long Key Command. There will then be no right-click option but you can still trigger the GKC from the module. Restricted - disable or hide - will prevent the GKC entirely.

If you want the GKC to be executed from the keyboard sometimes but generally available to the module, look into using a Trigger - then you define both a restricted keyboard command, visible to users and an internal key command for use by the module itself. The Trigger should be set-up to action the GKC on a long key command as above.

Hope this helps.

Mark
Platform: Vassal 3.4.11, MacOS Big Sur on iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 346
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Multiple Layers Simultaneously

Postby sgwhitley » October 26th, 2020, 5:57 pm

Thanks, using a long key command with no name defined worked like a charm. Never would have worked that out myself.
sgwhitley
 
Posts: 20
Joined: May 2nd, 2020, 11:04 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 1 guest