Press "Enter" to skip to content

World Generation, Plant Life & NEAT brains!

World Generation

One of the important parts of this project is having an interesting and detail-rich environment for the creatures to exist in. I want there to be a lot of information that can be drawn from the environment (temperature, biome, height) which can be fed into the creatures’ neural networks in order to allow them to have a proper understanding of the world they exist in.

Procedurally generated world with various biomes + bushes

I want to be able to generate interesting worlds with separate landmasses, oceans & biomes (desert, forest, etc) which are customisable to the user. The different environments will hopefully drive speciation and result in different types of creatures. My undergraduate dissertation was actually on the topic of procedural generation and its applications to world generation- so I felt quite prepared to implement this world generation!

As can be seen below, it is possible to tweak generation parameters in real time with multiple different type of coherent noise. The UI for doing this was a must as it makes it magnitudes easier to generate a nice level (as opposed to: tweak parameters, build, check result, repeat…)

World Generation

The world features grassland, desert and tundra as the 3 basic biomes. I’m looking to expand this to at least a couple more: jungle biomes which will support many different plant forms (and hopefully creatures too) and plains (where hopefully creatures will roam in herds).

Plant Generation

We need to add some plant life into this world. The ultimate source of food, plus they just make the whole world look nicer! I’ve introduced bushes as the default form of plant life. Bushes produce multiple pieces of fruit which allows them to support multiple creatures (as opposed to a plant that is fully consumed by a creature), and they currently only grow in grassland. Plants within the simulation make use of genomes just as the creatures do, so variables like size and colour can be managed by a gene. This allows the plants to mutate (and evolve) just like the creatures.

These bushes currently exist perpetually and always replenish their fruit. The plan for the future would be creating seeds which exist within the fruit, and can be spread in a natural way as seeds do in real life (I’m talking about poop)! Different biomes will have different fertility rates and perhaps even certain plants will only be able to grow in certain environments (ever see a cactus in the snow?).

NEAT Brains

These creatures need a way of thinking, and of course neural networks are the answer: they often are! Instead of using a standard fully connected model I wanted to implement the NEAT algorithm (NeuroEvolution of Augmenting Topologies). Unlike a traditional, fully connected network which only mutates by shifting connection weights, the NEAT algorithm allows the evolution of the network’s topology, ie, the actual structure. The topological evolution is made possible by the additional mutations the NEAT algorithm introduces: addition/removal of nodes & addition/removal of connections.

This is a much more exciting approach to neuro-evolution because it opens the door to specialised neural network structures. A neural network can now evolve more complex structures geared towards helping them achieve a specific objective.

A perfect example would be the evolution of some kind of visual cortex. The creatures in this simulation will have many inputs relating to vision: distance to an entity, the angle, the colour, etc. With a fully connected network you’re giving the creature a brain with a predetermined structure where only small weight changed can be made. With NEAT it is equivelant to giving the creatures a blank slate and saying “build whatever kind of brain helps you achieve your objective.

And it will. Vision is certainly the most important input, with a lot of conclusions to be drawn from what can be seen. A creature could evolve to fear predators; this could be by developing a fear of a certain colour. (I will be giving the creatures a concept of fear, nobody mentioned benevolence!). The brain will inevitably evolve more complex structures around the visual inputs, much more so than the inputs with lesser importance.

Neural Network using NEAT. Green = positive connection, red = negative connection.

A lot of the groundwork is laid out already. I have created an implementation of the NEAT algorithm and the world is ready to be explored! All I need to do now is connect the creatures’ brains up to the world around them and see what happens!