Create account / Log in

Refresh a GP from a calculated property

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Refresh a GP from a calculated property

Postby kerkael » December 1st, 2020, 8:43 am

Hi,
I already asked that question in another post but for other needs.
I have a 4 players game with a total of 5 maps: 1 global map, 1 for each player.
Using calculated properties, labels and zones, each player map (or board) displays numbers of pieces in a graphical table. This wors fine.

As a synthesis, I try to display that same info on the main map.

But the same label can't be shown on 2 different maps. So I'd need to get its info from a Global Property.
My problem is the Global property is not refreshed in real-time when something changes on a map. I'd need a trigger for that. And I'd need to change the labels on each individual map so they are populated by calculated property (real-time) but they refresh the GP based on some triggers.

If I only use actions, buttons, and keystrokes, then it's ok to trigger the GP.
But if someone grabs a piece manually to drop it somewhere else, the calculated property is ok to show the zone content and changes, but there is no trigger for the GP.


What would you do ?

I think I will trigger the main map update after the end of a player's turn. This means the main map will show obsolete info until the end of current player's turn. But I really wanted to make it dynamic :(.
Still working on : Terraforming Mars Fr
kerkael
 
Posts: 197
Joined: December 1st, 2017, 3:03 pm

Re: Refresh a GP from a calculated property

Postby jrwatts » December 1st, 2020, 8:51 am

There is an option on each map to fire a key command whenever a piece ends its movement on that map. Just trigger the GP update from that on all the maps players can drop pieces on.
jrwatts
 
Posts: 222
Joined: April 29th, 2020, 10:30 pm

Re: Refresh a GP from a calculated property

Postby kerkael » December 1st, 2020, 11:00 am

Yes I use that option too. Thanks.
I'm afraid this would trigger too many reactions, and make the whole thing heavy, based on the total number of pieces I would have at the end.
Still working on : Terraforming Mars Fr
kerkael
 
Posts: 197
Joined: December 1st, 2017, 3:03 pm

Re: Refresh a GP from a calculated property

Postby Nelud » December 1st, 2020, 7:40 pm

Interesting. I thought that having Calculated Properties directly displayed on Text Labels might have more impact on performance, than recalculating some of them when moving pieces. But I'm not sure. And I'd like to see comments on this topic from vassal developers.
Nelud
 
Posts: 35
Joined: September 28th, 2008, 5:20 am
Location: Saratov, Russia

Re: Refresh a GP from a calculated property

Postby JoelCFC25 » December 1st, 2020, 9:16 pm

Referencing a Calculated Property in an omnipresent Text Label absolutely had crippling performance impacts for me--even used sparingly (two labels). Brian pointed me in the right direction, which was to have Dynamic Properties that update at the needed times with the CP value, and display the DP in labels.
JoelCFC25
 
Posts: 792
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Refresh a GP from a calculated property

Postby kerkael » December 2nd, 2020, 1:27 pm

That point is interesting, Joel !
Going 1 step beyond,
You suggest to use a CP to do the maths, and name the CP in the DP to be displayed in labels.
What about using the CP formula directly in the DP definition ? If the Calculated Property has no other reason (in my dev) than to be displayed, it would be even better, no?
Still working on : Terraforming Mars Fr
kerkael
 
Posts: 197
Joined: December 1st, 2017, 3:03 pm

Re: Refresh a GP from a calculated property

Postby m3tan » December 4th, 2020, 2:21 pm

kerkael wrote:Yes I use that option too. Thanks.
I'm afraid this would trigger too many reactions, and make the whole thing heavy, based on the total number of pieces I would have at the end.

Why is this too many triggers? Are all 4 players selecting and moving giant stacks of pieces simultaneously? In most turn-based games, only a single player is manipulating a single stack at a time. I say this because every module I've designed uses CPs on each piece that update GPs with map-based movement triggers and I've had zero performance issues...
User avatar
m3tan
 
Posts: 232
Joined: August 12th, 2018, 11:49 pm

Re: Refresh a GP from a calculated property

Postby kerkael » December 9th, 2020, 10:30 am

I was not talking about the big stacks moved at once, but about the multiple locations I wanted to display the labels.
But I found my way out, thanks to the help here.
Working with GP without initial value, I can even have my players scores (many labels to display) not showing anything if I have less than 4 players ! As soon as a player is in, the scores and labels are being displayed with zeros everywhere (at first, then they will evolve)
Still working on : Terraforming Mars Fr
kerkael
 
Posts: 197
Joined: December 1st, 2017, 3:03 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 7 guests