StrangeWorld

Author: Chaplin
E-mail: chaplin_hack@hotmail.com
Webpage: http://www.angelfire.com/id/chaplincorp



StrangeWorld is a java program that demonstrates how evolution through natural selection can tune a neural network. StrangeWorld models a predator/prey environment where herbivores feed on static food and carnivores feed on herbivores and other carnivores.


Neural Networks
Every carnivores or herbivore has a set of antennas. Each antenna calculates the Red/Green/Blue intensity inside a certain radius. Intensity increases, as it is closer to the animal. These are the values that the animal uses to make decisions on whether to move forward or backward or to rotate.
The neural networks that the herbivores and carnivores in StrangeWorld use are simple analog neural networks whose neurons can have a value between -1000 and 1000 as its output. There are nine neurons per layer and there are 5 layers (1 input, 3 hidden, 1 output).
Every neuron of a layer is connected to all the neurons of the previous layer. Each inter-neuron link can have a weight between -1000 and 1000. The inputs for each neuron are multiplied by their corresponding weight then added. The total is then divided by the average of all the weights for that neuron and the result cropped into a range between –1000 and 1000 is the output of that neuron.

The nine inputs of the neural networks

  1. The red intensity from the right antenna (0 – 1000)
  2. The green intensity from the right antenna (0 – 1000)
  3. The blue intensity from the right antenna (0 – 1000)
  4. The red intensity from the left antenna (0 – 1000)
  5. The green intensity from the left antenna (0 – 1000)
  6. The blue intensity from the left antenna (0 – 1000)
  7. The current health of the creature (0 – 1000)
  8. The last rotation (feedback) (-1000 – 1000)
  9. The last displacement (feedback) (-1000 – 1000)

 

The two outputs of the neural network

  1. The rotation (-1000 – 1000) or (-10 – 10 degrees rotation)
  2. The displacement (-1000 – 1000) or (-10 – 10 pixels displacement)

 

Rules of Strange World

 

StrangeWorld is clocked by a global tick. Every tick, the world iterates through all the creatures.

 

Interface

Everything in StrangeWorld is manipulator with the mouse. The program was created using the Java SDK 1.4.0. If the JRE is older than that, the mouse and keyboard inputs may not be functional. First, keyboard focus must be given to StrangeWorld; clicking inside the window does this.

A single creature can be selected by clicking on it. A selected creature turns yellow and is invincible for as long as it is selected.

 

The following keyboard commands are available.

 

Saving the progress

 

When StrangeWorld is closed, it dumps to the current directory the neural network gene for one randomly selected carnivore and one randomly selected herbivore.

These neural network genes are then loaded next time StrangeWorld is started. If no gene files are found on startup, the creatures that are spawned start with completely random neural networks. The genes are also saved every 5000 ticks to minimize the loss of progress in case of a system crash.

 

Extinctions

In the case of an extinction, StrangeWorld will spawn three new creatures of the extinct specie with the specie’s last creature’s neural network. This allows StrangeWorld to continue to run non-stop without having to be restarted every time there is an extinction.