Adam Campbell's Website
NEATALS (NEAT Artificial Life Simulation)

Download the code

The code can be downloaded here. Make sure to have the latest version of the Java SDK before compiling and running the code.

Project goals

This program was written for Dr. Stanley's NeuroEvolution class (CAP6938) in the Spring of 2006. The goals were to create a complex artificial life simulation where creatures, controlled by neural networks evolved using NEAT methodologies, would compete for food while avoiding environmental hazards (poisonous food, turrets, etc.) Users should be hopefully be able to see the creatures getting smarter as natural selection weeds out the unfit individuals. The main goal is to have fun!


Each creature in the simulation is controlled by a neural network. Initially, the neural network architecture is simple, with only its input and bias being connected to the outputs (no hidden neurons.) When creatures move on top of food, their energy supply is increased, and if it surpasses its ASEXUAL_MATING_THRESHOLD it asexually reproduces. At this point, its offspring's controller has a chance to become more complicated through mutation.
Figure 1
A creature can also sexually reproduce if its energy level is above a SEXUAL_REPRODUCTION_THRESHOLD and it encounters a creature that also meets this criteria. For sexual reproduction to occur, the following must be true SEXUAL_REPRODUCTION_THRESHOLD > ASEXUAL_MATING_THRESHOLD. In most experiments, no mating selection criteria was used by the creatures, but this can be changed so that creatures can only mate with others in their own species. Species are determined in a NEAT-like way, where creatures with similar neural networks are in the same species.

Figure 1 shows how the creatures' omnidirectional sensor is divided into four areas. Each of these four areas has s sensors associated to it, with each of these sensors being "on" in the presense of a particular type of entity. The entities within the simulation are: creatures, moving food, stationary food, poisonous food, turrets and bullets. Thus, each creature has 4 * 6 = 24 inputs in its neural network. In Figure 1, creatures are shown as big black circles, stationary food is red, and moving food is green. Poisonous food (not shown in Figure 1) is gray and sucks energy from the creatures it touches. Moving food is tougher to catch and thus gives the creature a higher reward when eaten. It becomes interesting to see what type of food the agents chase and whether or not they learn to avoid the bullets and poisonous food. Initial experiments show the agents learn only to eat good food and do not worry about avoiding these hazards.Perhaps by playing around with the energy rewards and penalties of the food, you can see some more interesting behavior evolve.

Double clicking on a creature will bring up the inspector tab for that creature (Figure 2.) From there, you can see a little of what is actually happening inside the creature. Various interval variables can be read from here, and some can even be written to. Click on the Figure 2 to see the full image.
Figure 2
You can see how new a creature is by checking its ID. Newer creatures have higher IDs. If all of the creatures have high IDs, then it shows the old creatures have died out because of either old age, or they simply weren't fit enough to survive with the new generations. In the parameter file, you can set the age at which agents die. If this variable is set extremely high, then agents will only die when they run out of energy. When age is not a factor, then survival is based on just that: survival. Creatures who used to be good can die away because the new generations outperform them. It is a simple form of evolution, but it's fun to watch!

Compiling and running the code

To compile and run the code, first download and extract it. (Go to if you need help extracting tar.gz files.) Next, enter in to the mason directory and type the following to compile the code:

javac sim/app/species/*.java

To run the simulation, go into the mason directory (if you're not already there) and type:


In the mason directory is the configuration file, run.conf used to specify the number of A-Life creatures, food, turrets, etc. The configuration file is commented, so you should be able to figure out the purpose of each parameter. Any questions, comments, or suggestions can be sent to me.

Additional information