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

Brent Easton b.easton at exemail.com.au
Tue Sep 6 09:33:26 CEST 2016


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.

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


More information about the messages mailing list