Open Source Toolkit for Evolving Virtual Creatures



Genotype to Phenotype Mapping
Config File
Setting Up a Field
Custom Evaluation Function


Use the following commands at your operating system command prompt to start JungleBoogie:

   first use resetpop to initialize the population on disk. Use the resetpop script to reset the population on disk if desired.

breve single-thread-eval-population
   evaluate the population over and over: You make kill the process and restart it later. Since each generation is stored on disk, it will pick up where it left off.

  starts JungleBoogie with default start method

breve <method-name>
   starts JungleBoogie with specific start method in the Script class.

The file will tell you the fitness of each population created since the last resetpop.

Genotype to Phenotype Mapping

The "DNA" of the animal is an L-System, the L-System is expanded into a command string with the LParser::expand method. BodyNode::read converts the instructions into a morphology tree where each node of the tree corresponds to a joint with a body segment at the end of it. Examples of information stored in each node are attachment orientation and rotation axis.

Building Animal Morphology

Body::build-body reads the morphology tree and builds a physical body consisting of Links and Joints. As the Links and Joints are instantiated, build-body fills the morphology tree with references to the new Links and Joints. When you need to access a Link or Joint of the animal, once the animal is build, you can use the morphology tree.

Building Animal Brain

The neural net starts as a single edge. The command string created from expanding the L-System of the animal contains commands for construction morphology and brain. When BodyNode::read reads through the command string one command at a time. If the command deals with building the body, the Morphology tree is modified, usually by adding a node. If the command deals with building the neural net, the neural net is modified. Once all the commands are read, and all the modifications are done, the neural net is complete. The body and neural net are separate objects, but commands that create a body segment also create a corresponding actuator neurons in the neural net.

Conceptual details are in this paper:
Hornby, Gregory. S. and Pollack, Jordan. B. (2001). Body-Brain Co-evolution Using L-systems as a Generative Encoding.
Genetic and Evolutionary Computation Conference.

Config File

config.txt contains a list of global variables and corresponding values.

Integers values are indicated like this:


String values are indicated like this:


You may edit config.txt with a text editor. The white space in the file is important, so you need to use the format of line spacing that config.txt uses. To add more variables, simply add them to the file and they will become available in your program. The values are stored in a hashtable as key-value pairs.

For access to values in your program, use:
controller get key "variable-name"

-example global variables in the config file:-
population-size  -  size of the population
evaluation-round-duration - duration of time that each animal is evaluated
expand-rule-max-depth - when the L-System grammar is expanded, there may be recursive expansions the create infinitely long or very long results. this limits the expansion. in effect, the lower this number is, the fewer body parts the animals will tend to have.

Setting Up a Field

Fields are functions defined on all points in space. One example is the distance from some block - zero on the block, and a higher number as you move away. Consider a field part of the environment, the virtual animal can detect the field at it's sensor position, much like a virtual animal can detect light hitting its eye.

distanceFunction = new DistanceFunction.
distanceFunction set-base-object to block.
controller set-field-value-function type 0 to distanceFunction.

Each animals may have sensors for different fields. The "type 0" parameter indicates that you are defining field number 0.

Suppose you extend Match by creating MyMatch, the MyMatch::init is a good place to setup the field.

The color of each body segment can be set to correspond to the value of the sensor on that body segment. This color does not affect simulation but might make it easier for you to see what is going on. You make change the index of the field that is displayed with this entry in config.txt


Custom Evaluation Function

Each evaluation is called a match. Matches may involve one or more animals. All the examples use one animal. The Match class represents one match. Objects that exist in the match are members of Match object. The Match class handles initialization and cleanup for each match.

The method Match::calculate-fitness returns a fitness value. Override this method to define your own fitness function. gives an example of extending the SinglePlayerMatch class to evaluate animals that push a block.


Copyright 2004 Richard J. P. Giuly