Invisible Opacity Level

Greetings,

I’d like to adjust the opacity level set by the program when the invisible trait = true for a game piece. I’m wondering if a simple change to the build module file would do this for me. Here’s the code that I think applies:

    <VASSAL.build.module.PrototypeDefinition name="AirUnitNF">+/null/hideCmd;;Hide;CurrentMap = Main Map;67\,130,68\,650	footprint;;Movement Trail;false;false;5;255,255,255;255,255,0;80;40;20;30;2.0\	translate;Move Forward;38,130;0;60;false;0;0;0;0;Move Forward\\	rotate;6;39,130;37,130;Turn Right;Turn Left;;;Turn\\\	report;37\,130;$location$: $newPieceName$ turns left;;;Turn left\\\\	report;39\,130;$location$: $newPieceName$ turns right;;;Turn right\\\\\	hide;72,130;Hide\/Show;153,153,255;sides:Referee\\\\\\	piece;;;;/	false;;0\	\\	0\\\	-1\\\\	-1\\\\\	null\\\\\\	null;0;0;</VASSAL.build.module.PrototypeDefinition>

Using the code above as an example, what I want to do is have the Referee see an invisible = true piece appear in its invisible = false appearance.

Can changing a value(s) in the code above or some where make this happen?

Thanks very much.

Allan

I think you could achieve the same thing by adding a side called Referee, and then adding the referee to the list of sides that could make a piece invisible (in the Invisible trait of each piece). Then the ref would see whatever the player sees.

Unfortunately it’s not that simple. The Referee would still see a semi transparent image.

The image below contains 3 counters. Counter 1 is what invisibility looks like to the owning player. Counter 2 is the same except a purple highlight color has been selected. Counter 3 is unhidden. What I’d like to do is make hidden units look like counter 3 (i.e. no transparency) to the owning player.

Thanks for the idea. Does any one have any others?

Thanks very much.

Allan

It’s possible that the same end could be achieved by different means than the invisibility trait.The transparency in a hidden piece is just there as a visual indicator that the piece is hidden to non-owners. Is there some in-game reason why you wouldn’t want an owning player to know that his piece is hidden?

The printed game uses two maps…a player map and an umpire (or referee) map. For the VASSAL module, I’ve combined the two maps into one. Since a piece hidden to the player will never be made visible to the player (i.e. it stays hidden for the entire game, I thought it would be more aesthetic for the umpire to view the hidden piece as if it wasn’t hidden.

Does that make sense?

I’ve been experimenting with other options to achieve the same affect but to no avail. All options haven’t worked or introduce too many other issues. I’ve tried map level Game Piece Layers, Masks, and transparent piece layers.

I found a similar capability that’s what I want in another VASSAL option. When using the LOS thread you have an option to vary the opacity of units on the map. I’ve appended a line from the build file that seems to apply to this option. In my example I selected an opacity of 37% and that seems to correlate with the hideOpacity=“37” listing in the line of code.

Is there a way to generate a similar setting for invisible game pieces? I wish I was a programmer. I think the answer could be a fairly simple edit to the Invisible portion of the VASSAL programming code. I’m hoping an edit could be made to the build file code to achieve this result. Obviously though I’m in the dark about what this would take.

Thanks for any help. I appreciate it.

Allan

<VASSAL.build.module.map.LOS_Thread drawRange=“true” global=“Never” hideCounters=“true” hideOpacity=“37” hotkey=“82,195” iconName="/images/thread.gif" label="" persistence=“Never” persistentIconName="" rangeBg=“0,0,0” rangeFg=“255,255,255” report="" round=“Nearest whole number” scale=“0” snapEnd=“true” snapStart=“true” threadColor=“255,255,51” threadName=“Range” tooltip=“Click/Drag to find range in hexes”/>

You can find the relevant Invisible trait code here

vassalengine.svn.sourceforge.net … a?view=log

You wouldnt want to edit it but make a copied version which you would change and import as a custom class so It does not affect other modules. You would probably want this custom class to override/write? how hideable works. You really need Joel or Mike or Brent or Pieter (who’s done a lot of this lately) tell you specifics here how to do it.

Going over the code it looks like (I think - could be wrong) that it is using java.awt.AlphasComposite to create the opacity effect for the hidden counter specifically the section:

Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3F));
piece.draw(g, x, y, obs, zoom);
g2d.setComposite(oldComposite);

I’m guessing you are going to want to change the AlphaComposite.SRC_OVER to 1.0F (which would be Clear).

See download.oracle.com/javase/1.4.2 … osite.html

This is very helpful Tim, thank you.

I’ve been searching previous posts for a tutorial on how to import a java class. I found one thread but this is such foreign territory for me that I’m still lost…albeit not as lost as when I first posed the question. Thanks again Tim.

What is the name of the class that the AlphaComposite.SRC_OVER resides in?

I assume I use a text editor to change the 0.3F to 1.0F and then save it with the class name.

Then do I place that file in the module zip archive?

Where does the program look for imported classes?

Many components of a module allow you to import a class. Does it matter where in the module you import the class? Since I’m applying this trait to specific game pieces I’m guessing that I should import the class to a prototype that is applied to all affected pieces.

Maybe Joel, Mike, Brent, or Pieter could chime in and make sure I’m on the right track?

I apologize for all the questions. I’m trying to learn. VASSAL is fantastic platform!

Thank you again in advance. I really appreciate your help.

Allan

I am still buried under arranging incorporation, and getting started on a
new contract. I am now pretty good at importing classes, but may not be able
to look at this for you until Friday. Remind me then.

Pieter

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of BigAl737
Sent: Tuesday, March 08, 2011 3:47 PM
To: messages@vassalengine.org
Subject: [messages] [Module Design] Re: Invisible Opacity Level

This is very helpful Tim, thank you.

I’ve been searching previous posts for a tutorial on how to import a
java class. I found one thread but this is such foreign territory for me
that I’m still lost…albeit not as lost as when I first posed the
question. Thanks again Tim.

What is the name of the class that the AlphaComposite.SRC_OVER resides
in?

I assume I use a text editor to change the 0.3F to 1.0F and then save it
with the class name.

Then do I place that file in the module zip archive?

Where does the program look for imported classes?

Many components of a module allow you to import a class. Does it matter
where in the module you import the class? Since I’m applying this trait
to specific game pieces I’m guessing that I should import the class to a
prototype that is applied to all affected pieces.

Maybe Joel, Mike, Brent, or Pieter could chime in and make sure I’m on
the right track?

I apologize for all the questions. I’m trying to learn. VASSAL is
fantastic platform!

Thank you again in advance. I really appreciate your help.

Allan


Read this topic online here:
https://forum.vassalengine.org/t/invisible-opacity-level/3707/8

Here’s your friendly reminder Pieter, thanks. I won’t be able to act on any suggestions for a week so please respond when convenient.

In case you need it, here’s a link to the module. The specific pieces I’m trying to modify are all the Targets and the Alert and Hit markers. The Invisible trait assigned to the Targets is part of a prototype named AirUnitTarget.

Thank you.

preview.tinyurl.com/NFprv4a

A friendly reminder to see if your schedule has let up Pieter or if anyone else can help me out.

Thanks.

Allan