Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Latest Posts

ImmovableProgramReference

Immovables can have programs that will be executed by the game engine. Each immovable has a program named ''program'', which will be started automatically when the immovable is created in the game, and then repeated until the immovable is destroyed. If that program is not explicitly defined, it is created automatically and will contain a single command that will run the ''idle'' animation forever. Each program must be declared with program=''<name>'' in the [''global''] section of the immovable's definition. A program is defined in the section that has the same name as the program (the order of program definitions does not matter). A worker can call an immovable program. A program consists of a sequence of commands. A command is written as ''<type>=<parameters>''. The different command types and the parameters that they take are explained below.</parameters></type></name>

command types

animate

Runs an animation.

Parameter syntax:

  • parameters ::= ''animation'' [''duration'']

Parameter semantics:

  • ''animation'': The name of an animation (defined in the immovable).
  • ''duration'': A positive integer. If omitted, the duration is infinite.

Starts the specified animation for the immovable. The actual duration is a random number from 1 to ''duration'' * 2 - 1, with [http://en.wikipedia.org/wiki/Binomial_distribution binominal distribution].
Blocks the execution of the program for the calculated duration. (The animation will not be stopped by this command. It will run until another animation is started.)

playFX

Plays a soundFX.

Parameter syntax:

  • parameters ::= ''soundFX'' [''priority'']

Parameter semantics:

  • ''soundFX'': The filename of an soundFX (relative to the immovable's directory).
  • ''priority'': An integer. If omitted, 127 is used.

Plays the specified soundFX with the specified priority. Whether the soundFX is actually played is determined by the sound handler.

transform

Removes the immovable and replaces it with a new immovable of another type.

Parameter syntax:

  • parameters ::= ''typename'' [''probability'']

Parameter semantics:

  • ''typename'': The name of the type of the new immovable. For a tribe immovable, the name refers to an immovable type defined in that tribe. If the name includes the prefix "world:", the name refers to an immovable type defined in the world. The name may not refer to the immovable type that the command is defined for.

  • ''probability'': A positive integer in the range 1 .. 254. The probability that the transformation will be done. If omitted, the transformation is unconditional.

grow

Like transform but takes into account how well the immovable thrives.

Parameter syntax:

  • parameters ::= ''typename''

Parameter semantics:

  • ''typename: (see transform)

The probability that the transform will be done is determined by how well the immovable thrives. This is currently only influenced by the terrain types of the surrounding triangles. See the section about terrain affinity.

remove

Like transform but does not create a new immovable.

Parameter syntax:

  • parameters ::= [''probability'']

Parameter semantics:

  • ''probability'': (see transform)

seed

Creates a new immovable at a random location near the immovable.

Parameter syntax:

  • parameters ::= ''typename'' [''probability'']

Parameter semantics:

  • ''typename'': The name of the type of the new immovable. For a tribe immovable, the name refers to an immovable type defined in that tribe. If the name includes the prefix "world:", the name refers to an immovable type defined in the world.

  • ''probability'': A positive integer in the range 1 .. 254. The probability that the seed will travel one distance step further away.

Like for grow, the probability that a command of this type will do anything at all is determined by how well the immovable thrives (see grow). If the command will do anything, it will do it as follows.

First, the distance is set to 0. Then, a random number in the range 0 .. 255 is generated. If this number is less the parameter ''probability'', the distance is increased and a new number is generated and used in the same way. Otherwise the distance calculation is finished. This will give the distance a geometric distribution.

When the distance has been chosen, a location with that distance from the immovable is chosen randomly.

Then it is calculated how well the immovable thrives at the chosen location (see grow). This determines the probability that the seed will germinate there. If so, a new immovable of the specified type is created there.

terrain affinity

Each immovable type can define a terrain affinity. It determines how well immovables of this type thrive on different terrain types. This influences the probabilities that immovables of this type will grow and seed.

The immovable type can have the section [terrain affinity] with key=value pairs. Each key is the name of a terrain type and the value is a natural number in the range 0 .. 255. The value 0 is used for terrain types that are not assigned an affinity value.

To calculate how suitable a node is for the immovable type, the affinity values of the terrain types of the 6 surrounding triangles are added. This gives a value in the range 0 .. 6 * 255.