Professional Documents
Culture Documents
Gridworld Manual v1.03
Gridworld Manual v1.03
03
This is a draft version of the Gridworld manual. More chapters and informa-
tion will be added over time.
For now, the manual will provide a brief overview and explanation of crea-
tures, the neural network and the different neuron types.
Creatures
Creatures are the inhabitants of Gridworld. They
are an artificial and abstract version of liv-
ing organisms. Creatures in gridworld share many
qualities with real living creatures.
For example, they have a simulated metabolism,
which means they need to eat food to stay alive.
They can die from old age or hunger and can
create offspring to reproduce. In order to meet
those needs, creatures have to interact with
their environment.
They have been given plenty of tools to do this. Creatures have many sens-
es avaible for them to observe their environment. They can also perform
actions such eating, moving, turning, attacking, replicating etc.
Creatures are build from two major components; a membrane (body), and a
neural network (brain)
Membrane
The body structure of a creature in Gridworld is somewhat comparable with
single celled organisms. Single celled organisms have a cell membrane which is
kind of like a skin layer that separates the cell from the outside and keeps
nutrients and important parts inside.
Cell membranes in Gridworld have a similar function. They store the crea-
ture's gathered nutrients and hold the important parts in place. You can
recognize a membrane as a colored square that fits exactly on one tile of
the grid. The membrane of the creature in the pitcture above is the big
purple sqaure.
If you look up close at a membrane in Gridworld, you can see smaller cells
inside which are the important parts that are being hold in the membrane.
In Gridworld, these important parts are neurons and together they form a
neural network. The neural network and the membrane together make up a
creature.
Neural network
An artificial neural network is an abstract representation of a biological
neural network. In other words, a neural network is an artificial brain.
The neural network is responsible for the behavior of the creature.
Without it, the creature would just be an empty shell. Creatures in Gridworld
have a brain capacity of 9 x 9 x 9 neurons.
It is small compared to even the tiniest of organisms, but it's enough for
them to live successfully on the simple plane of Gridworld.
So how does a brain function? Well, the main function of brain is to think/
decide/ compute or however you want to call it. Neurons in a neural network
are individual cells that communicate with each other to make decissions. Each
doing a small part in order to produce a more complex behavior.
In order for it to do that, it needs information or input.
This input is basically information from its environment such as vibrations,
smells and light.
Let's take a real bug for example. The bug observes signals from its envi-
ronment such as light, vibrations and smells. The bug's eyes have photosen-
sitive cells which send signals to the brain when they are triggered by light.
Those information inputs are then processed by the brain which leads to a
certain action or behavior. Some input signals might attract the bug such as
sweetness or light, while others may scare it away. What those actions are
is determined by the brain.
This is true for all neural networks, both artificial and biological. You have to
put something in in order to get something out. The brain needs information
to work with.
Let's take a closer look at simple example of the principle of a neural net-
work in Gridworld.
0.8
1.
0.5
1
.5
-0
0.75
&: 1.0
1.0 -0.4
&: 0.5 &: 1.25
5
~: 0 ~: 0.5
1.
1.2 1.1
-1.0
&: 1.0
The picture above displays a simple neural network with 7 neurons. The input
neurons are displayed on the left. These neurons can sense the environ-
ment. The output neurons are displayed on the right and can perform tasks.
In this example, the neural network is displayed as a network that goes from
left to right. In Gridworld, neurons can also connect back, This has not been
displayed in order to keep the example simple. A neural network may also
have more or less layers than 3.
The arrows display the connection the neuron has to other neurons. The
numbers next to the arrows are called weights. The weight of a connection
determines how strong the signal is. Weights can also have negative numbers.
There are two numbers marked inside a neuron.
&: threshold
~: bias
The principle of the neural network is simple. If the sum of all the signals a
neuron receives is greater than the threshold of the neuron, the neuron is
triggered and will send a signal in turn to the neurons it is connected to.
The bias value is an additional value that a neuron will always receive.
The top left neuron receives a signal with weight 1. The threshold is 0.75.
1 > 0.75, Therefore, this neuron will send a signal to the neurons it is con-
nected to.
The second neuron on the left receives a weight of 0.75, but its threshold
is 1.0. The neuron won't send any signals to other neurons because 0.75 <
1.0.
The bottom neuron on the left is also triggered, since its input weight is
greater than its threshold.
Looking at the green neuron in the middle, we see that it has a threshold
of 1.5.
It receives an input value of 1.25 from the top left neuron and an input
value of 1.5 from the bottom left neuron. remember, the middle left neuron
is not sending any signals at the moment. The green neuron also receives a
bias value of -0.25.
The total input weight this neuron receives is: 1.25 + 1.5 - 0.25 = 2.5
2.5 > 1.5, therefore the green neuron is triggered and will send a signal to
the purple neuron with a weight of 0.5.
The purple neuron on the right has a threshold of 0.8 and a bias of -0. It
receives a total input of -0.1 + 0.5 = 0.4.
0.4 < 0.8, therefore this neuron is not triggered and will not send a signal
to other neurons.
The yellow neuron in the bottom right has threshold of 1.25 and a bias of
0.5. It receives input from the orange neuron and the cyan neuron in the
bottom left. the total input weight the yellow neuron receives is:
1.0 - 1.0 + 0.5 = 0.5.
0.5 < 1.25, therefore it will not send a signal further up the neural network.
Neuron Properties
The general principle of a neuron has been displayed in the previous chap-
ter. Let's take a closer look at the neurons from Gridworld.
Dynamic variables are determined by the DNA. Every neuron has the same
amount of dynamic variables, These dynamic variables can have different val-
ues depending on the DNA or other factors.
Type variables are dependent on the type of the neuron. They are un-
changeable. An example would be the range that an input neuron of a cer-
tain type can observe. Some type variables are type specific while others
are global.
Dynamic variables
The dynamic variables of one neuron are described by the DNA as strings
of caracters.
gene_type[1][6][0] = i
gene_properties[1][6][0] = #w@F%h^v+M|C~7&Z)76B[?Wrw[?MTK[?E13[!Z0X
gene_tag[1][6][0] = !Tq
These three sentences represent all the dynamic variables this particular
neuron has when it is created.
Locations
The notation [1][6][0] is the xyz location of the neuron which is being de-
scribed. A neural network has a maximum size of 9 x 9 x 9 neurons,
Therefore the numbers between the brackets range from 0 to 8,
Gene_type
Gene_tag
The gene_tag variable is kind of like an id or name tag of the cell. It is used
to form connections with other neurons. An output tag can create a con-
nection with a neuron that has a similar gene_tag.
!Tq
!: switch, can be either ! or ?.
! = on, ? = off.
Tq: is that tag. Tags are used to identify neurons when connections
are made.
Gene_Properties
Annotations
The dna string contains a combination of letters, numbers and special char-
acters. The special characters are annotations that describe what the
variable that comes after it is used for.
&: threshold
The threshold is the amount of input weight this neuron has to
receive in order to be triggered
#: property 1
@: property 2
%: property 3
^: property 4
+: property 5
|: property 6
Gene properties 1 to 6 describe the properties this neuron has.
Gene properties have a different function for each neuron type
): property neuron range
Describes the range in which this neuron can connect to neigh
bouring neurons. Ranges from 0-8 for xyz.
[: outputtag
An output tag describes a connection to another neuron. Neurons
can have multiple output tags. An output tag look as follows:
[?MTK
[: annotation for an output tag.
?: Switch, Can be either ? or !
MT: The connection will connect to neurons that have
this tag.
K: Weight of this connection. Ranges from -2.5 to 2.5 by
default.
If an output tag matches that tag of another neuron, a
connection can be made.
~: bias
The bias is an extra input value this neuron will receive.
Variables
Variables are described in the DNA as letters and numbers. They follow an
annotation character that describes what they are used for.
A value resides within the following range:
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d,
e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, y, z, 0. 1. 2. 3, 4, 5, 6, 7, 8
Switches
Switches are connected to tags and output tags. They are displayed as ei-
ther ! or ? and describes if that particular tag is on or off.
! = on, while ? = off.
A tag that is off is not used if the simulation settings 'use output switch'
or 'use tag switch' are turned on respectively.
The previous picture shows the variables as they are represented by the
DNA. When a neuron is created inside a creature, the representative vari-
ables are converted to values. These values are used by the neurons to
function. The representative variables are converted to values as follows:
&: threshold = Z
&_int = 25
&_float = 25/60 = 0.42
The default values of minimum and maximum are 0 and 2.5 respectively.
These values can be changed during the simulation.
#: property 1 = w
#_int = 48
#_float = 48/60 = 0.80
@: property 2 = F
@_int = 5
@_float = 5/60 = 0.08
%: property 3 = h
%_int = 33
%_float = 33/60 = 0.55
^: property 4 = v
^_int = 47
^_float = 47/60 = 0.78
+: property 5 = M
+_int = 12
+_float = 12/60 = 0.20
|: property 6 = C
|_int = 2
|_float = 2/60 = 0.03
The default values of minimum and maximum are 0 and 2.5 respectively.
These values can be changed during the simulation.
[: outputtag
The ouput tag consist out of 3 parts. the label, switch and weight.
?MTK
? = switch
MT = label
K = weight
The label is not converted to an integer or a floating number since
it is used as an identifaction variable. The switch is simply converted
to either true or false.
! = true, ? = false.
The weight is converted to a floating number..
weight_value = K
weight_int = 10/60
weight_float = 0.17
The default values of minimum and maximum are -2,5 and 2.5 respectively.
These values can be changed during the simulation.
Doing the same calculations for the other output tags we get:
Type variables are variables that can not be changed by the DNA but can
be different for each neuron type.
Some general type variables that can be found in all neurons are:
Mass
The mass of a neuron. a higher mass means the creature becomes heavyer.
Color
Every neuron type has a different color. The color of each neuron type
can be changed in the neuron settings window
Target tile
Neurons can have a target tile which is a tile in the near environment of
the creature. If the neuron has a target tile it can interact with this tile
in some way. The position of the target tile depends on the range of the
neuron type, the rotation of the creature, the position of the creature
and the x,y position of the neuron in the neural network.
The interaction with the target tile can consist of either observing a prop-
erty of the tile or an object on the tile, or performing some action with or
on the target tile or an object on the target tile.
Interaction through observation is most often the case for input neurons.
An example would be the eye neuron which can sense a color from a target
tile.
Range
The range of neuron type influences the location of the target tile.
A neuron can have a range of 0, 1 or 4. A range of 0 means the neuron
has no target tile or the target tile is at the exact location of the crea-
ture.
A range of 1 means the target tile can be no further away than one tile.
A range of 4 means the neuron has a target tile which can be 4 tiles
away in either of 4 directions. The location of the target tile is determined
through a projection of the location of the neuron on the environment. For
example, if the input neuron would be located in the neural network at loca-
tion 8,8 (top right corner) , the neuron's target tile would be 4 tiles to the
right and 4 tiles to the top relative to the creature.
target tile with range of 1
- input neurons
- middle neurons
- output neurons
Input neurons
input neurons are used by the creature to sense its environment. These
neurons provide the creature with its senses such as seeing, hearing or
touching. Input neurons can not receive signals from other neurons but can
send signals to other middle neurons and output neurons.
The different input neurons are:
Name: Antenna
Type: AN
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The antenna neuron is used for sensing other objects by touch. The range
of the antenna is one tile which means the antenna can sense an object
next to the creature. The side the antenna can sense depends on the po-
sition of the antenna and the rotation of the creature. If an object is lo-
cated on the target tile, the antenna is triggered.
Name: Eye
Type: EY
Range: 4
#: determines which color the eye neuron is sensitive to.
# <= (1/3): sensitive to red
# >= (1/3) && # <= (2/3): sensitive to green
# >= (2/3): sensitive to blue
@: Brightness threshold, value is between 0.0-1.0.
@ = 0: black
@ = 1: full color
%: not used
^: not used
+: not used
|: not used
The eye is triggered by observing a color of the target tile that is above
certain brightness.
Name: Feed sensor
Type: FE
Range: 0
#: if # > 0.5: the feed sensor is triggered when energy is
gained.
# < 0.5: the feed sensor is triggered when energy is
lost.
@: not used
%: not used
^: not used
+: not used
|: not used
The Feed-sensor is triggered when the creature gains energy or loses en-
ergy from any source.
Name: Sonar
Type: SN
Range: 4
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The sonar is used for sensing objects on the grid.
Name: Sound sensor
Type: SO
Range: 4
#: minimum of interval
@: maximum of interval
%: not used
^: not used
+: not used
|: not used
The sound-sensor is triggered when it senses a sound that has a volume
within a certain range on a tile. Sounds are made when creatures move and
can be created by the speaker neuron.
Name: Ticker
Type: TI
Range: 0
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The ticker neuron provides a steady stream of input signals to the neural
network. In other words, it is always triggered.
middle neurons
Middle neurons form a connection between other neurons. They receive their
input from other neurons and can send signal to other neurons.
The different middle neurons are:
Name: Activater
Type: AC
Range: 0
#: determines if connected neurons are activated or de
activated
# <= (1/3): activates target neurons
# >= (1/3) && # <= (2/3): deactivated target neurons
# >= (2/3): inverts activation status
@: not used
%: not used
^: not used
+: not used
|: not used
The activater neuron does not send signals to the neurons it is connected
to, but instead activates or deactivates them. Deactivated neurons will not
function until activated again.
Name: Cell poker
Type: CE
Range: 0
#: x location of target neigbouring neuron
# <= (1/4): relative target x: -1
# >= (1/4) && # <= (3/4): relative target x: 0
# >= (3/4): relative target x: +1
@: y location of target neigbouring neuron
@ <= (1/4): relative target y: -1
@ >= (1/4) && # <= (3/4): relative target y: 0
@ >= (3/4): relative target y: +1
%: x location of target neigbouring neuron
% <= (1/4): relative target z: -1
% >= (1/4) && # <= (3/4): relative target z: 0
% >= (3/4): relative target z: +1
^: weight
+: not used
|: not used
The Cell-poker does not form normal connections but instead send signals to
a neighbouring neuron. The neighbouring neuron is picked according to the x
y z locations from properties #, @, %.
Name: Counter
Type: CO
Range: 0
#: #_int: counter limit
@: not used
%: not used
^: not used
+: not used
|: not used
The counter neuron has an internal ticker which counts every time it is
succesfully triggered. Once the maximum counter amount has been exceeded,
the counter is reset and the counter neuron sends signals to its connect-
ed neurons
Name: Neuron
Type: NE
Range: 0
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The regular neuron does not have any special properties, but simply re-
ceives signals from other neurons and sends signals to other neurons when
triggered.
Name: Nerf
Type: NF
Range: 1
#: output weight
@: not used
%: not used
^: not used
+: not used
|: not used
The nerf neuron forms a connection with the nerf-end neuron that resides
in another creature. If a connected nerf end does not exist, the nerf will
attempt to create a nerf-end in any creature that resides on the target
tile.
If the distance between the nerf and the nerf-end becomes greater than 2
tiles, the connection is broken. The connection between a nerf and nerf-end
can be restored.
Name: Random Neuron
Type: RN
Range: 0
#: weight of output connection
@: not used
%: not used
^: not used
+: not used
|: not used
Does not form connections to other neurons. When it is triggered, it will find
one randomly picked neuron in the neural network and send a signal to that
neuron.
Name: Randomizer
Type: RZ
Range: 0
#: chance of triggering
@: not used
%: not used
^: not used
+: not used
|: not used
Almost similar to a regular neuron, except the ability to send signals to oth-
er neurons when triggered is randomized.
Output neurons can receive signals from neurons and can also send signals
to other neurons. Output neurons also perform a special task when they
are triggered which allows the creature to interact with the world.
The different output neurons are:
Name: Blinker
Type: BL
Range: 0
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
When triggered, the blinker neuron will produce a blink on the location of the
creature. Blinks are short pulses of light and can be sensed by blink sen-
sors.
Name: Disconnector
Type: DI
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
A disconnector disconnects the owner with a creature that resides on the
target tile when it is activated.
Creatures that are connected can move like a chain. Creatures can only be
connected via a connector neurons.
Name: DNA copier
Type: DN
Range: 1
#: copy and/or build dna
# <= (1/4): only copy
# >= (1/4) && # <= (3/4): copy and build
# >= (3/4): only build
@: used for target location
%: used for target location
^: not used
+: not used
|: not used
Simulation settings:
Copy mode: dna copier can copy sideways to a target tile.
Copy mode: method of calculation how dna is copied
0: DNA is only copied if there is no neuron in the tar
get membrane between the spot the DNA will be copied
too and the creature.
1:
the DNA copier picks a random spot in the outer shell
of the target facing the creature. If the spot is emp
ty, the DNA is copied.
The DNA copier can copy DNA that is close to itself to another membrane.
If it succeeds in copying DNA, it will also create a DNA executer in the other
membrane.
Name: Feeder
Type: FD
Range: 1
#: amount of food dropped (maximum of 40)
@: not used
%: not used
^: not used
+: not used
|: not used
Drops food on the target tile when triggered
Name: Fin
Type: FI
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The Fin neuron uses its target tile to create momentum for the creature.
The direction of the momentum is opposite to the direction of the target
tile. If the targe tile is on the left, the direction of the momentum will be on
the right. Fin neurons only work on water.
Name: Grabber
Type: GR
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The grabber steals momentum from any object that resides on the target
tile when triggered. It will also give part of the owners momentum to the ob-
ject on the target tile.
Name: Jet
Type: JE
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
The jet uses its target tile to create momentum for the creature when
triggerd. The direction of the momentum is opposite to the direction of the
target tile. For example, if the targe tile is on the left, the direction of the
momentum will be on the right. Jet neurons only work on ground tiles..
Name: Lamp
Type: LA
Range: 1
#: light color red
@: light color green
%: light color blue
^: light radius (maximum of 3)
+: not used
|: not used
The lamp neuron creates a light when triggered. Currently not used due to
lag issues.
Name: Lock
Type: LO
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
If the lock is activated and a creature resides on the target tile, the tar-
get creature and lock owner are locked together temporarely. Locked crea-
tures share their momentum and can move together.
Name: Mouth
Type: MO
Range: 0
#: food type that can be eaten (0-5)
@: food preference red
%: food preference green
^: food preference blue
+: not used
|: not used
The mouth neuron can eat food that is located on the same tile as the
creature when it is triggered.
Name: Muscle
Type: MU
Range: 1
#: strength and direction (-1 to 1)
@: rotation
%: move source and/or target
% <= (1/4): only move source
% >= (1/4) && # <= (3/4): move source and target
% >= (3/4): only move target
+: not used
|: not used
The muscle neuron forms a connection with the muscle end neuron. If a con-
nection does not exist, the muscle neuron will attempt to create a muscle
end neuron when it is triggered in any creature that resides on the target
tile.
When a muscle is activated and it has a muscle end connection, the two
creature will be pushed away from eachother or pulled together.
If the distance between a muscle and a muscle end is greater than 2 tiles,
the connection is broken. Muscles and muscle-ends are able reconnect
Name: Paddle
Type: PD
Range: 1
#: can use floor for movement or only creatures
@: not used
%: move owner and/or target creature
^: not used
+: direction of movement
|: not used
The paddle neuron is comparable to a leg. It provides a movement that is
perpendicular to the direction of the target tile. Paddle's can also use
creatures that reside on the target tile for movement. In that case, the
target creature will be pushed backwards.
Name: Speaker
Type: SP
Range: 1
#: sound volume
@: not used
%: not used
^: not used
+: not used
|: not used
The speaker neuron produces a sound on the target tile when triggered.
Name: Stinger
Type: ST
Range: 1
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
Simulation settings:
eat amount: amount of default energy stolen by stinger.
eat mode: method of calculation total amount of energy stolen.
0:
s = amount of stingers in creature located in the half
of the creature facing the target.
a = armor neurons in target creature located in the
half of the target facing the attacker.
b = s - a
is zero if b < 0
f = b / s
e = energy stolen
e = f * eat amount
1:
Stinger picks a random spot in the half on the target
creature facing the creature. If the spot contains an
armor neuron, the stinger will not steal any energy,
otherwise the amount of energy stolen is equal to the
eat amount.
Stingers can steal energy when they are triggered from objects that are
located on the target tile. They are countered by armor neurons.
Name: Turner
Type: TU
Range: 0
#: # < 0.5: direction of -1
# > 0.5: direction of 1
@: not used
%: not used
^: not used
+: not used
|: not used
The turner rotates the creature in one direction when triggered. The di-
rection depends on the x,y location of the neuron in the neural network and
the # property
Name: Armor
Type: AR
Range: 0
#: not used
@: not used
%: not used
^: not used
+: not used
|: not used
Armor neurons can not be activated nor do they send signals to oth-
er neurons. Armor provides protection against stinger neurons from other
creatures.
Name: Elastic
Type: EL
Range: 1
#: strength
@: rotation
%: nt used
^: not used
+: x location in neural network in which elastic end is cre
ated
|: y location in neural network in which elastic end is cre
ated
The elastic neuron forms a connection with the elastic-end neuron. If a con-
nection does not exist, the elastic neuron will attempt to create an elastic-
end neuron when it is triggered in any creature that resides on the target
tile. Elastics can not be triggered nor do they sned signals to other neu-
rons. Elastic-end owners and elastic owners are constantly pulled together.
A greater distance between the creatures means a stronger pull.
If the distance between an elastic and an elastic-end is greater than 2
tiles, the connection is broken. Elastic and elastic-ends are able reconnect
Name: DNA
Type:
Range: 0
DNA is not a neuron but does take a spot in the neural network. DNA is the
blue print that describes how a neural network will be build. DNA can mutate
when it is copied.