This update assumes you have a basic understanding of Neural Networks. If you donāt, go watch this video by 3Blue1Brown.
I am building intelligent artificial life. Iāve created a digital ecosystem where each creature is equipped with a brain and a capacity to reproduce. Through natural selection, one species will evolve and outperform the others.
For this project I implemented the NEAT algorithm. NEAT stands for Neuro-Evolution of Augmenting Topologies. The majority of Neuro-Evolution programs have a fixed topology. The number of hidden neurons remains constant throughout the evolution / learning process. Over time, the neural network will adjust the weights of each connection in order to maximize fitness. I used this method to teach AIs how to play a video game.
NEAT, on the other hand allows for Neural Networks (NNs) to evolve their own structure over generations. All the networks start out with just the input and output nodes. Usually such algorithms have a fitness function in order to determine which creatures are performing well, and which are not.
Instead of having a fitness function, I left it up to true natural selection. Creatures that are capable of reproducing have their genes passed onto further generations; otherwise, the genes are lost.
A creatureās genes refers to the specific structure of that creatureās brain and traits.
To create an offspring, we can generate a new genome by crossing over the parentsā genes. Once it is created, we can randomly mutate it in 1 of 5 ways.
Creating a new neuron
Connecting 2 pre-existing neurons
Adjusting a connectionās weight
Randomizing a connectionās weight
Toggling a connection on or off
These mutations can have a positive or negative effect on a creatureās performance.
Because of natural selection, if a mutation ends up being beneficial, that creature will have a higher chance at reproduction and passing its genes on to its offspring. Iāve often observed that offspring become completely brain-dead due to unfortunate mutations. Sometimes the mutation leads to a new behaviour which can save an entire species. If the offspring were carbon copies of their parents, the creatures would never improve.
The randomness of evolution led to an interesting diversity of behaviours among creatures. Some actively hunted for food, some spun in circles hoping they would find some, others would conserve their energy by not moving until they needed to move, etcā¦
To stop a single species from dominating all the others, I could add different environmental conditions. Some places could be colder than others, and to survive in a cold environment, creatures would need to spend energy heating up. Or perhaps the food is more scarce, but is generally more nutritious.
In the base environment, each creature has 11 inputs and 4 outputs.
Percentage Of Health Left
Percentage Of Energy Left
How Many Creatures Are In Range
Angle To The Nearest Creature
Distance To The Nearest Creature
How Many Foods Are In Range
Angle To The Nearest Food
Distance To The Nearest Food
The Current Speed Of The Creature
The Creatureās Current Age
Bias (always a 1)
For Outputs, the creature could either move forwards, move back, turn left, or turn right.
Creatures have 2 things to worry about for survival: Energy and Health. The energy bar decreases every frame depending on the creatureās actions and traits. If it reaches 0, the creature would start losing health. If it got to 0 health, it would die.
Based on those simple rules, a multitude of interesting outcomes occurred. The ecosystem would often overpopulate, only to collapse again shortly after. But in every single instance, one species would always outperform the others and dominate.
Creating this ecosystem was the first step on my journey to create artificial consciousness.
Currently, Iām trying to figure out how to make an algorithm with a mutable number of inputs and outputs. With mutable inputs, I believe I could build a much more robust version of the project, where creatures evolve their senses and behaviours from scratch. Iām currently exploring cellular automata to see if I can find any insights. If you know anything about mutable inputs and output layers, please leave a comment!
A really cool description of your work!! It's relatable and the links between your work and biological evolution are evident. Looking forward to updates!