DEV Community

eranelbaz
eranelbaz

Posted on • Updated on

Code Tryouts - Natural Selection

Hey,
In the last week I wrote simulation in Unity3d,
In this simulation we have animals that can walk around the map and they search for food, water and another animal to mate with.

Each animal currently have 2 genes - Speed and Search Radius.

When a new animal is born it can inherent each gene from one of the parents,
and in 80% of the cases the gene will also change a bit.

I let the simulation run twice, each time for 5 minutes and the results are
Alt Text
Alt Text

Alt Text
Alt Text

Alt Text
Alt Text

What that shocked me was that in the second run the Search radius didn't raise all the time as the first run, and I think that the reason for that is because the population explodes, and so there are more animals that are probably closer to water and food.

I think I'll revisit this project in the future and will add predators and will see what happens.

For more information you can watch the development process in youtube:

Click here to this project github page
Click here to download the run data

Have a great day 😋

Like this post?
Support me via Patreon
Subscribe to my YouTube Channel

Top comments (0)