https://petterbergmar.itch.io/evolve-me For the Procedural Generation Jam 2016 I wanted to make something simple with elements of evolution and natural selection. It's not coded as a conventional genetic algorithm, but in a simple and "game-like" fashion that lets you "see" evolution in real time. I will describe what I mean briefly below. Made with Unity using C#.
Each cube acts based on a bunch of parameters. They need to eat randomly spawning plants or they will die, and they eventually die of old age. Once they reach their minReproductionAge, and bump into any other cube they mate and instantly produce three children. Children inherit a 50/50 blend of parents' properties. Each child will mutate some of their properties - this means changing the value slightly at random. This mutation is just as likely to be positive as negative. The only "sense" of the cubes is that they can "see" at a ray cast straight forward to a certain distance. What they do with the input depends on their properties. Here are the main properties of a cube explained:
The cool thing is that it does work. Initially a bunch of creatures are spawned and mutated a bit right away. I deliberately made their starting stats sub-optimal. As generations live and die and reproduce, the creatures with less optimal properties will die before they have a chance to reproduce. Cubes with higher sex drive will reproduce more etc. After running it for a long time the average properties change like this: Size gets smaller, move forward increases, change dir decreases, keep turning increases to always keep turning, eat drive goes up, sex drive goes up more, jump chance goes up after a really long time when enough random cubes happen to jump into the neighboring "pools".
Instructions: NOTE: THIS IS NOT A GAME! The interaction is limited to restarting a new population and walking around observing. WASD or arrow keys to move, mouse to look. Backspace to restart. Other games by Petter Bergmar: |