[messages] [Module Design] Calculated Property slows down VASSAL excessively

greenknight roe.dmb at gmail.com
Tue Sep 6 10:07:25 CEST 2016


"Brent Easton" wrote:
> Vassal is an interpreted system running an interpreted version of Java
> to evaluated Calculated Properties. There is a limit to what you can
> do. If you have a very complex property and that property is used to,
> say, set the layer number of a Layer trait, and you have have lots of
> counters with that same setup and you are manipulating the screen as
> you normally do and so each piece on the screen is being redrawn
> multiple times per second, then you can quickly have that one
> particular complex Calculated Property being re-evaluated hundreds of
> times a second and you have a problem.
> 
> Try not to use Calculated Properties for things that calculate the
> same value again and again.  Every time a CP is referenced, it has to
> calculate its result again from scratch. It can't 'know' whether or
> not the variables you reference have changed. Your example looks like
> it is doing something with a Die Roll. Calculate the value just once
> when the die is rolled and store the result in a Dynamic Property,
> which are reference extemeley quickly.
> 
> Rgds.


I managed to find a workaround, one that used a much simpler setup of
Restrict Commands and Report Action using oldLayer X_Name.

If anything it helped me learn something new :D

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=52104#p52104


More information about the messages mailing list