Difference between revisions of "Brain"
(Add link to "creatures 1 brains" at Home Sweet Albia) |
|||
(28 intermediate revisions by 9 users not shown) | |||
Line 2: | Line 2: | ||
==Lobes== | ==Lobes== | ||
− | A | + | 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. As of C1, each lobe also has two types of dendrites, each of which can connect to a single other lobe. These two types of dendrites, each connecting to a single other lobe, allows each lobe of the brain to be connected to two other lobes.[https://zenzoa.com/creatures/c1-brains.html] | |
− | + | ||
− | + | As of C1, the maximum number of neurons a lobe can have is 1024 (such as a 32 x 32 square).[https://zenzoa.com/creatures/c1-brains.html] | |
− | + | ||
− | + | 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 [[:Category:Brain|Brain category]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
== Neurons == | == 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 | + | Neurons live in lobes, and are connected to other neurons via dendrites. |
== Dendrites == | == Dendrites == | ||
− | Dendrites are the | + | '''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 == | == SVRules == | ||
− | Creature brains use a neuronal processing system | + | |
+ | 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. | 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. | ||
Line 39: | Line 37: | ||
The SVRules system adds some extensions to the usual register machine, like access to the [[Creature]]'s chemical system or to its reception. | 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 [[gene]]s to get a full (?) list of supported operations. | + | Take your favourite [[:Category:Genetic Editors|genetic editor]] and take a look into one of the Brain [[Lobe]] or Brain Tract [[gene]]s to get a full (?) list of supported operations. |
A good place to learn more about the brain is [[The Creatures Developer Resource]] | A good place to learn more about the brain is [[The Creatures Developer Resource]] | ||
+ | |||
+ | === A note from the programmer === | ||
+ | <blockquote> | ||
+ | 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. | ||
+ | |||
+ | —[[User:Digitalgod|Digitalgod]] 12:39, 4 Apr 2005 (EDT) | ||
+ | </blockquote> | ||
+ | |||
+ | ==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 [https://web.archive.org/web/20170814231455/http://www.gamewareeurope.com/GWDev/cdn/CDN_more.php?CDN_article_id=9 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): | ||
+ | |||
+ | {| border='1' | ||
+ | ! Number !! Name !! X !! Y !! Width !! Height !! Neurones | ||
+ | |- | ||
+ | | 0 || [[Perception lobe|Perception]] || 4 || 13 || 7 || 16 || 112 | ||
+ | |- | ||
+ | | 1 || [[Drive lobe|Drive]] || 34 || 30 || 8 || 2 || 16 | ||
+ | |- | ||
+ | | 2 || [[Source lobe|Source]] || 15 || 24 || 8 || 5 || 40 | ||
+ | |- | ||
+ | | 3 || [[Verb lobe|Verb]] || 37 || 24 || 8 || 2 || 16 | ||
+ | |- | ||
+ | | 4 || [[Noun lobe|Noun]] || 21 || 3 || 20 || 2 || 40 | ||
+ | |- | ||
+ | | 5 || [[General sense lobe|General Sense]] || 32 || 34 || 8 || 4 || 32 | ||
+ | |- | ||
+ | | 6 || [[Decision lobe|Decision]] || 53 || 15 || 1 || 16 || 16 | ||
+ | |- | ||
+ | | 7 || [[Attention lobe|Attention]] || 44 || 30 || 5 || 8 || 40 | ||
+ | |- | ||
+ | | 8 || [[Concept lobe|Concept]] || 12 || 6 || 40 || 16 || 640 | ||
+ | |} | ||
+ | |||
+ | === C1/C2 SVRules === | ||
+ | {| border="1" | ||
+ | ! C1 opcode || C2 opcode !! name !! description | ||
+ | |- | ||
+ | | 0 || 0 || <end> || Marks the end of an SVRule. Any opcodes appearing after this marker are ignored. | ||
+ | |- | ||
+ | | 1 || 1 || 0 || The integer number zero. | ||
+ | |- | ||
+ | | 2 || 2 || 1 || The integer number one. | ||
+ | |- | ||
+ | | 3 || 3 || 64 || The integer number sixty-four. | ||
+ | |- | ||
+ | | 4 || 4 || 255 || The integer number two hundred fifty-five. | ||
+ | |- | ||
+ | | 5 || 5 || chem 0 || Current amount of chemical 0 in the brain lobe. This chemical can be changed with a [[Biochemistry#Receptors|biochemical receptor]]. | ||
+ | |- | ||
+ | | 6 || 6 || chem 1 || See above. | ||
+ | |- | ||
+ | | 7 || 7 || chem 2 || See above. | ||
+ | |- | ||
+ | | 8 || 8 || chem 3 || See above. | ||
+ | |- | ||
+ | | 9 || 9 || state || Current value of the state of the cell. | ||
+ | |- | ||
+ | | 10 || 10 || output || Current output value of the cell. | ||
+ | |- | ||
+ | | 11 || 11 || thres || Current threshold of the cell. | ||
+ | |- | ||
+ | | 12 || 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 || 13 || type 1 || See above. | ||
+ | |- | ||
+ | | 14 || 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 || 15 || anded 1 || See above. | ||
+ | |- | ||
+ | | 16 || 16 || input || Current dendrite input signal. | ||
+ | |- | ||
+ | | 17 || 17 || conduct || Not hooked up in Creatures 1. Unknown in Creatures 2. | ||
+ | |- | ||
+ | | 18 || 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 || 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> | ||
+ | |- | ||
+ | | 20 || 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 || 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 || 32 || The integer number thirty-two. | ||
+ | |- | ||
+ | | || 23 || 128 || The integer number one hundred twenty-eight. | ||
+ | |- | ||
+ | | || 24 || rnd const || | ||
+ | |- | ||
+ | | || 25 || chem 4 || Current amount of chemical 0 in the brain lobe. This chemical can be changed with a [[Biochemistry#Receptors|biochemical receptor]]. | ||
+ | |- | ||
+ | | || 26 || chem 5 || See above. | ||
+ | |- | ||
+ | | || 27 || leak in || This appears to be related to the value of the 'back propagation' 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 propagation' svrule from the destination dendrite. This can be used to feed data back to a source lobe from destination lobes. | ||
+ | |- | ||
+ | | || 28 || leak out || This appears to be related to the value of the 'forward propagation' state variable rule. If the current dendrite has a 'forward propagation' svrule then the 'leak out' opcode is the value of that 'forward propagation' calculation. | ||
+ | |- | ||
+ | | || 29 || curr src leak in || The neuron's current dendrite's source neuron leak in charge. | ||
+ | |- | ||
+ | | 22 || 30 || 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 || 31 || PLUS || Adds the value of the following opcode to the value of the previous opcode. | ||
+ | |- | ||
+ | | 24 || 32 || MINUS || Subtracts the value of the following opcode from the value of the previous opcode. For example <code>state:MINUS:1</codE> will subtract '1' from the current value of 'state'. | ||
+ | |- | ||
+ | | 25 || 33 || 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: <code>64:TIMES:thres</code> where 'thres' is 32 will be <code>32*64/256=8</code>. | ||
+ | |- | ||
+ | | 26 || 34 || INCR || Returns the value of the previous opcode incremented by one. | ||
+ | |- | ||
+ | | 27 || 35 || DECR || Returns the value of the previous opcode decremented by one. | ||
+ | |- | ||
+ | | || 36 || 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. | ||
+ | |- | ||
+ | | || 37 || multiply || Multiplies the value of the following opcode with the value of the previous opcode. | ||
+ | |- | ||
+ | | || 38 || average || Averages the value of the following opcode with the value of the previous opcode. | ||
+ | |- | ||
+ | | || 39 || move twrds || | ||
+ | |- | ||
+ | | || 40 || random || This opcode takes two arguments. It returns a random number between the first argument and the second argument. It also sets rnd const. | ||
+ | |} | ||
+ | |||
+ | === C3/DS SVRules === | ||
+ | |||
+ | ==== Opcodes ==== | ||
+ | |||
+ | {| border="1" | ||
+ | |- | ||
+ | | 0: stop || Stops processing of the current rule. | ||
+ | |- | ||
+ | | 1: blank || Set the specified destination to zero. | ||
+ | |- | ||
+ | | 2: store in || Copy the contents of the accumulator to the specified destination. When storing to a neuron value, The Brain-in-a-vat seems clamped to [-1.0, 1.0]. To check. | ||
+ | |- | ||
+ | | 3: load from || Copy the contents of the specified distination to the accumulator. | ||
+ | |- | ||
+ | | 4-15: if commands || Only execute the following opcode if the specified condition for the accumulator is true. | ||
+ | |- | ||
+ | | 16-21: basic arithmetic || Perform the specified arithmetic operation on the accumulator. | ||
+ | |- | ||
+ | | 22-23: minimum/maximum with || Sets the accumulator to the minimum/maximum value of the current accumulator value and the specified value. | ||
+ | |- | ||
+ | | 24: set tend rate || Set the rate (as a fraction of the difference) at which to 'tend' towards things using the 'tend to' opcode. Zero by default. Negative values seem to have the same effect as positive ones. | ||
+ | |- | ||
+ | | 25: tend to || Modify the accumulator so it moves further towards the operand, using the fraction specified in 'set tend rate' to decide how much of the difference to add/remove from the accumulator. | ||
+ | |- | ||
+ | | 26-27: load negation/abs of || Set the accumulator to the negation or absolute value of the operand. For instance, loading the negation of 0.5 will result in -0.5 and vice versa. However, loading the absolute value of either 0.5 or -0.5 will result in 0.5. | ||
+ | |- | ||
+ | | 28: get distance to || Set the accumulator to the absolute value of the difference between the accumulator and the operand. | ||
+ | |- | ||
+ | | 29: flip around || Subtracts the accumulator from the operand, and stores the result in the accumulator (ie, same as 'subtract from'). | ||
+ | |- | ||
+ | | 30: no operation || Do nothing. | ||
+ | |- | ||
+ | | 31: register as spare || Register this neuron(?) as spare. Used by: decision lobe, attention lobe | ||
+ | |- | ||
+ | | 32-33: bound in range || Bind the operand between (inclusively) either [0,1] or [-1,1], and store the result in the accumulator. For instance, binding 1.4 to [0,1] would result in 1.0 being stored, but binding -0.2 to [-1,1] would result in -0.2 being stored. | ||
+ | |- | ||
+ | | 34-35: add/tend to and store in || Like either the 'add' or 'tend to' opcodes, but store the result in the operand instead of the accumulator. | ||
+ | |- | ||
+ | | 36: Nominal Threshold || If the accumulator is less than the value of the operand, set the accumulator to zero. Otherwise, do nothing. | ||
+ | |- | ||
+ | | 37: Leakage Rate || Set the leakage rate (used by rest state) to the value of the operand. | ||
+ | |- | ||
+ | | 38: Rest State || ?? | ||
+ | |- | ||
+ | | 39: Input Gain Hi Lo || ?? | ||
+ | |- | ||
+ | | 40: Persistence || drives neuron State towards neuron Input value: S(1) = S(0) + ( (1-Persistence) * (I(0) - S(0)) ) | ||
+ | |- | ||
+ | | 41: Signal Noise || ?? | ||
+ | |- | ||
+ | | 42: Winner Takes All || ?? | ||
+ | |- | ||
+ | | 43: ShortTerm Relax Rate || Set the short-term relaxation rate. Used by: drive to combination tract | ||
+ | |- | ||
+ | | 44: LongTerm Relax Rate || Set the long-term relaxation rate, and does the relaxation calculation. Off the top of fuzzie's head, it goes like this (hardcoded vars): <code>weight = weight + (Var 1 - weight) * STR; Var 1 = Var 1 + (weight - Var 1) * LTR</code> ie, it's intended to pull the weight downwards towards Var 1 (stable state) at a speed according to STR, and Var 1 upwards towards the weight at a speed according to LTR. | ||
+ | |- | ||
+ | | 45: store abs in || ?? | ||
+ | |- | ||
+ | | 46-47: stop if zero/nonzero || ?? | ||
+ | |- | ||
+ | | 48-49: if zero/nonzero goto || ?? | ||
+ | |- | ||
+ | | 50-51: divide/multiply by, add to neuron input || This seems to, indeed, divide or multiply by the operand, and add to the neuron Input variable (var 1). | ||
+ | |- | ||
+ | | 52: goto line || ?? | ||
+ | |- | ||
+ | | 53-56: stop if condition || ?? | ||
+ | |- | ||
+ | | 57: Reward Threshold || ?? | ||
+ | |- | ||
+ | | 58: Reward Rate || ?? | ||
+ | |- | ||
+ | | 59: Use Reward With || ?? | ||
+ | |- | ||
+ | | 60: Punish Threshold || ?? | ||
+ | |- | ||
+ | | 61: Punish Rate || ?? | ||
+ | |- | ||
+ | | 62: Use Punish With || ?? | ||
+ | |- | ||
+ | | 63: Preserve Neuron SV || Very weird. If I remember correctly, it basically stores the value of the neuron variable given by the *value* of the operand, in the neuron Var 4. ie, if you pass it a value '3.0' it will take Var 3 and store that in Var 4. | ||
+ | |- | ||
+ | | 64: Restore Neuron SV || I think this does the opposite of 63. | ||
+ | |- | ||
+ | | 65: Preserve Spare Neuron || Like 63 (preserve neuron SV), only with the spare neuron. | ||
+ | |- | ||
+ | | 66: Restore Spare Neuron || I think this does the opposite of 65.. | ||
+ | |- | ||
+ | | 67-68: if negative/position goto || ?? | ||
+ | |} | ||
+ | |||
+ | ==== Operand Types ==== | ||
+ | |||
+ | {| border="1" | ||
+ | |- | ||
+ | | 0: accumulator || The accumulator. Useful for instructions which only operate on an operand, such as the "bound in" opcodes. | ||
+ | |- | ||
+ | | 1: input neuron || The source neuron for the dendrite which this svrule is running on? | ||
+ | |- | ||
+ | | 2: dendrite || The dendrite which this svrule is running on? | ||
+ | |- | ||
+ | | 3: neuron || The neuron which this svrule is running on? (or the destination neuron, for dendrites) | ||
+ | |- | ||
+ | | 4: spare neuron || ?? | ||
+ | |- | ||
+ | | 5: random || A random number between 0.0 and 1.0. | ||
+ | |- | ||
+ | | 6: source chemical || ?? | ||
+ | |- | ||
+ | | 7: chemical || A chemical level (with chemical# specified)? | ||
+ | |- | ||
+ | | 8: destination chemical || ?? | ||
+ | |- | ||
+ | | 9: zero || The literal value 0.0. | ||
+ | |- | ||
+ | | 10: one || The literal value 1.0. | ||
+ | |- | ||
+ | | 11: value || A literal value from 0.0 to 1.0. | ||
+ | |- | ||
+ | | 12: negative value || A literal value from 0.0 to -1.0. | ||
+ | |- | ||
+ | | 13: value x 10 || A literal value from 0.0 to 10.0. | ||
+ | |- | ||
+ | | 14: value / 10 || A literal value from 0.0 to 0.1. | ||
+ | |- | ||
+ | | 15: value integer || A literal value from 0 to 248. | ||
+ | |} | ||
+ | |||
+ | ==External links== | ||
+ | *[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.81.1278&rep=rep1&type=pdf Creatures: Artificial Life Autonomous Software Agents for Home Entertainment] by [[Steve Grand]] et al. | ||
+ | * [http://web.archive.org/web/20071208173623/fp.cyberlifersrch.plus.com/creaturesarchive/braindesc.htm I Am Ron's Brain] | ||
+ | *[https://www.alanzucconi.com/2020/07/27/the-ai-of-creatures/ The AI of Creatures] by [[Alan Zucconi]] | ||
+ | *[https://docs.google.com/spreadsheets/d/1vgoUpvlNYTv3pwZfzp6z9FUx6mB0dnDh0jcPB1h_Yp4/edit#gid=0 Creatures 1 Brain spreadsheet] by [[Alan Zucconi]] | ||
+ | *[https://ratshack.neocities.org/js/c1brainviewer/html/index.html An online brain viewer tool for C1 export files] | ||
+ | *[http://double.nz/creatures/genetics/svrules.htm State Variable Rules] at [[The Creatures Developer Resource]] | ||
+ | *[https://sites.google.com/site/ruratboy/creatures3svrules Creatures 3 SV Rules] at [[Ratboy's Creatures3 Stuff]] | ||
+ | *[https://web.archive.org/web/20090107005318/http://wiki.ccdevnet.org/index.php/C2e_Brains#SVRule_Opcodes C2e Brains] at the [[CCDevNet]] wiki | ||
+ | * [http://zenzoa.com/creatures/c1-brains.html creatures 1 brains] at [[Home Sweet Albia]] | ||
+ | |||
[[Category:Internals]] | [[Category:Internals]] | ||
− | + | [[Category:Brain]] | |
− | |||
− | |||
− | [[ |
Revision as of 00:06, 6 August 2022
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.
Contents
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. As of C1, each lobe also has two types of dendrites, each of which can connect to a single other lobe. These two types of dendrites, each connecting to a single other lobe, allows each lobe of the brain to be connected to two other lobes.[1]
As of C1, the maximum number of neurons a lobe can have is 1024 (such as a 32 x 32 square).[2]
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/C2 SVRules
C1 opcode | C2 opcode | name | description |
---|---|---|---|
0 | 0 | <end> | Marks the end of an SVRule. Any opcodes appearing after this marker are ignored. |
1 | 1 | 0 | The integer number zero. |
2 | 2 | 1 | The integer number one. |
3 | 3 | 64 | The integer number sixty-four. |
4 | 4 | 255 | The integer number two hundred fifty-five. |
5 | 5 | chem 0 | Current amount of chemical 0 in the brain lobe. This chemical can be changed with a biochemical receptor. |
6 | 6 | chem 1 | See above. |
7 | 7 | chem 2 | See above. |
8 | 8 | chem 3 | See above. |
9 | 9 | state | Current value of the state of the cell. |
10 | 10 | output | Current output value of the cell. |
11 | 11 | thres | Current threshold of the cell. |
12 | 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 | 13 | type 1 | See above. |
14 | 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 | 15 | anded 1 | See above. |
16 | 16 | input | Current dendrite input signal. |
17 | 17 | conduct | Not hooked up in Creatures 1. Unknown in Creatures 2. |
18 | 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 | 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 | 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 | 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 | 32 | The integer number thirty-two. | |
23 | 128 | The integer number one hundred twenty-eight. | |
24 | rnd const | ||
25 | chem 4 | Current amount of chemical 0 in the brain lobe. This chemical can be changed with a biochemical receptor. | |
26 | chem 5 | See above. | |
27 | leak in | This appears to be related to the value of the 'back propagation' 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 propagation' svrule from the destination dendrite. This can be used to feed data back to a source lobe from destination lobes. | |
28 | leak out | This appears to be related to the value of the 'forward propagation' state variable rule. If the current dendrite has a 'forward propagation' svrule then the 'leak out' opcode is the value of that 'forward propagation' calculation. | |
29 | curr src leak in | The neuron's current dendrite's source neuron leak in charge. | |
22 | 30 | 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 | 31 | PLUS | Adds the value of the following opcode to the value of the previous opcode. |
24 | 32 | 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 | 33 | 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 | 34 | INCR | Returns the value of the previous opcode incremented by one. |
27 | 35 | DECR | Returns the value of the previous opcode decremented by one. |
36 | 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. | |
37 | multiply | Multiplies the value of the following opcode with the value of the previous opcode. | |
38 | average | Averages the value of the following opcode with the value of the previous opcode. | |
39 | move twrds | ||
40 | random | This opcode takes two arguments. It returns a random number between the first argument and the second argument. It also sets rnd const. |
C3/DS SVRules
Opcodes
0: stop | Stops processing of the current rule. |
1: blank | Set the specified destination to zero. |
2: store in | Copy the contents of the accumulator to the specified destination. When storing to a neuron value, The Brain-in-a-vat seems clamped to [-1.0, 1.0]. To check. |
3: load from | Copy the contents of the specified distination to the accumulator. |
4-15: if commands | Only execute the following opcode if the specified condition for the accumulator is true. |
16-21: basic arithmetic | Perform the specified arithmetic operation on the accumulator. |
22-23: minimum/maximum with | Sets the accumulator to the minimum/maximum value of the current accumulator value and the specified value. |
24: set tend rate | Set the rate (as a fraction of the difference) at which to 'tend' towards things using the 'tend to' opcode. Zero by default. Negative values seem to have the same effect as positive ones. |
25: tend to | Modify the accumulator so it moves further towards the operand, using the fraction specified in 'set tend rate' to decide how much of the difference to add/remove from the accumulator. |
26-27: load negation/abs of | Set the accumulator to the negation or absolute value of the operand. For instance, loading the negation of 0.5 will result in -0.5 and vice versa. However, loading the absolute value of either 0.5 or -0.5 will result in 0.5. |
28: get distance to | Set the accumulator to the absolute value of the difference between the accumulator and the operand. |
29: flip around | Subtracts the accumulator from the operand, and stores the result in the accumulator (ie, same as 'subtract from'). |
30: no operation | Do nothing. |
31: register as spare | Register this neuron(?) as spare. Used by: decision lobe, attention lobe |
32-33: bound in range | Bind the operand between (inclusively) either [0,1] or [-1,1], and store the result in the accumulator. For instance, binding 1.4 to [0,1] would result in 1.0 being stored, but binding -0.2 to [-1,1] would result in -0.2 being stored. |
34-35: add/tend to and store in | Like either the 'add' or 'tend to' opcodes, but store the result in the operand instead of the accumulator. |
36: Nominal Threshold | If the accumulator is less than the value of the operand, set the accumulator to zero. Otherwise, do nothing. |
37: Leakage Rate | Set the leakage rate (used by rest state) to the value of the operand. |
38: Rest State | ?? |
39: Input Gain Hi Lo | ?? |
40: Persistence | drives neuron State towards neuron Input value: S(1) = S(0) + ( (1-Persistence) * (I(0) - S(0)) ) |
41: Signal Noise | ?? |
42: Winner Takes All | ?? |
43: ShortTerm Relax Rate | Set the short-term relaxation rate. Used by: drive to combination tract |
44: LongTerm Relax Rate | Set the long-term relaxation rate, and does the relaxation calculation. Off the top of fuzzie's head, it goes like this (hardcoded vars): weight = weight + (Var 1 - weight) * STR; Var 1 = Var 1 + (weight - Var 1) * LTR ie, it's intended to pull the weight downwards towards Var 1 (stable state) at a speed according to STR, and Var 1 upwards towards the weight at a speed according to LTR.
|
45: store abs in | ?? |
46-47: stop if zero/nonzero | ?? |
48-49: if zero/nonzero goto | ?? |
50-51: divide/multiply by, add to neuron input | This seems to, indeed, divide or multiply by the operand, and add to the neuron Input variable (var 1). |
52: goto line | ?? |
53-56: stop if condition | ?? |
57: Reward Threshold | ?? |
58: Reward Rate | ?? |
59: Use Reward With | ?? |
60: Punish Threshold | ?? |
61: Punish Rate | ?? |
62: Use Punish With | ?? |
63: Preserve Neuron SV | Very weird. If I remember correctly, it basically stores the value of the neuron variable given by the *value* of the operand, in the neuron Var 4. ie, if you pass it a value '3.0' it will take Var 3 and store that in Var 4. |
64: Restore Neuron SV | I think this does the opposite of 63. |
65: Preserve Spare Neuron | Like 63 (preserve neuron SV), only with the spare neuron. |
66: Restore Spare Neuron | I think this does the opposite of 65.. |
67-68: if negative/position goto | ?? |
Operand Types
0: accumulator | The accumulator. Useful for instructions which only operate on an operand, such as the "bound in" opcodes. |
1: input neuron | The source neuron for the dendrite which this svrule is running on? |
2: dendrite | The dendrite which this svrule is running on? |
3: neuron | The neuron which this svrule is running on? (or the destination neuron, for dendrites) |
4: spare neuron | ?? |
5: random | A random number between 0.0 and 1.0. |
6: source chemical | ?? |
7: chemical | A chemical level (with chemical# specified)? |
8: destination chemical | ?? |
9: zero | The literal value 0.0. |
10: one | The literal value 1.0. |
11: value | A literal value from 0.0 to 1.0. |
12: negative value | A literal value from 0.0 to -1.0. |
13: value x 10 | A literal value from 0.0 to 10.0. |
14: value / 10 | A literal value from 0.0 to 0.1. |
15: value integer | A literal value from 0 to 248. |
External links
- Creatures: Artificial Life Autonomous Software Agents for Home Entertainment by Steve Grand et al.
- I Am Ron's Brain
- The AI of Creatures by Alan Zucconi
- Creatures 1 Brain spreadsheet by Alan Zucconi
- An online brain viewer tool for C1 export files
- State Variable Rules at The Creatures Developer Resource
- Creatures 3 SV Rules at Ratboy's Creatures3 Stuff
- C2e Brains at the CCDevNet wiki
- creatures 1 brains at Home Sweet Albia