Hello everyone,
This is a simulation of a 2D world that a
species of creatures
are trying to figure out.
So the world they are exploring is randomly
generated and has three
types of terrain.
There's forests, which are the bright green
squares with trees
on them.
Lakes, which are blue.
And meadows, which are greyish-green.
Each tile also has a fertility score which
determines how bright
it is, though I might scrap this soon.
Forests and meadows grow mushrooms on them.
Those are the little
brownish blobs that pop up all over the place.
Forests grow mushrooms faster than meadows,
and of course lakes
don't grow them at all.
The yellow circles are the creatures on the
map.
We've generated 100 of them at random and
if the population
drops below 100, we create more.
Each creature has a genome which determines
their physical size,
their brain's size, and their brain's configuration.
There's a display of the oldest 100 genomes
in the world on the
side here, one genome per line.
At the moment they're all quite random now
and the creatures
aren't really acting in any coherent manner.
We can select a character to see what its
brain looks like.
This one's quite interesting.
It's a neural network with a single hidden
layer.
The neural network determines three aspects
of the creature's
behaviour:
How fast the creature is turning
How much the creature is trying to move forward.
And whether the creature is trying to reproduce.
The simulation
allows them to spawn a copy of themselves,
with a small chance
of genetic mutation, if it has a lot of energy
at the time. Spawning also costs
the creature a lot of energy, so if it does
it too much, it will
probably die.
The neural network works by taking in a set
of inputs, which are
basically the creature's senses. Currently
the simulation is quite
limited and all they can sense is whether
they are touching
something (so this is 0 if they are not touching
something and 1 if they are touching something)
The creature can also sense how much energy
it has. When it gets low on energy it starts
turning a deeper yellow colour and then eventually
disappears when it runs out of energy.
The layers of the neural network work by multiplying
each of the
neurons in the previous layer by the weight
that neuron has for
that connection. This is all determined by
the creature's genes.
So I'm going to let this simulation run for
a while; let's come
back in a few minutes.
So we could see this happening earlier, that
all the creatures
have found that being small is advantageous
to them.
This is probably because the simulation allows
smaller creatures
to move faster, and currently there's no penalty
for that.
It's also going to be because the smaller
creatures can reach
the more plentiful mushrooms in between the
trees in the forest.
All of the genes in the pool are now quite
similar, though we
can see that random mutations can still cause
changes.
One other interesting behaviour that's developed
is that the
simulation favours creatures that turn faster
when they hit
something.
We can see that when they hit something the
angle change flickers a little there. When
it is running around its angle change is 0.8
or 0.7 and when it hits something it goes
up to 0.9 ,1.1.
So I hope you enjoyed seeing the simulation.
If you want to play
with it yourself, the code is on github [link
in the description].
If you've got any
questions, leave a message in the comments.
I'm going to add more
features soon, like giving the creatures eyes,
so
subscribe if you want to see what happens
then!
