CDR

State Variable Rules

Overview

The meanings of all the state variable rules in Creatures 1 and 2 and summarised in the table below. The functionality of these rules have been obtained through experimentation. As a result some of the information may be incorrect or incomplete but to the best of my knowledge it is accurate.

Opcode Description Creatures Version
end Marks the end of an SVRule. Any opcodes appearing after this marker are ignored. 1.x
0 The integer number zero. Can be used for calculations. 1.x
1 The integer number one. Can be used for calculations. For example, adding or subtracting one from the current state. 1.x
32 The integer number thirty-two. Can be used for calculations. For example, adding or subtracting one from the current state. 2.x
64 The integer number sixty-four. Can be used for calculations. For example, adding or subtracting sixty-four from the current state. 1.x
128 The integer number 128. Can be used for calculations. For example, adding or subtracting one from the current state. 2.x
255 The integer number 255. Can be used for calculations. For example, adding or subtracting 255 from the current state. 1.x
chem 0 Represents the current amount of chemical 0 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 1.x
chem 1 Represents the current amount of chemical 1 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 1.x
chem 2 Represents the current amount of chemical 2 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 1.x
chem 3 Represents the current amount of chemical 3 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 1.x
chem 4 Represents the current amount of chemical 4 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 2.x
chem 5 Represents the current amount of chemical 5 in the brain lobe. This chemical can be added to a lobe through a genetic receptor. 2.x
state Represents the current value of the state of the cell. 1.x
output Represents the current output value of the cell. 1.x
thres The value of 'Nominal Threshold' defined in 'Cell Body Dynamics'. 1.x
type 0

The sum of type 0 dendrites. The individual value of each dendrite for this type is summed and returned. The individual value of a dendrite appears to be calculated as:

value = source cell * ( stw/255)

where 'source cell' is the value of the cell that this dendrite is attached to from the source lobe and 'stw' is the dendrites current short term weight value.

1.x
type 1 The sum of type 1 dendrites. 1.x
anded 0 If all type 0 dendrites are firing then this will be the value of the sum of these dendrites. If any of the type 0 dendrites are not firing then this value will be 0. 1.x
anded 1 If all type 1 dendrites are firing then this will be the value of the sum of these dendrites. If any of the type 1 dendrites are not firing then this value will be 0. 1.x
input To be defined. 1.x
conduct To be defined. 1.x
suscept

Current susceptibility to reinforcement. This is the value calculated by the 'susceptibility' state variable rule on the dendrite dynamics pages of the genetics kit.

This opcode should only appear in the svrules associated with dendrites (otherwise there is no way to determine what dendrite it is pulling the data from).

1.x
STW

The value of the short term weight setting for the given dendrite.

This opcode should only appear in the svrules associated with dendrites (otherwise there is no way to determine what dendrite it is pulling the data from).

The short term weight for a dendrite appears to be calulated using the following formula with a relaxation decay applied to it:

stw = ltw + (susceptibility/255) * reinforcement

1.x
LTW

The value of the long term weight setting for the given dendrite. The long term weight acts as a rest state for short term weight. STW and LTW reduce towards each other with LTW moving slower than STW.

This opcode should only appear in the svrules associated with dendrites (otherwise there is no way to determine what dendrite it is pulling the data from).

1.x
Strength

Current value of dendrite strength.

This opcode should only appear in the svrules associated with dendrites (otherwise there is no way to determine what dendrite it is pulling the data from).

1.x
TRUE If the previous opcode evaluates to TRUE (ie. not zero) then execute the remaining opcodes otherwise the value of state is zero and the SVRule completes. 1.x
FALSE If the previous opcode evaluates to FALSE (ie. zero) then execute the remaining opcodes otherwise the value of state is zero and the SVRule completes. 2.x
PLUS Adds the value of the following opcode to the value of the previous opcode. 1.x
MINUS Subtracts the value of the following opcode from the value of the previous opcode. For example 'state:MINUS:1' will subtract '1' from the current value of 'state'. 1.x
TIMES Takes the left hand opcode multiplied by the right hand opcode and divides this by 256. The result of this calculation is the value of this opcode. For example: '64:TIMES:thres' where 'thres' is 32 will be 32*64/256=8. 1.x
INCR Returns the value of the previous opcode incremented by one. For example 'state:INCR' will add one to the current value of state. 1.x
DECR Returns the value of the previous opcode decremented by one. For example 'state:DECR' will subtract one from the current value of state. 1.x
rnd const Not yet known. 2.x
leak in

This appears to be related to the value of the 'back propogation' state variable rule. If any other lobe has this current lobe as a 'source lobe' in its dendrite settings then the value of 'leak in' for the current lobe is the value of the 'back propgation' svrule from the destination dendrite.

This can be used to feed data back to a source lobe from destination lobes. I'm unsure as to whether this information (from multiple destination lobes) is summed as I've only tested it with single destination lobes. More information will come as I find out more about it.

2.x
leak out This appears to be related to the value of the 'forward propogation' state variable rule. If the current dendrite has a 'forward propagation' svrule then the 'leak out' opcode is the value of that 'forward propogation' calculation. 2.x
curr src leak in Not yet known. 2.x
multiply Not yet known. 2.x
average Not yet known. 2.x
move twrds

This opcode takes two arguments and operates on the value of the previous opcode.

It will take the value of the previous opcode and move it towards the first argument by the value of (argument 1 - previous opcode) / (256 / argument 2).

For example:

'Suscept:move twds:255:64' will return a value which is susceptibility moved towards 255 by a quarter of the difference. If Suscept was 128 then the calculation would return 128 + (255 - 128) / (256 / 64) = 160.

This opcode allows you to perform a fairly complicated calculation while only taking up a few of the SVRule opcode places.

2.x
random

This opcode takes two arguments. It returns a random number between the first argument and the second argument.

For example:

'random:0:chem 5:PLUS:state' adds a random number between 0 and the level of chemical 5 to the current state.

2.x
unused To be defined. 1.x
ERROR To be defined. 1.x

A tutorial for Creatures 1 demonstrating how state variable rules work is available from the tutorials page. Additional information about Creatures 2 state variable rules is available on the Creatures 2 brain lobe differences page.