Create account / Log in

Running Total of Map Pieces

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 2:03 am

Does anyone know of a simple way to keep a running total number of Pieces on a Map? Page 52 of the Designer Guide describes a method using an action button.

Totaling the Number of Pieces on a Map
You can use the Marker Trait in conjunction with the Set Global Properties Trait to sum the number of pieces on a map.
1. Create a Global Property called PieceTotal.
2. For the new Global Property, create a Change-Property button called Zero Total that will set PieceTotal to 0 (In
Type, choose Set Value Directly).
3. Create a Marker on each piece you want to add to the count. Name the Marker Count, with a value of 1.
4. Create a Set Global Property Trait on each piece, which will increment PieceTotal by 1.
5. Create a Global Key Command called Total Pieces. For Global Key Command, use the keyboard shortcut of the Set
Global Property Trait you specified in Step 3, and in Matching Properties, enter Count = 1.
6. Create a Toolbar Action Button called Count Report. In Display Message, and enter Total Number of Pieces on Map:
$PieceTotal$.
7. Create a Multi-Action Button called Total, and add the Zero Total, Piece Total, and Count Report buttons to it.


I get the concept, but it doesn't really work for my purpose. I need a running total because I'm trying to restrict a command if the map's stacking limit is exceeded. If the restriction requires some activity to trigger, a player could bypass the restriction whenever he avoids triggering a count.

I considered keeping my own running total by adding and subtracting keystrokes from a global property, but that's non-trivial because some keystrokes generate a boolean result (true, false) whereas others add and subtract with each instance. The resulting formula to create an accurate running total is a boolean-numeric hot mess. It would be just so much easier if there was some expression that just counted all Pieces on Map Z or Location XY and compared to the stacking limit. I'm guessing no, because of the convoluted suggested method for counting with a button...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby Cattlesquat » May 22nd, 2020, 2:35 am

I usually do that kind of counting, still with Global Properties, but I generally have the pieces (or rather the prototypes for each class of pieces) do their own counting whenever they get moved.

So my map generates a keystroke-on-moved (bottom box in Map's properties) which I set to MovedOnMap.

Pieces receiving MovedOnMap know important things like OldLocationName / LocationName, and OldZone / CurrentZone, and things like that. So then I can fuss the name of a Global Property together from the piece type & zone or location or whatever, and add/subtract things as appropriate. Like in the module I'm working on now if a piece type "Cell" is owned by player side "Senate" and my Current Zone is "Helsinki" then the expression that decides which GlobalProperty to set (e.g. Side + "_" + Type + "_" + CurrentZone ) comes up with Senate_Cell_Helsinki and increments/decrements that, and vice versa for its OldZone.

Hopefully that vaguely makes sense and points you in a useful direction.

You get 100% capture for piece moves this way, so as long as you're tracking the stuff you want the counts will stay accurate, and you can access their values any time through the various Global Properties. (I have like 16 province Zones in my latest game module, 2 major piece types, and 3 different player sides, so I just crammed in 96 Global Properties and now everything is counted).

Other games that have ass-tons more spaces and types, I've had to count things up on the fly with global key commands to the space -- a lot slower and more performance intensive. So there are choices.

Those are some best-guesses about what might work for you.

Brian
User avatar
Cattlesquat
 
Posts: 895
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 2:42 am

Thanks. The pieces in question don't "move" in many instances. I've created a bunch of unit actions that cost currency and limit those actions by tracking those currencies. This particular action is limited by stacking limits, not currency. Moving pieces around the map is irrelevant for what I'm tracking so it's not a useful trigger. I think the only way to do this is the carefully construct a giant formula that totals all those numerical and boolean results and pray I have no holes in the logic...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby Brent Easton » May 22nd, 2020, 2:50 am

Just be careful of implementing automation that restricts players from doing things with counters that are 'against' the rules, or does things that cannot be done manually. It has happened before and the end result where amazing modules that where almost completely unusable.

The two main problems where:
  • A module that is impossible to use by a casual player unless they know the secret sauce of which actions have to be done in which order. The module ends up 'locked' in an invalid, unusable state.
  • A module that is impossible to use by players who have house rules.

Not saying you are heading in that direction, but be aware.

The internal architecture of Vassal was never designed with automation in mind, it was all 'tacked' on later and so many things that you would think should be 'easy' to do just aren't and can't easily be added. The lengths module developers have to go to to implement 'normal game stuff' is amazing (Hi Brian :) ), but there is little we can do about it. This is one of the major reasons the developers are looking at a fresh slate for an updated Vassal. Vassal 3 really is held together with string and sticky tape and the string and sticky tape is fraying :)
User avatar
Brent Easton
 
Posts: 3169
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 3:32 am

Yeah I get all that, but take away the automation features and Vassal is worthless compared to TTS or Tabletopia. I'm the designer of the game for-said module and am creating it in lieu of live playtests since those are going to be impossible in 2020. There are a bunch of activities on player tableaus that are very procedural and hidden from others - thus they lend themselves to automation and rules enforcement both as a teaching tool and keeping players honest. Gameplay on the main map I'm fine with it being a virtual sandbox. Vassal is obviously not equipped to enforce movement, ZOC, supply, LoS etc...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby Cattlesquat » May 22nd, 2020, 2:04 pm

I may have been coming in with the wrong assumptions, having not seen your game (e.g. not much movement). But if the units aren't reaching stacking limits because of movement, they must be reaching them by being added? Being added to a map (whether by Send-to-Location from some other "map" like a reinforcement card, or being dragged from a Game Piece Palette, or created by an event card) is ALSO considered "ending movement on the map" for the purpose of the keystroke-on-move being applied, so you could still maintain running totals by detecting what zone/location pieces are ending up in. The one exception to the "movement" keystroke being applied is if a piece is created by a Place Marker trait and then isn't moved anywhere -- but if you want those to add to your running totals you can just "manually" apply the keystroke in the apply-to-piece-after-placement box on the Place Marker trait.

(And Hi Brent, haha! :D I think there's definitely a knack to "unobtrusive" automation -- guides you along the path but doesn't stop you from having the sandbox experience if you want it -- like in Paths of Glory playing event cards will automatically bump your War Status but if you want to drag the War Status counter to 7 and play from there it will take that in stride. And you can drag the Mandatory Offensive marker wherever you want, but it might put up a note saying "did you notice that Italy isn't in the war yet". It's one of the reasons I love Vassal compared to e.g. playing in one of the apps that completely enforces the rules and therefore also its own bad interface to the rules, etc, etc)
User avatar
Cattlesquat
 
Posts: 895
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 2:45 pm

It's a deck builder roughly akin to A Few Acres of Snow or Hands in the Sea. The Pieces in question are cards that you can play (used), tap (ongoing), draft, reserve, or trash. Players are free to drag and drop them wherever they like so movement isn't a meaningful metric because they all begin in At-Start Stacks. The automation is tracking when they are eligible, drafted, paid for, reserved, used, trashed etc... The "stacking" I'm trying to enforce is a limit on the number that you can reserve.
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 3:03 pm

I think the only way I can do this is to create a Global Property for each nation like "Germany_Reserved_Total", boolean true a card-specific Property "In_Reserve" when the German player keystrokes its "Reserve" action, then reset Germany_Reserved_Total to zero any time he keystrokes anything that could possibly change In_Reserve (whether it does or not is irrelevant). But then the problem is how to trigger a "Count_Germany_Reserved_Total"? It needs the same trigger as the reset. If I place one before the other, will that work? If not, may I reset whenever something can increase it, then count whenever something can decrease it? Because I only need Germany_Reserved_Total to be accurate when someone is trying to increase his total. Thus the count needs to be established before they try the keystroke...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby Cattlesquat » May 22nd, 2020, 5:09 pm

Ways to go about it...

#1 Count on the Fly at time of Reserve Attempt:
a. You can totally have triggers execute in a "chain", and you can fork the chain, etc.
b. So at time of attempt to send something to reserve, first clear the Global Property and send out a Global Key Command filtered to just "German cards that are in reserve" and those cards respond by incrementing the global property. So as soon as that GKC executes, any subsequent triggers (i.e. lower on the apply-triggers list w/in a Trigger trait, or in a trait lower in the originating piece's stack of traits) will be able to look at the Global Property and know how many are reserved -- so you could then chain a pair of Trigger traits, one of which performs the reserve operation if count is low enough, and the other of which leads to a Report of a "Sorry" message if the reserve is full.

#2 Maintaining running accurate count
* No reason you couldn't do this too.
* Increment the count whenever something is put in reserve.
* Decrement the count whenever anything is taken out of reserve (how many things do you have that take a card out of reserve?). If the card itself is managing its In_Reserve property, then it can also be told to decrement the global reserve count whenever it turns that off -- whether in response to being moved, being unmarked, being sent to the discard pile, etc.
User avatar
Cattlesquat
 
Posts: 895
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 6:54 pm

I'll try for #1. I don't like #2 because I don't think strict rules enforcement is viable with Vassal. If I limit players to only doing things with keystrokes, the rules enforcement would be brittle because it can be broken by a player who drags and drops instead of using a keystroke. The automation is much more resilient if I assume players will sometimes drag and drop. If the automation only works "most of the time", that's almost worse than none at all...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby m3tan » May 22nd, 2020, 11:51 pm

Turns out there was a simple solution after all. Decks have 2 properties options that allowed me to dramatically simplify all flowcharts. 1. "Restrict adding counters by Drag'n Drop" allows me to prevent drag 'n drop from ever circumventing the rules enforcement. 2. "Perform counting of property expressions" allows me to count how many cards of each type are in various locations.

With these tools, I was able to keep a running total of the reserve without ever needing to reset and recount.
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm

Re: Running Total of Map Pieces

Postby Cattlesquat » May 23rd, 2020, 12:18 am

Glad you got it going, but I just want to make sure you're aware that you DON'T have to "require players to do everything with keystrokes" to get these things to work. My modules let players drag things all across creation and back, including to bizarre off-map non-marked places and god knows where, but still keep accurate counts.

The trick is that bottom box on the properties page of your Map(s), the one labeled "Key command to apply to all units ending movement on this map". If you put a keystroke (e.g. Ctrl+M) or a named keystroke (e.g. MovedOnMap) in that blank, it will be applied (i.e. sent to) every piece that is moved to or on that map. In other words, it is applied with players drag and drop things around all over the place. And when the piece is processing the command, it has access to all sorts of exposed properties about where it came from and where it just went (e.g. LocationName, OldLocationName, CurrentZone, OldZone, CurrentMap, OldMap, CurrentX, OldX).
User avatar
Cattlesquat
 
Posts: 895
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Running Total of Map Pieces

Postby m3tan » May 23rd, 2020, 1:28 am

Yeah that makes sense. In this particular case, I'm tracking whether you can do things with currency, so that's why I require keystrokes - because they are linked to consuming those resources. What I didn't know about yet when I started this thread was the key command for any movement on maps and the deck counting and restriction capabilities. Between those three I can see how one can track almost every drag n' drop...
User avatar
m3tan
 
Posts: 191
Joined: August 12th, 2018, 11:49 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 7 guests