I am looking for a way to hide/display game pieces to the players based on who owns them using the game piece layer.
Here is more detailed information:
In the module I am working on there are several railroads. Players can buy these railroads and own them. When someone buys a railroad I highlight that railroad in the players color. I want to add the ability to the module for players to select which players railroads they want to see highlighted or not. So for example the blue player may want to see only railroads owned by the red player. They would click on a black, green, yellow,and white buttons on the toolbar to deactivate the black,green, yellow,and white layers so they can only see their railroads and the red players railroads.
How I was hoping to implement it.
Layers are determined by a marker name with a value. For example Marker - Layer = Land or Marker - Layer = Air on another piece. I was hoping to assign the Marker - Layer value with a dynamic variable like the following Marker - Layer = $OwnerColor$. Then I could change the $OwnerColor$ variable based on who owned that railroad.
My question is, can marker values accept a variable or property? If they cannot does anyone have any ideas on how during the game I can assign a piece to either a numeric layer on the map or a layer based on the player colors (blue, red, black, white, green, yellow)? If I can assign them to a number or color during gameplay I could then easily turn them off using the game piece layer control.
If I cannot use game piece layers and the game piece layer control to activate/deactivate them my other line of attack would be to use the invisible property for the basic piece definition. I would then use a global key command with a filter that check for the piece ownership and for each one that matches the correct color toggle it between invisible/visible. That is the only other way I can see to achieve this. The problem with this method is that I believe when toggled it applies to all player views whereas the game piece layer control settings I believe are separate for each player so each player can have whatever layers activated or deactivated based on their individual needs/preferences.
I am rendering the color highlight for each railroad based on which color player owns the railroad using the layer property (not to be confused with game piece layer) in the basic piece definition. I have six images of the railroads and I toggle through to the appropriate level based on the player the acquired the railroad. I have 28 railroads each with seven images (the six player colors plus one black one when no one owns the railroad).
Thanks in advance for any ideas on how I can solve this problem.