Hello, I am trying to find my way back into Vassal module designing after many years. Apologies in advance if some questions I might ask are already answered somewhere else.
How do I find out how many players are “connected” at the start of a game via the Vassal server? And their nicknames?
The module I am designing is for 2 to 4 players and I am trying to automatize setup of the game. In particular, I need to distribute cards and such in different ways, depending on the number of players in the game.
I would also like to possibly show the name of the players next to some turn tracker/victory track counter.
I think it’s necessary to have the players actively do something to trigger setup (such as having each one click a button). The button could be a disposable counter and could even be deleted after the game setup is over. The module won’t know passively how many players are connected.
Or have one player click a ‘Number of Players’ button that triggers the right card deals at game start. There could be commands on the button, 1 for each player number (“Setup 2 Players”, “Setup 3 Players”, etc.) Each one of these commands triggers the setup routine for that number of players.
Their nicknames, however, are each contained in the $PlayerName$ property. For labels on the turn tracker, use Text Label Traits on the counter. If you set up a command for each player to click, you could have the command set a group of Global Properties with each player’s name ($PlayerName$) and then use the GP values for the labels.
You can’t do that. However, you can create an initialization process for your players. This is something I do in most of my modules as the game setup is generally dependent upon how many players are in the game.
Create a initialization button for each player and a Game Start button. As each player logs into the game, they click their initialization button. You can have this button increase a Global Property (something like PlayerCount) to keep track of the number of players and you can set up any number of other properties for each player.
Once all active player are initialized, click the Start Game button and have it do whatever it needs to do based on the PlayerCount.
You can set up an At-Start stack that displays the name of the player anywhere you like. See page 58 of the Designers Guide for more information on Text Labels.
vassalengine.org/mediawiki/i … rguide.pdf
thank you all for the suggestions
I guess I could go the “each player clicks a button” way (so to know how many there are and what’s their actual side name and player name is)… but surely the vassal engine does know how many have joined and which side they selected to play with, doesn’t it?
I tried my first online Vassal game today (yes… never played before, just worked for ages on my module before giving up years ago) and when I clicked on “synchronize” with the guy who had started the room I got a screen asking if I wanted to join as player 3, 4 or 5 (game creator and another guy where already in), so of course the game knows how many people have logged in and which sides are still available…
it does sound strange that those properties are reserved and not visible at module level…
No, those properties are visible at the module level. For each player, you can access a property called ‘PlayerSide’ (the side the player has joined). So Vassal definitely knows your side if you’re in the game. There’s another one called PlayerName that works the same. You can use these properties in reports, text labels, comparisons, etc.
What’s not exposed is the converse. If a player is in a game, you can access the property that names the side he’s on…but not the property that tells you whether a given side has a player assigned (and which player it is). Like you point out, when logging on, there can be only one player 1, player 2, so the module definitely knows when a side is taken… but this property of a side is not visible.
If that is really so it’s unfortunate… Are you absolutely sure about it or just your educated guess?
Please take no offense, you are being very helpful and your replies are much appreciated… just trying to make sure before I start adding tons of extra buttons/triggers etc just to find out who really is in the game!
Yes, I’ve had to do the same thing in a few modules.
Would be really, really nice if VASSAL supported these things that would make module design much easier:
- A property with the total number of players (assigned to any side, not observers)
- A property to show whose turn it is, advanced when a comand is issued.
- An automatic trigger you could send to any deck or zone with a given name when a command is issued.
- Random side assignment a “start game” command of some sort is initiated.
- Easily show how many cards are in a deck.
- Easily sum the values for a marker trait for pieces on a board or zone.
Or are anything of these available today without much work (I know there are complicated solutions to some of them).