Mathematical operators

 

 MeaningExample
+Addpop.size + otherpop.size
Subtractdominance – 10
*Multiplyelevation * .01
/Dividerainfall / 10
%Modsomething % 5
^Exponentialbiomass ^ 1.01
=Equals (returns 1 if equal, 0 otherwise)shore = 6
!=Not equals (return 1 if unequal, 0 otherwise)shore != 6
>Greater than (returns 1 is greater than, 0 otherwise)size > 1000
<Less than (returns 1 if less than, 0 otherwise)capdistance < 5
andLogical AND – returns 1 if true, 0 if falsesize > 1000 and capdistance < 5
orLogical OR – return 1 if true, 0 if falsedominance > 10 or size < 1000
xorLogical EXCLUSIVE OR – returns 1 if true, 0 if falseCapdistance > 5 or shore = 6

Mathematical functions

 MeaningExample
positive(x)Take positive value, or 0positive(-100) => 0
positive(100) => 100
plusminus(x)Random value plus or minus Xplusminus(3) => [-3,-2,…. 3]
absolute(x)Absolute value of xabsolute(-100) => 100
chance(x)A 1 in X chance of returning 1, else 0chance(1000) =>
root(x, y)The y’th root of xroot(x, 2) => square root of x
min(x, y)The smaller value of x and ymin(3,2) => 2
max(x, y)The greater value of x and ymax(2,3) => 3
range(x, y, z)Returns x, unless outside the bounds of y and zrange(5, 1,10) => 5
range(-10, 1, 10) => 10
range(20, 1, 10) => 20
if(x, y, z)If x <> 0, then returns y. Otherwise returns z.if (1 > 2, 100, 0) => 0
if (1 < 2, 100, 0) => 100
avg(x,y)The average between x and yavg(1,3) => 2
wavg(x,y,z,w)The average between x and y, weighted by z and w. (usually used to weight averages by sizes)wavg(pop.value, otherpop.value, pop.size, otherpop.size)
proportion(x,y,z)The value “z” the way between x and yproportion(0, 10, 0) => 0
proportion(0, 10, .5) => 5
proportion(0, 10, 1) => 10
round(x)Rounds the value to the nearest whole numberround(.8) => 1
round(.2) => 0
trend(x,y,z)Returns the value as if x was trending to y over z turnstrend(0,10,20) => .5
trend(0,10,5) => 2
trend(0,10,2) => 5

Objects available in each type of formula

Population update formulas
 MeaningExample
(default)The populationsize, dominance, capdistance
idtotalThe total values of all populations in the population’s identityIdtotal.size
idavgThe average values of all populations in the population’s identity (size weighted)Idavg.capdistance
hexThe hex the population is inhex.elevation, hex.terrain
hextotalThe total values of the populations in the hexhextotal.size
hexavgThe average values of the populations in the hex (weighted by size)hexavg.dominance
 

Population merge formulas

 MeaningExample
(default)The dominant population in the mergesize, dominance, capdistance
idtotalThe total values of all populations in the population’s identityIdtotal.size
idavgThe average values of all populations in the population’s identity (size weighted)Idavg.capdistance
hexThe hex the population is inhex.elevation, hex.terrain
hextotalThe total values of the populations in the hexhextotal.size
hexavgThe average values of the populations in the hex (weighted by size)hexavg.dominance
otherpopThe other, non-dominant population in the mergeotherpop.size, otherpop.dominance

Cell initial formulas

 MeaningExample
(default)The cellterrain, rainfall, etc

Cell update formulas

 MeaningExample
(default)The cellterrain, rainfall, etc

Split formula

 MeaningExample
(default)The populationsize, dominance, capdistance
idtotalThe total values of all populations in the population’s identityIdtotal.size
idavgThe average values of all populations in the population’s identity (size weighted)Idavg.capdistance
hexThe hex the population is inhex.elevation, hex.terrain
hextotalThe total values of the populations in the hexhextotal.size
hexavgThe average values of the populations in the hex (weighted by size)hexavg.dominance

Join formula

 MeaningExample
(default)The dominant population being considered for the joinsize, dominance, capdistance
otherpopThe non-dominant population being considered for the joinotherpop.size, otherpop.dominance

Migrate potential & percentage formulas

 MeaningExample
(default)The dominant population in the mergesize, dominance, capdistance
idtotalThe total values of all populations in the population’s identityIdtotal.size
idavgThe average values of all populations in the population’s identity (size weighted)Idavg.capdistance
hexThe hex the population is inhex.elevation, hex.terrain
hextotalThe total values of the populations in the hexhextotal.size
hexavgThe average values of the populations in the hex (weighted by size)hexavg.dominance
otherhexThe other cell being considered for migrationotherhex.shore, otherhex.elevation
otherhexavgThe averages of the population properties of the other cell being considered for migration (weighted by size)otherhexavg.dominance,
otherhexavg.capdistance
otherhextotalThe totals of the population properties of the other cell being considered for migrationotherhextotal.size,
otherhextotal.capdistance
special.IsSameIdentityIs the same identity already in the hex in question?special.IsSameIdentity
special.IsSeaMigrationIs this a sea migration?special.IsSeaMigration

Special properties with special handling by the model engine

 MeaningHandling in the engine
pop.sizeThe number of people in the population.This is a required population property in all model designs. If it falls below 0, the population dies and is removed from the map.
pop.dominanceThe “dominance” of the population relative to other populationsThis is a required population property in all model designs. When populations merge, the dominant population is retained, as part of the dominant identity.
pop.capdistanceThe distance from the population’s “Capital city”, which is the first, founding cell of the identity (when the original population split)

This is an optional population property. If a property called “capdistance” is defined, then the update & merge formulas are ignored, and the value is calculated by the engine.

(NOTE: Currently it is calculated by some Euclidean approximation, making it difficult to use. A future version will calculate it based on “number of hexes away from the capital” instead.)

pop.seamigrateThe number of hexes this population is capable of migrating over sea.If this value is 2 or greater (eg. the population can journey over 1 water hex and then reach a land hex), then the engine will attempt a random sea voyages each turn as part of the migration potential calculations. Whether the overseas hex is migrated to still depends on whether the migration potential there is the highest. (Note there is a special value available in the migration potential function called “special.isoverseas” which is 1 for sea migrations)
hex.terrainLand or water, where water – 0 and land = 1This is a required hex property in all model designs, populated automatically by the map data.
hex.shoreThe total number of water hexes adjacent to the hexThis is an optional hex property. If added as a hex property, it is populated automatically from the model data.
hexavgThe average values of the populations in the hex (weighted by size)