Auto Test Label on Units?

Hi Vassal Gurus,

I’m developing a strategy game where players build and deploy their own navies. Right now, each battleship unit has a “Text Label” trait, so the individual instances of each battleship can be named; I can have the “USS Ohio” and “USS Delaware” and “USS Virginia” all on the board, all with neat little labels so you can track which ship is which. Its really cool.

But its also a pain to pause the game and manually type a name every time a new ship is deployed. Is there some way I can give my game module a long list of ship names in advance, and then every time a battleship is deployed, the module auto-labels the ship with the next name on the list? Would that require an imported Java class to do this?

Thank you!

I think I’d approach this differently. I think I’d create a deck of battleships with each one pre-named to one of you list of names. Essentially, you would have a list of named battleship images. A player would simply draw a “card” (named battleship) from this deck when they needed one. You could shuffle the deck to get a random selection order.

@shilinski Interesting, thank you! But under your system wouldn’t a battleship when be a card in the player’s hand, not a unit on the board? Ultimately, I want battleships on the gameboard along with other units like patrol boats and mines and aircraft and so one. But only the battleships would carry names.

Thank you!

In Vassal, a card is a piece that starts life(usually) in a Deck. Once placed on a board it will behave just like any other piece, subject to the traits that you give it.

To use the battleship pieces, it sounds like your players would be drawing them and placing them on a normal board/map rather than into a player hand.

@marktb1961 Huh, interesting! I learn so much from these forums.

So you’re correct, to deploy a brand-new battleship, my players would be drawing from a deck and immediately placing it on the board. Hmm. Could the deck of battleship cards be placed in a ScrollableList? Right now, to grab a new battleship, the players select “Battleship” from a SL and drag-and-drop it onto the board. Can I just replace the Battleship Unit with a Deck of Battleship Cards? Because that would be cool. :slight_smile:

No. You are relying too much on the piece palette. The piece palette is a factory that can generate millions of like pieces, and you have little to no control over this. For example, if the British army has exactly 10 cavalry units in it, a piece palette to get cavalry is undesirable because you can’t limit them to 10 (or anything).

Most games implement other map windows solely to have orders of battle where strict piece counts can be enforced. You could drag and drop pieces from this window, or if you are clever, you could right-click a special piece on the main map that gets the piece for you. The deck I suggested would be in this window.

1 Like

@shilinski Ahhhhhhhh… I see. Thank you, I learn a lot from you comments. Much appreciated!