Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "Brain"

From Creatures Wiki
Jump to navigation Jump to search
(Update C1 SVRules)
Line 87: Line 87:
 
! opcode !! name !! description
 
! opcode !! name !! description
 
|-
 
|-
| 0 || BLANK || Marks the end of an SVRule. Any opcodes appearing after this marker are ignored.
+
| 0 || <end> || Marks the end of an SVRule. Any opcodes appearing after this marker are ignored.
 
|-
 
|-
| 1 || CONST0 || The integer number zero.
+
| 1 || 0 || The integer number zero.
 
|-
 
|-
| 2 || CONST1 || The integer number one.
+
| 2 || 1 || The integer number one.
 
|-
 
|-
| 3 || CONST64 || The integer number sixty-four.
+
| 3 || 64 || The integer number sixty-four.
 
|-
 
|-
| 4 || CONST255 || The integer number two hundred fifty-five.
+
| 4 || 255 || The integer number two hundred fifty-five.
 
|-
 
|-
| 5 || CHEM0 || Current amount of chemical 0 in the brain lobe.
+
| 5 || chem 0 || Current amount of chemical 0 in the brain lobe. This chemical can be changed with a [[Biochemistry#Receptors|biochemical receptor]].
 
|-
 
|-
| 6 || CHEM1 ||  
+
| 6 || chem 1 || See above.
 
|-
 
|-
| 7 || CHEM2 ||
+
| 7 || chem 2 || See above.
 
|-
 
|-
| 8 || CHEM3 ||
+
| 8 || chem 3 || See above.
 
|-
 
|-
| 9 || STATE || Current value of the state of the cell.
+
| 9 || state || Current value of the state of the cell.
 
|-
 
|-
| 10 || OUTPUT || Current output value of the cell.
+
| 10 || output || Current output value of the cell.
 
|-
 
|-
| 11 || THRESHOLD || Current threshold of the cell.
+
| 11 || thres || Current threshold of the cell.
 
|-
 
|-
| 12 || TYPE0 || 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: <code>value = source cell * (stw/255)</code> 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.
+
| 12 || 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: <code>value = source cell * (stw/255)</code> 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.
 
|-
 
|-
| 13 || TYPE1 ||
+
| 13 || type 1 || See above.
 
|-
 
|-
| 14 || ANDTYPE0 || 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.
+
| 14 || 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.
 
|-
 
|-
| 15 || ANDTYPE1 ||
+
| 15 || anded 1 || See above.
 
|-
 
|-
| 16 || INPUT ||
+
| 16 || input ||
 
|-
 
|-
| 17 || CONDUCT ||
+
| 17 || conduct ||
 
|-
 
|-
| 18 || SUSCEPTIBILITY || 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).
+
| 18 || 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).
 
|-
 
|-
 
| 19 || 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: <code>stw = ltw + (susceptibility/255) * reinforcement</code>
 
| 19 || 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: <code>stw = ltw + (susceptibility/255) * reinforcement</code>
Line 129: Line 129:
 
| 20 || 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).
 
| 20 || 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).
 
|-
 
|-
| 21 || 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).
+
| 21 || 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).
 
|-
 
|-
 
| 22 || 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.
 
| 22 || 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.

Revision as of 18:38, 23 September 2021

The brain in Creatures is a very complex thing built of about 10 lobes, maybe 900 neurons and many thousands of dendrites. The brain works with the creature's biochemistry in order to keep itself alive.

Lobes

A lobe is a part of the brain that is dedicated to a certain function. Each lobe has an x, y, width and height coordinate, giving it a unique position in the grid of the brain.

A lobe contains neurons, and, in Creatures 1 and [Creatures 2]], dendrites.

A common mutation of the brain is the Multi-lobed creature, with duplicate and/or new brain lobes. For articles on particular lobes, see the Brain category

Neurons

A neuron is a place where you can store a number value. Most neurons lose the saved value over time, but some do this faster than others.

Neurons live in lobes, and are connected to other neurons via dendrites.

Dendrites

Dendrites are the connections between different neurons. Dendrites work unidirectionally (one-way), so the value of neuron 1 may influence the value of neuron 2, but not vice versa. Dendrites may have different behaviours and some just transfer the value of one neuron to another one, while others may negate the value or do even more complex work. See also concept lobe.

In Creatures 1 and Creatures 2, dendrites live in lobes. After that, they live in tracts.

SVRules

Creature brains use a neuronal processing system called State Value Rules, commonly shortened to SVRules.

These were fairly simple in Creatures 1 and Creatures 2, essentially designed to let you perform simple manipulations upon Creature variables (ie, biochemistry and brain values), with the possibility of adding conditions based upon these variables.

In Creatures Evolution Engine games such as Creatures 3, each neuron and dendrite is a fully functional register machine. That means that you have several registers (places where you can store something) and one special working register. The most important commands on a register machine are LOAD, which loads a value into the working register and STORE, which stores a value from it into one of the other registers.

Operations like ADD always use the value of the working register. Look at the following example, which adds the value from register 1 to the one of register 0 and stores the new value in register 2:

  • LOAD 0
  • ADD 1
  • STORE 2

The SVRules system adds some extensions to the usual register machine, like access to the Creature's chemical system or to its reception.

Take your favourite genetic editor and take a look into one of the Brain Lobe or Brain Tract genes to get a full (?) list of supported operations.

A good place to learn more about the brain is The Creatures Developer Resource

A note from the programmer

This SVRule system was designed to deal with an interesting problem: How could I specify arbitrary behaviours for my neurons in a way that evolution could freely change, without it generating endless syntax errors in the process? For instance, imagine that a mutation were to occur in a line of conventional C++ code, such as "for (i=0; i<num; i++)". Almost every possible mutation would render the code unreadable (e.g. "fxr (i-0; ibnum; i4+)") and the chances of a useful (or even viable) mutation would be extremely low. At worst the whole simulation would crash.

To solve this problem I designed the SVRule system in such a way that EVERY statement you can write in it is legal and meaningful, even if it is not biologically useful. If a token was originally the operand for a command, for example, and the command later mutated to one that didn't require operands, the token would now be interpreted instead as a new command or a variable. The details of this aren't very important, but I guess it's an interesting example of the ways in which biology differs from computer programming. Biology tends to have this sort of robustness built into the design.

Digitalgod 12:39, 4 Apr 2005 (EDT)

Brain Organ

In the games after C2, one way in which creatures can die is by the lifeforce of the brain organ - which contains only the brain lobes - becoming too low. This happens when the organ receives sufficient damage which, due to the lack of other biochemistry inside the organ, only happens when a creature has insufficient ATP. The gene which governs this organ has a similar structure to other organ genes.

Tracts

Tracts were introduced in the Creatures Evolution Engine as a new object for managing dendrites. Each tract defines a set of dendrites connecting between two lobes. This allowed brains to be more complex compared to Creatures 1 and Creatures 2, in which each lobe could only have up to two types of dendrites connecting to it.

Implementation details

C1 lobes

The lobes in a Creatures 1 norn are as follows (this also applies to most of the other Cyberlife/Creature Labs-provided creatures):

Number Name X Y Width Height Neurones
0 Perception 4 13 7 16 112
1 Drive 34 30 8 2 16
2 Source 15 24 8 5 40
3 Verb 37 24 8 2 16
4 Noun 21 3 20 2 40
5 General Sense 32 34 8 4 32
6 Decision 53 15 1 16 16
7 Attention 44 30 5 8 40
8 Concept 12 6 40 16 640

C1 SVRules

opcode name description
0 <end> Marks the end of an SVRule. Any opcodes appearing after this marker are ignored.
1 0 The integer number zero.
2 1 The integer number one.
3 64 The integer number sixty-four.
4 255 The integer number two hundred fifty-five.
5 chem 0 Current amount of chemical 0 in the brain lobe. This chemical can be changed with a biochemical receptor.
6 chem 1 See above.
7 chem 2 See above.
8 chem 3 See above.
9 state Current value of the state of the cell.
10 output Current output value of the cell.
11 thres Current threshold of the cell.
12 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.
13 type 1 See above.
14 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.
15 anded 1 See above.
16 input
17 conduct
18 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).
19 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
20 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).
21 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).
22 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.
23 PLUS Adds the value of the following opcode to the value of the previous opcode.
24 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'.
25 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.
26 INCR Returns the value of the previous opcode incremented by one.
27 DECR Returns the value of the previous opcode decremented by one.

C3/DS SVRules

List of State Variable Rules (Genetics Kit)
stop
blank
store in
load from
if =
if <>
if >
if <
if >=
if <=
if zero
if non-zero
if positive
if negative
if non-negative
if non-positive
add
subtract
subtract from
multiply by
divide by
divide into
minimum with
maximum with
set tend rate
tend to
load negation of
load abs of
get distance to
flip around
no operation
register as spare
bound in [0,1]
bound in [-1,1]
add and store in
tend to, store in
Nominal Threshold
Leakage State
Rest State
Input Gain Hi Lo
Persistence
Signal Noise
Winner Takes All
ShortTerm Relax Rate
LongTerm Relax Rate
store abs in
stop if zero
stop if nonzero
if zero goto
if nonzero goto
div by, add to neuron input
mult by, add to neuron input
goto line
stop if <
stop if >
stop if <=
stop if >=
Reward Threshold
Reward Rate
Use Reward With
Punish Threshold
Punish Rate
Use Punish With
Preserve Neuron SV
Restore Neuron SV
Preserve Spare Neuron Var
Restore Spare Neuron Var
if negative goto
if positive goto


External links