Visions Of Chaos Genetic Bugs 2 Tutorial

Genetic Bugs is a simple simulation to show Darwinian principals of evolution and survival of the fittest.

The World

The world the bugs live within contains the bugs themselves (represented as white circles), food (represented by green pixels) and obstacles (represtented by blue areas).

Genetic Bugs

Genetics Of The Bugs

Each of the bugs' movement is controlled by an artificial DNA made up of a sequence of 25 numbers.

When the bugs are initially randomly created each of their 8 genes are given a random value between 1 and 8.

Every time the bug moves this is the sequence of calculations that determine its direction;

1. One of the genes is chosen by (cycles mod 25)+1. This goes through the 25 genes in sequence repeatedly during the simulation.

2. Each of the 8 possible gene values represent a direction to move. 1 is north, 2 north-east, 3 is east, etc.

In this virtual world bugs that tend to move in small circles die out from lack of food. Bugs that move in more straight lines eat more food and have a better chance of survival.

Eating and Energy

If a moving bug lands on a food particle, it eats the food and its energy level increases. If there is no food at the location its energy level decreases.

Bugs that lose too much energy will die and are removed from the world.


When a bug's energy reaches a specified amount it will give birth to a child bug. The child bug takes on the same gene sequence as the parent bug, but with slight changes. These changes are like evolutionary mutations.

As the child bugs live in the world they may do better than the parent bug. The best surviving bugs eat more food, gain more energy and give rise to more child bugs and pass on their genes.

Other Settings

There are many settings to tweak that customise the world and the simulation of the bugs.

Initial bug population - The number of bugs to start the simulation with. Each of them get a random gene sequence.

Initial bug energy - The amount of energy each bug gets when first generated or when given birth to.

Initial food density - How much of the world has food particles.

Energy per food particle - How much energy a bug gains when it eats a food particle.

New food per cycle - How many new food particles are added to the world each step of the simulation.

Wraparound world - If checked the right edge wraps around to the left edge and the bottom edge wraps around to the top edge. If unchecked the edges of the world are surrounded by walls or obstacles and bugs cannot travel beyond the edges..

Show statistics - Displays a statistics window during simulations that shows stats on births, deaths and other simulation related data.

Obstacles - When checked the world will have obstacles introduced that the bugs cannot go through. This means their gene sequences need to learn or adapt to not run into the obstacles as much so they keep moving and eating. There are a variety of obstacle types included to choose from.

Genes modified at birth - How many of the 25 genes are changed for a child bug compared to the parent bug.

Energy level for birth - The amount of energy a bug needs to reach before it gives birth to a child bug.

Bug display style - Alternate ways other than circles to show the bugs as.

Color settings - Allows customised colors for the display.