Artificial Life, introduction - 3D simulation and evolution | …€¦ ·  · 2015-01-22Users of...

113
FRAMSTICKS MANUAL This is a pdf form of the Framsticks documentation. It is compiled from the Framsticks HTML web pages which look better (and are more recent) than this document. It is strongly recommended to browse on-line documentation when possible. This reference manual, albeit outdated (created in 2008), lists selected issues, includes a Table of Contents, and may be more suitable for printing or serve as an off-line reference. www.framsticks.com by Maciej Komosinski and Szymon Ulatowski Framsticks is a three-dimensional life simulation project. Both mechanical structures (bodies) and control systems (brains) of creatures are modeled. It is possible to design various kinds of experiments, including simple optimization (by evolutionary algorithms), coevolution, open-ended and spontaneous evolution, distinct gene pools and populations, diverse genotype/phenotype mappings, and species/ecosystems modeling. You are welcome to try Framsticks! Users of this software work on evolutionary computation, artificial intelligence, neural networks, biology, robotics and simulation, cognitive science, neuroscience, medicine, philosophy, virtual reality, graphics, and art. The system can be interesting for experimenters who would like to evolve their own artificial creatures and see them in a three-dimensional, virtual world. You can also manually design and test creatures. This software is a versatile tool for research and education.

Transcript of Artificial Life, introduction - 3D simulation and evolution | …€¦ ·  · 2015-01-22Users of...

FRAMSTICKS MANUAL

This is a pdf form of the Framsticks documentation. It is compiled from the Framsticks HTML web pageswhich look better (and are more recent) than this document. It is strongly recommended to browse on-linedocumentation when possible. This reference manual, albeit outdated (created in 2008), lists selected issues,includes a Table of Contents, and may be more suitable for printing or serve as an off-line reference.

www.framsticks.com

by Maciej Komosinski and Szymon Ulatowski

Framsticks is a three-dimensional life simulation project. Both mechanicalstructures (�bodies�) and control systems (�brains�) of creatures are modeled. Itis possible to design various kinds of experiments, including simple optimization(by evolutionary algorithms), coevolution, open-ended and spontaneousevolution, distinct gene pools and populations, diverse genotype/phenotypemappings, and species/ecosystems modeling.

You are welcome to try Framsticks! Users of this software work on evolutionary computation, artificialintelligence, neural networks, biology, robotics and simulation, cognitive science, neuroscience, medicine,philosophy, virtual reality, graphics, and art. The system can be interesting for experimenters who would liketo evolve their own artificial creatures and see them in a three-dimensional, virtual world. You can alsomanually design and test creatures. This software is a versatile tool for research and education.

Table of Contents1 Artificial Life introduction..............................................................................................................................1

2 About the project – objectives and scope.......................................................................................................22.1 Objectives and scope of this research................................................................................................22.2 System capabilities............................................................................................................................22.3 Directions of work.............................................................................................................................3

3 Assumptions of the model...............................................................................................................................4

4 Simulation Details............................................................................................................................................54.1 Physical (creature's body) simulation................................................................................................54.2 Neural (creature's brain) simulation...................................................................................................5

4.2.1 Formulas for neurons: N, Nu, D, Thr, *, Rnd, Sin, Fuzzy.......................................................54.2.2 The N neuron in detail..............................................................................................................6

4.3 Special neurons: muscles and receptors.............................................................................................94.3.1 Formulas for basic effectors and receptors.............................................................................10

4.4 All neuron types: summary..............................................................................................................124.4.1 Experimental neurons.............................................................................................................15

5 Genotype encodings.......................................................................................................................................17

6 Genotype (format f0).....................................................................................................................................186.1 f0 Syntax..........................................................................................................................................186.2 f0 Semantics.....................................................................................................................................19

6.2.1 Part object...............................................................................................................................196.2.2 Joint object.............................................................................................................................196.2.3 Neuron object.........................................................................................................................196.2.4 Neuron input definition (connection).....................................................................................20

6.3 Model validity constraints...............................................................................................................206.4 f0 Examples.....................................................................................................................................20

7 Genotype (format f1).....................................................................................................................................227.1 Creature body...................................................................................................................................22

7.1.1 Examples................................................................................................................................227.2 Creature brain...................................................................................................................................24

7.2.1 Examples................................................................................................................................247.2.2 Examples of the old, deprecated syntax.................................................................................24

8 Genotype (format f4).....................................................................................................................................268.1 Overview..........................................................................................................................................268.2 Details..............................................................................................................................................278.3 Genetic operators.............................................................................................................................298.4 Examples..........................................................................................................................................29

9 Simulation Parameters..................................................................................................................................319.1 Experiment.......................................................................................................................................319.2 Files..................................................................................................................................................339.3 Error reporting.................................................................................................................................339.4 World...............................................................................................................................................339.5 Genetics............................................................................................................................................349.6 User scripts.......................................................................................................................................35

Table of Contents9 Simulation Parameters

9.7 Neurons............................................................................................................................................35

10 "Standard" experiment definition: parameters reference.......................................................................3710.1 Tasks performed in each simulation step.......................................................................................3710.2 Parameters......................................................................................................................................38

11 Tips on evolution design, parameters, etc..................................................................................................4011.1 Directed evolution..........................................................................................................................4011.2 Spontaneous evolution...................................................................................................................4011.3 General remarks.............................................................................................................................41

12 Experiment definitions summary...............................................................................................................4212.1 Experiment definition: Standard Experiment................................................................................4212.2 Experiment definition: Asexual reproduction in the world...........................................................4512.3 Experiment definition: Demonstration of evolution......................................................................4612.4 Experiment definition: Neuroanalysis...........................................................................................4712.5 Experiment definition: Learn where food is, explore and exploit.................................................4812.6 Experiment definition: Boids.........................................................................................................4912.7 Experiment definition: Generational evolutionary optimization experiment................................5012.8 Experiment definition: Mazes........................................................................................................5112.9 Experiment definition: Text writer................................................................................................5312.10 Experiment definition: Dance......................................................................................................5412.11 Experiment definition: Framsbots - Game...................................................................................5612.12 Experiment definition: Batch evaluation of loaded genotypes....................................................57

13 Graphical User Interface (GUI) for Windows..........................................................................................6013.1 Introduction....................................................................................................................................6013.2 Genotype data window..................................................................................................................6013.3 Body and brain window.................................................................................................................6113.4 Artificial world window.................................................................................................................6113.5 More hints......................................................................................................................................6113.6 A GUI mini-tutorial.......................................................................................................................6213.7 Command-line parameters for the Framsticks GUI.......................................................................6213.8 Advanced notes..............................................................................................................................62

14 Interface parameters...................................................................................................................................6314.1 General...........................................................................................................................................6314.2 Visual style....................................................................................................................................6314.3 Performance charts.........................................................................................................................6314.4 Export world..................................................................................................................................64

15 OpenGL visualisation.................................................................................................................................6515.1 Some OpenGL styles.....................................................................................................................65

16 User Interface – command line...................................................................................................................6916.1 Interactive command-line..............................................................................................................6916.2 Command-line...............................................................................................................................6916.3 Batch..............................................................................................................................................6916.4 User-defined actions, scripts and macros.......................................................................................70

Table of Contents17 Script writing................................................................................................................................................71

18 FramScript language...................................................................................................................................7218.1 Statements......................................................................................................................................7218.2 Variables........................................................................................................................................7218.3 Expressions....................................................................................................................................7318.4 Functions........................................................................................................................................7518.5 Using Framsticks classes, methods, and variables.........................................................................75

19 What is an experiment definition, and how to create your own expdef..................................................7619.1 Illustrative example (standard experiment definition)...................................................................76

20 Programming: contexts and classes summary..........................................................................................7820.1 All contexts and classes.................................................................................................................7820.2 Global context................................................................................................................................7920.3 Experiment definition....................................................................................................................8120.4 Neuron definitions.........................................................................................................................8120.5 Fitness formula..............................................................................................................................8220.6 Visual style definition....................................................................................................................8220.7 Command line interface.................................................................................................................84

21 Software package remarks..........................................................................................................................8521.1 Files and file types.........................................................................................................................8521.2 Sample files provided....................................................................................................................8521.3 Release notes..................................................................................................................................86

21.3.1 Simulator..............................................................................................................................8621.3.2 MS Windows graphical user interface.................................................................................8621.3.3 Amiga graphical user interface (old)....................................................................................86

21.4 Reporting bugs...............................................................................................................................86

22 Events and FAQ...........................................................................................................................................8722.1 Framsticks-related events...............................................................................................................8722.2 Frequently Asked Questions..........................................................................................................88

23 Framsticks resources (including survey results).......................................................................................9023.1 Documentation...............................................................................................................................9023.2 Exercises and experiments – for teachers and students.................................................................9023.3 Selected publications and theirBibTeX entries...........................................................................9023.4 Related web pages and projects.....................................................................................................9123.5 Meet some Framsticks users..........................................................................................................91

24 Framsticks Tutorial – step by step.............................................................................................................94

25 If you have questions.................................................................................................................................109

1 Artificial Life introduction

The objective of this project is to study evolution process in a computer-simulated artificial world. We hopethat, like in the real world, despite randomness and aimlessness of basic evolution mechanisms, it will lead tocreation of more and more efficient artificial organisms, still better and better adapted to the artificial worldconditions.

For many years people used computers to simulate Nature. This kind of research also belongs to a field ofscience called "Artificial Life" (AL). The name is obviously connected with "Artificial Intelligence" – bothfields of study partly overlap, but AL has more in common with biology and physics. It might be called abranch of biology, because we study living (or "living", depending on the definition of this word) organismsin an environment. No matter that the environment is an artificial, virtual world inside a computer:philosophers haven't yet decided whether our world is real and, nevertheless, biologists keep examining itsliving organisms. In addition, our made-up worlds let us (until we visit other, very distant planets) study signsof life which has nothing to do with proteins.

Scientists studying AL concentrate on various fields and serve many purposes. Rules of simulated worlds donot have to be like real ones, but such models seem more interesting (perhaps because you are able to directlycompare simulation results with reality).

Boids are an example of creatures following a few simple rules, which nevertheless make them group withothers (like fish shoals or bird herds). This kind of behavior was used in film making (computer control ofanimals' models – "Lion King", "Batman forever" and many advertisements). More sophisticated modelsinclude learning and self-improving creatures. Artificial organisms (i.e. carriages with engines) can be taughtto avoid obstacles, seek energy spots, follow targets, escape enemies etc. Such experiments are directlyconnected with real robots' control – they might alone perform useful actions.

Often it is evolution which controls improvements – it awards better-adapted, fit (or, in the case of artificialworld, efficient as we want them) organisms. That has to do with genetic algorithms and works the same way.In Nature, organism morphology is determined by genes, and this – together with other mechanisms, likelearning – supports evolution and its high efficiency. In our life simulator, similarly, genes describe the wholestructure of an organism. Full freedom in building genotypes means theoretically an ability for creation ofcreatures of any complexity.

Artificial Life research makes us ask whether self-improvement of artificial organisms can lead to foundingconsciousness, intelligence, feelings? Not in our simple model, of course. However, there is still a question ifevolution alone created organisms which live among us. Experiments with simulated evolutions will showtheir capabilities, and the results of such experimentation can help explain the mystery of our creation.

If you would like to share your ideas on these topics or read other comments, do not hesitate and use ouron-line forums.

2 About the project – objectives and scope

2.1 Objectives and scope of this research

The objective of these experiments is a study of evolution capabilities of creatures in simplified Earth-likeconditions. They are: a three-dimensional environment, genotype representation of organisms, physicalstructure (body) and neural network (brain) both described in genotype, stiumuli loop (environment –receptors – brain – effectors – environment), genotype reconfiguration operations (mutation, crossing over,repair), energetic requirements and balance, and specialization.

The simulator allows the study of both directed (with fitness criterion defined) and spontaneous (with no suchcriterion) evolution. In the directed case, it is possible to "grow" creatures with the given properties, likesimple construction and smooth movement, strength and robustness, ability to move in land and waterenvironments, seeking food, following targets, escaping and many others. The system allows users to createmore experiment definitions, which may lead to unexpected results and emergence of very complexbehaviors.

Another aspect of this research is the influence of representation (description) of creatures, reconfigurationoperators and the rules of organism building on evolution results and characteristics of structures of createdindividuals.

The most important part of the research is the study and evaluation of capabilities of various evolutionaryprocesses, including those concerning undirected evolution (which has not already been done in such acomplex environmental and simulation conditions).

2.2 System capabilities

Framsticks has a powerful, universal simulator with great capabilities, which are:

Three-dimensional, mechanical simulation of the artificial world (Mechastick module):Creatures' simulation with finite elements method♦ Specialization of their limbs – friction, strength, ways of acquiring energy by assimilation,ingestion etc.

Flat land, terrain made of blocks/slopes of different height and water environment♦ Nondestructive and destructive collisions♦ Ability for the user to interact with the simulated world (dragging of creatures, energy ballsplacement, revival and killing of individuals)

Simulation of creatures' control system ("brain"):Neural net of any topology, built from any kind of neurons♦ Interaction with the environment: receptors (touch, equilibrium and energy localizationsenses) and effectors (muscles moving a creature, controlled by its neural network)

Various types of neurons♦

Evolution:Maintaining a set of genotypes grouped in gene pools♦ Maintaining a set of individuals grouped in populations♦ Many ways of organism description (genetic representations)♦ Modification of creatures' descriptions by crossover and mutations♦ Evaluation of creatures with various criteria (life span, speed etc.)♦

Maintaining of creatures' energetic balance (gains and usage of energy for various purposes)♦ Performance measurement, multi-criteria evaluation♦

Scripting language which allows for modification and extension of the system, designing custom userexperiment definitions, custom neuron types, user-defined fitness functions, macros, visualizationstyles, etc.

Parametization of most of operations, environment, simulation and evolution rules, and systembehavior

Graphical interface for Windows and Amiga platforms, textual interface for any system•

2.3 Directions of work

various genotype encodings (including developmental) to describe body and brain• network version of the simulator, and specification of the communication protocol• JAVA and Python network interfaces independent from the simulator; other interfaces fromFramsticks users

more accurate physical simulation• design of experiment definitions for open-ended, spontaneous evolution and biologically-plausibleecosystem simulation

additional senses (receptors)• network-distributed evolution; Framsticks Experimentation Center•

developers should refer toFramsticks Development Center.•

2 About the project – objectives and scope 3

3 Assumptions of the model

We tried to make the artificial world similar to the real one. When creating it, we wanted to support it with allthe features which allow the evolution process to be aimed at a direction, so that organisms can – without apurpose – discover new ways of living according to their fitness defined by the user. On the other hand, wetried to create reasonable conditions of living in the environment without any fitness criteria defined – that is,in a spontaneous evolution.

Biological evolution started from simple components. Much time had passed until the first creatures were ableto reproduce. In our artificial world we skip this "chemical evolution" stage. We supply our creatures withbasic functions: notation of their features in their genotypes, multiplication of genotypes, and energymanagement. We also set the rules of organism building. It would be difficult to simulate a world with quarks,atoms or even proteins as its basic elements. There would be too many of them regarding reasonable size ofthe artificial world and computational requirements. That is why the basic element of our organisms is muchbigger – it is a rod (bar, stick, cylinder...). Such an element can be assigned various functions depending on itsgenetic description: it can be just a stick, or can transmit and process signals and therefore be a part of a"brain", or be a receptor, or can have "muscles" and cause moves, or can be specialized in supplying energy.

A group of connected sticks makes up an independent organism. It becomes alive when put into the simulator!

The physical simulation module computes interaction of an organism with the world ("Framsworld"),analyzes forces influencing particular sticks and computes their new positions. The simulation takes place in athree-dimensional space, and uses finite elements theory and rigid bodies dynamics.

The neural module computes excitations in neural nets, collects data from receptors and sends signals tomuscles. Organisms' neuron nets are different from those usually used in AI because of their free topologyand inertia of neurons.

The energetic module analyzes gains and losses of energy. From settings in an experiment definition anorganism can, for example, gain energy by assimilation or absorption of food, and use it for the work ofmuscles and neurons. After using up all its energy an organism may "die".

The creation module creates new organisms, for example by mutating and crossing over genotypes of the bestcreatures which have lived so far (ancestors).

The simulator is controlled by the script which defines the experiment. A sample experiment is"standard.expdef".

4 Simulation Details

4.1 Physical (creature's body) simulation

Bodies of creatures are divided into small pieces (at sticks' ends) which are ideal material points. Thisapproach is called "finite element method": not every point of a material body is simulated – only a finitenumber of points, representing small volumes in the body. The simulator calculates all the forces affecting agiven point: gravity, elastic reaction when joined with other points, ground reaction and friction whentouching the ground, etc.

In our model some assumptions are taken to simplify calculations. A primitive but fast numeric integrationmethod is used, so the results are not very exact when dealing with big forces.

The picture on the rightshows sample forces

calculated in theFramsticks physical

simulator, Mechastick.

The body is made fromparts (points) and joints

(sticks, rods).

Another simulation engine that can be used within Framsticks is ODE.

4.2 Neural (creature's brain) simulation

Neural network is made from neurons and connections. The Framsticks simulator supports many types ofneurons (for example sigmoid neuron N, noise generator Rnd, differential neuron D, delay neuron Delay,threshold neuron Thr), and users can easily create their own signal processing neurons using FramScript andediting scripts/*.neuro files.

4.2.1 Formulas for neurons: N, Nu, D, Thr, *, Rnd, Sin, Fuzzy

Note: For most neurons, multiple inputs do not have idividual meaning and are aggregated with respect totheir weights (weighted sum is computed).

Neuron type How simulated

N and Nu(sigmoidneurons)

In each simulation step:

#define NEURO_MAX 10.0input=getWeightedInputSum();velocity=force*(input-state)+inertia*velocity;state+=velocity;if (state>NEURO_MAX) state=NEURO_MAX;else if (state<-NEURO_MAX) state=-NEURO_MAX;tmp=state * sigmo;

Nif (tmp<-30.0) output = -1; //safer than exp(-tmp) else output = (2.0/(1.0+exp(-tmp))-1.0); // -1..1

Nuif (tmp<-30.0) output = 0; //safer than exp(-tmp) else output = (1.0/(1.0+exp(-tmp))); // 0..1

state, velocity – internal variables• sigmo, force, inertia – neuron parameters (properties)• input, tmp – temporary variables•

D(differentiate)

Calculate the difference between the current and the previous input values.

Thr(threshold)

Outputs lo if the input signal is below the t threshold. Outputs hi otherwise.

t, lo and hi are parameters.

*(constantoutput)

Outputs the value of 1.

Rnd(randomnoise)

Outputs random values (uniform distribution) in the range of –1..+1

Sin(sinusgenerator)

The output sinusoid has frequency f and initial phase t. The output frequency dependson the neuron input value. Parameters:

f0 (base frequency). The output frequency f = f0 +current_neuron_input_value.

t (time) – initial phase.•

Fuzzy(fuzzy controlsystem)

See this paper for details; see this movie for demonstration.

4.2.2 The N neuron in detail

Sigmoid neurons (with short name N) use a simple weighted sum of input signals. Excitation influencesneuron state, which has some inertia. Stronger signals can change the state faster than weak signals. Output isflattened to a [-1,+1] range using basic sigmoidal function. See examples below: (input/state/output)

4 Simulation Details 6

Simple excitation. The state goes up when theinput is positive and falls down when theinput

reaches zero. Note that in this example theneuron's state can fall below zero due to its

inertia.

Short but strong impulse gives similar resultsto a weak and long one.

In this example a strong signal causessaturation of the neuron (its state goes very

high). Later signal changes do not influencethe output.

4.2.2.1 N parameters

The 'N' neuron has three properties (parameters) which influence its behavior:

Force, noted as 'fo', value range: 0..1, default 0.04• Inertia, noted as 'in', value range: 0..1, default 0.8• Sigmoid, noted as 'si', any real number accepted, default 2.0•

Force and inertia influence changes of the inner neuron state. In each simulation step, the neuron state ismodified towards the value calculated from input excitations. Force determines how fast the value is changed.Maximum value of 1.0 gives instant reaction. Low values, like the default (0.04) cause smooth 'charging' and'discharging' of the neuron. Neuron's inertia is similar to the physical inertia of a body: it sustains its statechange tendency. Low inertia values have very little influence on the state. Values near the maximum (1.0)can result in oscillations of the neuron state. The following pictures show sample usage of these parameters(input/state/output).

4 Simulation Details 7

Force=0.1, inertia=0Slow state change. Note the instant reaction after the input

signal pulse when inertia is disabled.

Force=0.1, inertia=0.8With inertia enabled, the neuron's state rises above the input

pulse amplitude, and then drops below zero. The final state isachieved after several oscillations.

Force=1, inertia=0Maximum force coefficient results in an instant input to output

propagation.

The third, sigmoid coefficient changes the output function. Detailed formulas which describe the work of theN neuron are as follows:

velocityt = velocityt–1 · inertia + force · (inputt – statet–1)

statet = statet–1 + velocityt

outputt =2

1 + e (-velocityt · sigmoid)

– 1

where

input: weighted sum of neuron inputs,velocity: analogous to physical velocity,state: internal state (analogous to physical location),output: output signal.Subscripts represent the time moment.

The following pictures show sample usage of the sigmoid parameter.

Sigmoid=2.0Default.

Sigmoid=10.0High values nearly produce a threshold function.

4 Simulation Details 8

Sigmoid=0.5Low values give a nearly linear output function.

4.3 Special neurons: muscles and receptors

Basic muscles (actuators) and receptors (sensors) are illustrated below.

A muscle neuron ('|' or '@' in genotype) can change the relativeorientation of the controlled stick (relative to the previous

stick).This simple 2-stick creature with a bending muscle in the

middle is described by the genotype "XX[|...]". The joint staysstraight when the signal is equal to 0. Positive and negative

values bend the constructon in the opposite directions.[animation]

The "G" receptor (gyroscope, equilibrium sense) givesinformation about the stick's orientation relative to thegravity force. A gyroscope mounted on a horizontallyaligned stick sends 0 to its outputs. Vertical position isperceived as -1 or +1 depending on which end is higher.[animation]

The "T" receptor (touch) can be imagined as a whiskerattached to the stick. Its relaxed state is -1 (nothingdetected in the whiskers' range). The signal value growsas the stick gets closer to any material object. Reaches 0when the stick touches the ground. Higher values meanthat the stick is pushed into the ground. [animation]

The "S" receptor (smell) excitation depends on the sum ofthe neighbor energy sources (energy balls and othercreatures). Output range is from 0 (nothing detected) to 1(maximum). Rich or closer energy sources smell 'stronger'than small or distant ones. [animation]

4 Simulation Details 9

4.3.1 Formulas for basic effectors and receptors

Neuron type How simulated

| (muscle)

[animation]

Changes the relative orientation of the joint's parts by rotating the second part around thefirst part's Z axis. Parameters:

p (power) – muscle strength. Affects the movement velocity and the maximumforce the muscle can exert.

r (range) – Affects movement range, maximal value 1.0 means full range(-180°..+180°). The following rule applies:

Angle = Range * Signal * 180°

Sample creature (f1 genotype XX[|])

//0p:p:1, m=2p:2j:0, 1, dx=1j:1, 2, dx=1n:j=1, d=|

Neutral positionSingal = 0Angle = 0°

Muscle activeSignal = 0.2Angle = 36°

Explanation: The joint is attached to parts #1 and #2. Part #2 was rotated around the Zaxis of Part #1, so its position and orientation was changed.

The above pictures were created using the "standard-xyz" OpenGL visualization style,which can be used to investigate part orientations in creatures.

@ (muscle) Changes the relative orientation of the joint's parts by rotating the second part around thefirst part's X axis. Parameters:

p (power) – muscle strength. Affects the movement velocity and the maximumforce the muscle can exert.

This musle always uses the full movement range (-180°..+180°).

4 Simulation Details 10

Angle = Signal * 180°

Sample creature (f1 genotype XX[@])

//0p:p:1, m=2p:2j:0, 1, dx=1j:1, 2, dx=1n:j=1, d=@

Neutral positionSingal = 0Angle = 0°

Muscle activeSignal = 0.25Angle = 45°

Explanation: The joint is attached to parts #1 and #2. Part #2 was rotated around the Xaxis of Part #1. Part #2 was not moved, because it lies on the X axis (in creatures builtfrom f1 genotypes, all parts lie on the X axis).

The above pictures were created using the "standard-xyz" OpenGL visualization style,which can be used to investigate part orientations in creatures.

G(gyroscope)

[animation]

state = (part1.z – part2.z) / stick_length

T(touch)

[animation]

if touches: state = distance of part and ground (which is equivalent to positivedepth)

if does not touch: check along x orientation of the partstate = –1.0 if there are no objects closer than 1.0 distance♦ state = ... (intermediate negative values)♦ state = 0.0 if a touched object is just at the T part♦

S(smell)

[animation]

state = (sum_all_energy_sources[ energy / distance2 ])/100(if distance<1, then use 1)

4 Simulation Details 11

Water(waterdetector /waterpressureindicator)

[animation]

above surface: state = 0.0• below surface: state = depth•

Energy(energylevel)

[animation]

state = 1.0 for initial energy level (a newborn organism)• state = ... (intermediate values)• state = 0.0 for no energy (creature dies)•

4.4 All neuron types: summary

N (Neuron)

Standard neuron

supports any number of inputs provides output value does not require location in body

Properties: Inertia (in) float 0..1 Force (fo) float 0..999 Sigmoid (si) float -99999..99999 State (s) float -1..1

G (Gyroscope)

Equilibrium sensor.0=the stick is horizontal+1/-1=the stick is vertical

does not use inputs provides output value should be located on a Joint

T (Touch)

Touch sensor.-1=no contact0=just touching>0=pressing, value depends onthe force applied

does not use inputs provides output value should be located on a Part

S (Smell)

Smell sensor. Aggregated"smell of energy" experiencedfrom all energy objects(creatures and food pieces).Close objects have biggerinfluence than the distant ones:for each energy source, itspartial feeling is proportionalto its energy/(distance^2)

does not use inputs provides output value should be located on a Part

* (Constant) does not use inputs

4 Simulation Details 12

Constant value provides output value does not require location in body

| (Bend muscle)

uses single input does not provide output value should be located on a Joint

Properties: power (p) float 0.01..1 rot.range (r) float 0..1

@ (Rotation muscle)

uses single input does not provide output value should be located on a Joint

Properties: power (p) float 0.01..1

D (Differentiate)

Calculate the differencebetween the current andprevious input value. Multipleinputs are aggregated withrespect to their weights

supports any number of inputs provides output value does not require location in body

Water (Water detector)

Output signal:0=on or above water surface1=under water (deeper than 1)0..1=in the transient area justbelow water surface

does not use inputs provides output value should be located on a Part

Energy (Energy level)

The current energy leveldivided by the initial energylevel.Usually falls from initial 1.0down to 0.0 and then thecreature dies. It can rise above1.0 if enough food is ingested

does not use inputs provides output value does not require location in body

Ch (Channelize)

Combines all input signals intoa single multichannel output;Note: ChSel and ChMux arethe only neurons whichsupport multiple channels.Other neurons discardeverything except the firstchannel.

supports any number of inputs provides output value does not require location in body

ChMux (Channelmultiplexer)

uses 2 inputs provides output value

4 Simulation Details 13

Outputs the selected channelfrom the second(multichannel) input. The firstinput is used as the selectorvalue (-1=select first channel,.., 1=last channel)

does not require location in body

ChSel (Channel selector)

Outputs a single channel(selected by the "ch"parameter) from multichannelinput

uses single input provides output value does not require location in body

Properties: channel (ch) integer

Rnd (Random noise)

Generates random noise(subsequent random values inthe range of -1..+1)

does not use inputs provides output value does not require location in body

Sin (Sinus generator)

Output frequency = f0+input

uses single input provides output value does not require location in body

Properties: base frequency (f0) float -1..1 time (t) float 0..6.28319

Delay (Delay)

uses single input provides output value does not require location in body

Properties: delay time (t) integer 1..1000

Nn (Noisy neuron)

Propagates weighted inputsonto the output, butoccassionally generates arandom value

supports any number of inputs provides output value does not require location in body

Properties: Error rate (e) float 0..0.1

Sf (Smell food)

Detects only food, not othercreatures(in experiments with food ingroup #1)

does not use inputs provides output value should be located on a Part

Thr (Threshold)

if (input>=t) then output=hielse output=lo

uses single input provides output value does not require location in body

Properties: threshold (t) float low output value (lo) float high output value (hi) float

4 Simulation Details 14

4.4.1 Experimental neurons

Do not use unless you know what you are doing. Some of these neurons can be unstable, many are used forspecial purposes.

Nu (Unipolar neuron[EXPERIMENTAL!])

Works like standardneuron (N) but theoutput value is scaledto 0...+1 instead of-1...+1.Having 0 as one of thesaturation states shouldhelp in "gate circuits",where input signal ispassed through orblocked depending onthe other singal.

supports any number of inputs provides output value does not require location in body

Properties: Inertia (in) float 0..1 Force (fo) float 0..999 Sigmoid (si) float -99999..99999 State (s) float -1..1

Fuzzy (Fuzzy system[EXPERIMENTAL!])

Refer to publicationsto learn about thisneuron

supports any number of inputs provides output value does not require location in body

Properties: number of fuzzy sets (ns) integer number of rules (nr) integer fuzzy sets (fs) string fuzzy rules (fr) string

VEye (Vector Eye[EXPERIMENTAL!])

uses single input provides output value should be located on a Part

Properties: target.x (tx) float target.y (ty) float target.z (tz) float target shape (ts) string perspective (p) float 0.1..10 scale (s) float 0.1..100 show hidden lines (h) integer 0..1 output lines count (each line needs four channels) (o) integer 0..99 debug (d) integer 0..1

VMotor (Visual-Motor Cortex[EXPERIMENTAL!])

Must be connected tothe VEye and properlyset up.

supports any number of inputs provides output value does not require location in body

Properties: number of basic features (noIF) integer number of degrees of freedom (noDim) integer parameters (params) string

Sti (Sticky[EXPERIMENTAL!])

uses single input does not provide output value should be located on a Part

4 Simulation Details 15

LMu (Length muscle[EXPERIMENTAL!])

uses single input does not provide output value should be located on a Joint

Properties: power (p) float 0.01..1

4 Simulation Details 16

5 Genotype encodings

The Framsticks simulator supports various genotype formats. A "format" is a language you can use todescribe creatures. The properties of this language are extremely important from the viewpoint of evolution. Ifyou are a Framsticks beginner, read about the f1 format first. For some people, the f0 format is even easier.

f0A low-level format which allows for building any creatures (leastrestrictive)

f1 An easy-to-use recursive language

f4Describes the way of growing an organism (developmental encoding).Learn about f1 before reading f4

f2 Describes how basic parts of an organism are joined

f3 Encodes f2 in "biological" genes with codons etc.

f5 A variant of f4

f6 Describes chemical/metabolic rules of growing

f7 Accepts any string of symbols, a "messy" genome

f8A parametric Lindenmayer system (L-system) - rules of body and braindevelopment

f0FuzzyUsed for the evolution of fuzzy control systems embedded in f0 genotypes(see this paper and this movie)

... other encodings are easy to add

The "Comparison of Different Genotype Encodings..." scientific paper contains more formal and detaileddescription of genetic formats, their properties, and mutation and crossover operators.

If you enter a genotype, you have to indicate its format. If it is, for example, f4, you should start the genotypewith /*4*/ prefix. For multiline genotypes (like f0), you can also use another style for such a prefix: //0. Ifthere is no format prefix, f1 is assumed.

Although some genotype formats may look complicated, they are easy to learn. Just open the "new genotype"window and experiment with genotypes. You can enter anything valid and get an immediate preview! Selectgenes to see which creature parts are created by these genes. Click on creature parts to see which genescreated them.

6 Genotype (format f0)

"Format Zero" genotype is the construction plan for any Framsticks creature. More detailed information onhow to use it for development of one's own stick objects is available in Framsticks SDK (Software DeveloperKit). See also the FRED program. Fundamental information is provided below.

6.1 f0 Syntax

Each line in f0 describes one object in the model. Lines starting with the '#' sign are considered to becomments and are ignored. The syntax is:

CLASSID:PROPERTY1,PROPERTY2,...

CLASSID - alphanumeric identifier of the class. Currently, there are four object classes (see f0 Semantics)

PROPERTY1,PROPERTY2,... - a set of properties of the object. Each class defines the sequence ofproperties and a reasonable default value for each one. The full definition of the property is NAME=VALUE.You can skip NAME= if the given property is next in the sequence. Object descriptions with omitted propertynames are not recommended as they may be misinterpreted by future GDK versions with different propertysets. There is an exception for easier editing: skipping inside the "natural" (= "unlikely to change") propertysequences like x,y,z is allowed, you can write "x=1,2,3" instead of "x=1,y=2,z=3". (Such exceptionalproperties are marked by flag 1024 in the property definition, see Param::flags(int i) ). You can also skip thewhole definition of a property and accept the default value. If you want to pass special characters (for ex. acomma) or set the empty string value (""), VALUE can be placed between quotes (").

Examples

Let's assume the following class definition: CLASSID=ob and four properties with default values: a=0, b=1,c=2, d=3

Some valid f0 descriptions:

all properties are set explicitly ob:a=9,b=8,c=7,d=6

you can omit property names if the sequence is obeyed ob:9,8,7,6

some properties have no names, but they are deduced from the sequenceob:d=6,a=9,8,7

"b" and "c" are not defined – default values will be used (b=1,c=2) ob:9,,,7

b="", c=2 ob:9,"",,7

b="," (comma), c=2 ob:9,",",,7

default values used for "a","c" and "d" ob:b=8

default values used for all properties ob:

6.2 f0 Semantics

Parts, Joint and Neurons have reference numbers used to attach other objects. References start with 0 andevery new object in the class gets the next reference number.

6.2.1 Part object

Creates instance of the Part object.

CLASSID=p:• x=0,y=0,z=0 - position in 3D• rx=0,ry=0,rz=0 - 3D orientation (amount of rotation around each of 3 axes)• m=1 - physical mass• s=1 - size (for collisions)• dn=1 - density• fr=0.4 - friction• ing=0.25 - ingestion• as=0.25 - assimilation• i="" - general purpose "info" field•

The Part's position and orientation can be overriden by a joint definition using the "delta option". In this case,you can skip x, y and z in the part definition (see f0 Examples).

6.2.2 Joint object

Creates instance of the Joint object.

CLASSID=j:• p1=-1,p2=-1 - ref.numbers of the two connected parts. Note that the default -1 is illegal here, youmust not omit these properties. Both parts have to be created earlier.

rx=0,rx=0,rz=0 - rotation: can be used to enforce specific orientation of the second part (p2) relativeto the first part (p1). Orientation can influence some of the effectors/receptors and can be used asgrowing direction while creature is being constructed.

dx=?,dy=0,dz=0 - delta option: if you specify any value for dx, all three deltas are used asdisplacement applied to the second part (p2) relative to the first part (p1). Local coordinate system ofp1 is first rotated (as defined by [rx,ry,rz]) and then translated by [dx,dy,dz]. This technique allowsyou to define relative placement of parts. Without this delta option, absolute part positioning is used(as defined by the coordinates [x,y,z] of the part).

stif=1 - stiffness• rotstif=1 - rotation stiffness• stam=0.25 - stamina• i="" - general purpose "info" field•

6.2.3 Neuron object

Creates instance of the Neuro object.

A signal processing unit, sensor, or effector. Neuron reference number is used in f0docneuroitem definition.

6 Genotype (format f0) 19

CLASSID=n:• p=-1 - ref.number of the part the neuron is attached to (the part has to be created earlier).• j=-1 - ref.number of the joint the neuron is attached to (the joint has to be created earlier).• d - neuron class description, like "classname:properties_and_values"• i="" - general purpose "info" field•

6.2.4 Neuron input definition (connection)

Add input to the neuron = weighted connection to the other neuron. Both objects must be already created.

CLASSID=c:• n - ref.number of the parent neuron• i - ref.number of the neuron to be connected as the parent's input• w=1.0 - connection weight (optional)•

6.3 Model validity constraints

at most one joint can directly link two parts• each joint must be connected with two distinct parts• all parts must be directly or indirectly connected with each other• delta joints must not form cycles• for each joint, the part-to-part distance must not exceed the value defined as the maximum Joint.dx(2.0)

6.4 f0 Examples

To see these in Framsticks application, you have to start writing f0 genotype with "//0" (two slashes and zeroand new line). The shortest f0 genotype is a single Part:

p:

A single stick, "X" in f1

p:p:1j:0,1

Three sticks in line, "XXX" in f1, no "delta option" - absolute coordinates used in all parts

p:p:1,m=2p:2,m=2p:3,j:0,1j:1,2j:2,3

Three sticks line, "XXX" in f1, with "delta option" - relative positioning (dx=1)

p:

6 Genotype (format f0) 20

p:m=2p:m=2p:j:0,1,dx=1j:1,2,dx=1j:2,3,dx=1

Three sticks star (120 degrees), "X(X,X)" in f1, no delta option, absolute coordinates are awkward and thesticks' length cannot be seen

p:p:1, m=3p:1.50017, -0.865927p:1.50017, 0.865927j:0, 1j:1, 2j:1, 3

Three sticks star (120 degrees), "X(X,X)" in f1, using delta option, dx=1, note that 120 degrees / 2 = 1.047 rad

p:p:m=3p:p:j:0, 1, dx=1j:1, 2, rz=-1.047, dx=1j:1, 3, rz=1.047, dx=1

Neuron net example, "X[|G:1,1:2.3][@-1:3.4,0:4.5,T:5.6]" in f1

p:p:1j:0, 1, dx=1n:p=1n:j=0, d="|:p=0.25,r=1"n:j=0, d=Gn:p=1n:j=0, d=@:p=0.25n:p=1, d=Tc:0, 2c:0, 3, 2.3c:1, 0c:3, 0, 3.4c:3, 3, 4.5c:3, 5, 5.6c:4, 3

Cyclic structure, parts are connected 0->1->2->3->0. Not possible in f1 or f4 formats.

p:0,0p:1,0p:1,1p:0,1j:0,1j:1,2j:2,3j:3,0

6 Genotype (format f0) 21

7 Genotype (format f1)

7.1 Creature body

Two basic symbols are:X – stick,• () – branch.

The body structure is built like a tree: new sticks are joined with ends of the previous ones.

X(X,X) means two sticks from one-stick root,• X(X,X,X) means three sticks from one-stick root,• X(X,X,) is also possible, as well as• X(,X,,,X,,X,,)

Inside parenthesis, the full angle is divided into as many parts as there are commas+2, and each stick insuch a 'junction' has as much freedom.

Modifiers (special characters) can be placed before X's and ('s. They affect the following X and, usuallyless and less, further following X's. Modifiers modify stick position and its features. Big and small letterscan be used; big letters increase the given property while small ones decrease it.

Modifiers: Rr, Qq, Cc, Ll, Ww, Ff, Aa, Ss, Mm, Ii, Ee.

Sticks' joints properties

R rotation (by 45 degrees) – this modifier DOES NOT affect further sticks

Q twist

C curvedness

Physical properties

L length

W weight (in water environment light sticks swim on the surface)

F friction (sticks will slide on the ground or stick to it)

Biological properties (mutually exclusive)

A assimilation = photosynthesis (a vertical stick can assimilate twice as much as a horizontal one)

Sstamina (increases chance of survival during fights, see also simulator parameters – destructivecollisions)

Mmuscle strength, a.k.a. muscle speed (strong muscles act with bigger force, gain higher speed, can resistbigger stress, and use more energy)

I ingestion (ability to gain energy from food: energy balls or dead corpses)

Other

Eenergy (experimental).Creature's starting energy can be higher or lower when 'E' or 'e' is used. Youshould use it only when the "energetic efficiency mode" is enabled (see simulator parameters).Otherwise, disable 'eE' modifiers in genetic parameters!

7.1.1 Examples

XXX(XX,X)

X(X,RRX(X,X))

XlCXlCXlCX

Some more samples of possible structures:

7 Genotype (format f1) 23

7.2 Creature brain

Neurons are placed in [], after X's. The following information can be supplied inside square brackets:

neuron type• properties (parameters) of the neuron• inputs of the neuron (if it can have inputs)•

The syntax is:

[ NeuronType,PropertyAndInputList ] where PropertyAndInputList is a comma-delimited list of pairsPropertyName:Value and NeuronInput:Weight. If NeuronType is omitted, 'N' (standard neuron) is assumed.

Neuron inputs can be taken from different signal sources: other neurons' outputs or receptors. A neuroninput can also have a constant value. If a neuron is a muscle, it can control its stick's bend or rotation.

The alternative (old, deprecated) syntax lets you describe two neurons (a muscle and 'N') in one:

[ MuscleTypePropertyAndInputList ] where MuscleType is either '@' (stick's rotation) or '|' (stick bend).This old syntax creates a 'N' neuron, as described in [...], and a muscle of MuscleType with input fromthat neuron. Thus the old syntax is equivalent to[ N, PropertyAndInputList ] [ MuscleType, -1:1 ]

In the old genotypes, you could find names of 'N' properties noted as symbols !=/. They are deprecated,and equivalent to:

'!' [exclamaton mark] – force (present property name: 'fo')• '=' [equals] – inertia (present property name: 'in')• '/' [slash] – sigmoid (present property name: 'si')•

(see also the Simulation details section)

7.2.1 Examples

Enter these genotypes into Framsticks to see the corresponding neural networks.

X[N]• X[@]• X[@][N]• X[@,1:1.0][N]• X[1:1.0][-1:2.0]• X[1:1.0][G:2.0]• X[N,fo:1,si:-4]• X[Sin,f0:0.1,t:0.5]•

7.2.2 Examples of the old, deprecated syntax

... X[@-1:2,1:3] ...means that a stick has one neuron 'in' it. It controls the stick's rotation (@), and the neuron has two inputs:

7 Genotype (format f1) 24

one comes from -1 relative position in the genotype, the other from +1 rel. position. The first 'signal' weightis 2, the other is 3.

X[|*:1,G:2]is a stick with one neuron controlling its bend, having two inputs: one constantly equal to 1 and the otherconnected to a gyroscope (placed on the stick) weighted 2.

One stick can have many neurons – X[.....][.....][.....]

Example:X X[|0:1] X[@-1:1.2,1:2.3][G:1]

neuron (1) affects stick's bend and is looped recursively• neuron (2) affects stick's rotation, and receives signals from neurons (1) and (3)• neuron (3) has one input: gyroscope (equilibrium sense of the last stick)•

7 Genotype (format f1) 25

8 Genotype (format f4)

This encoding scheme is an indirect developmental encoding, devised by Adam Rotaru-Varga.

Contents:

OverviewThe developmental processThe minimal exampleTwo-sticks exampleGenetic codesOperatorsExamplesLinks / References

8.1 Overview

The f4 encoding resembles the f1 encoding, with an important conceptual difference: f1 is composed of codeswhich are interpreted as structural elements (sticks, neurons), or their attributes. On the other hand, f4 codesare interpreted as instructions to cells. An f4 genotype describes the developmental process of an organism.Development starts with a single ancestor cell, which starts to execute instructions from the start of the geneticcode. As the cell divides, new cells are created, which execute different instructions in parallel(differentiation). The development stops when all cells mature, and the final shape of the creature is the resultof the whole development process.Developmental encoding models biological growth of an individual. Some features of a developed creatureare not encoded by a particular gene, but by an interplay between developing parts. These interactions aremodeled during the development process.

The developmental process. A developing creature is composed of interconnected cells. A cell is either astick, or a neuron, or still undifferentiated -- this is the type of the cell. Undifferentiated cells can turn into astick or neuron (as a result of developmental instructions), but not the other way around.Development starts with a single, undifferentiated ancestor cell, executing the start of the genotype.During each step, each cell executes one (or more) instructions, in parallel. A new step is started whenever adivision or a change in type occurs. Development stops when all cells stop changing. At this point, thereshould be no undifferentiated cells.

The minimal example. The minimal f4 genotype looks like this: '/*4*/ X' (ex0). This says to the ancestor cellto turn into a stick (X), and stop development. The end result is a single stick -- corresponding to f1 genotype'X'.

Two-sticks example. /*4*/ <X>X (ex1). This looks more interesting: '&lt'; denotes cell division. It will createtwo cells, the first will execute the instruction immediately following the '<', while the other will execute theinstruction after the corresponding '>'. Now, it looks like '<' and '>' act like parantheses, but that's onlysuperficial. In fact, '>' means 'stop development'.The exact process looks like this:.step 0. Initially, there is the ancestor cell, no 1, undifferentaited.step 1. cell 1 executes '<' (division), creates cell 2 undifferentaited.step 2. cell 1 executes 'X', turns into a stick.(cont) cell 2 executes 'X' (the other one), turns into a stick.step 3. cell 1 executes '>' -- stops development.(cont) cell 2 stops development.

The end result is two connected sticks, the same structure created by f1 genotype 'XX'.

8.2 Details

An f4 genotype is identified by the prefix '/*4*/ '. This is not part of the genotype, but a comment identifyingthat it is of type f4.

Most f4 codes are one-letter codes, with some exceptions. An f4 genotype is expressed as a string of codes.However, because division branches the sequence of instruction in two, the genotype can be conceptualised asa binary tree of codes. The string representation corresponds to a pre-order traversal. (Note that an f1 can beconceptualised as a tree as well.)

Codes are the following:

'<' Division. Creates a new cell. The new cell will be connected to the old one. This is the only way ofcreating a new cell.After division, the two cells will execute different codes. The '<' is followed by the codes executed by the firstcell (ending in a '>'), and then the codes to be executed by the second cell. Thus the code to be executed by thesecond cell can be found after the corresponding '>'. Note that both code sequences can contain furtherdivisions. The general form is:< ...cell 1 code... > ...cell 2 code... >If there are n divisions in a genotype, they will create n+1 cells. This also means n+1 cell-stop markers '>'.However, the very last '>' can be omitted. This is because the last stop is not followed by anything else, and tohave an equal number of '<' and '>' codes.Example: <LL<X>X>llX (ex53)In this case, after the first division, the first cell will continue with the 'L' (pos 2.), while the second, freshlycreated cell with the 'l' (pos 9).Usually undifferentiated cells divide, and later differentiate into sticks or neurons. However, a neuron candivide, and in this case the new cell will be a neuron as well, with the same characteristics as the old cell.Existing links are also duplicated. Sticks cannot divide.

'X' Turn into stick. Turns the cell into a stick. The cell must be undifferentiated. It will remain a stick, sincea stick cannot change its type (nor divide).

'N' Turn into neuron/muscle. Turns the cell into a neuron. The cell must be undifferentiated. It will remain aneuron, since a neuron cannot change its type.

'>' Stop development of cell. Cell should not be undifferentiated. This symbol also has the role of adelimiter.

',' Increase branching angle (comma). Increase the branching count (angle) of future divisions. Changestakes effect when the dividied daughter cell turns into a stick. Cell can be undifferentiated or a stick. Example:ex3.

'L'/'l' Increase/decrease length of stick. L: increases length by 0.3*(2.5-len). l: decreases length by0.3*(len-0.3). Works with sticks and undifferentiated cells.

'R'/'r' Increase/decrease rotation by 45 degrees. Works with sticks and undifferentiated cells.

'C'/'c' Increase/decrease curvedness.

'Q'/'q' Increase/decrease twist.

8 Genotype (format f4) 27

Neural parameters can be modified by a sequence of increasing/decreasing codes. (Note that in f1 these are setusing concrete numerical values.) These codes are of the form ':X+:' or ':X-:' for increasing and decreasingrespectively ':!+:' Increase neural force, by (1.0 – force) * 0.2.

':!-:' Decrease neural force, by force * 0.2.

':=+:' Increase neural inertia, by (1.0 – inertia) * 0.2.

':=-:' Decrease neural inertia, by inertia * 0.2.

':/+:' Increase neural sigmoid value, multiply by 1.4.

':/-:' Decrease neural sigmoid value, divide by 1.4.

'[...:...]' Add a neural link. Adds a neural link to a neuron (cell must be neuron). The format is: '[' (input link)':' (weight) ']'.Input link is an integer number, interpreted as the relative reference to the neuron where the link is originating.1 means the 'next' neuron, -1 the previous, 0 this one, 3 three from here on, and so on. Note that relativereferences are based on the current structure, and not the final one!There are special input codes for senses: 'G' for gyroscope (adds a gyroscope sense to the stick the neuron isconnected to), 'T' for touch sensor, and 'S' for smell sensor.The weight is a real number representing the weight of the link. Examples: ex9, ex11.

'|' Turn into a bending muscle. Turns the cell into a bending muscle. The cell must be a neuron. Examples:ex10, ex51.

'@' Turn into a rotating muscle. Turns the cell into a rotating muscle. The cell must be a neuron. Examples:ex11, ex52.

Codes that affect biological properties:

'A'/'a' Increase/decrease assimilation.'I'/'i' Increase/decrease ingestion.'S'/'s' Increase/decrease stamina.'M'/'m' Increase/decrease muscle strength.'F'/'f' Increase/decrease stick strength.'W'/'w' Increase/decrease stick mass.'E'/'e' Increase/decrease stick energy.

'#' Repetition marker. This code allows certain other codes to be repeated more than once. The explanationof this code requires certain general details, left out from the discussion so far for the sake of clarity. Thiscode is quite tricky, but it is also powerful: it can create repetitions of the same codes (and thus substructures)withouth the dupication of the codes themselves.Each cell has a pointer to the currenty executing code. But they have another pointer, which is the 'to repeat'pointer. They also have an associated 'to repeat' counter. The '#' code creates a branching in the genotype tree,much like the '' as well: if the repeat counter is 0, it means regular 'stop', as described above. However, if thecounter is not 0, it is decremented, and if it still not zero, the cell 'jumps' back to the repeat pointer. If therepeat counter gets to 0, the second child of the '#' is executed to finish off.What all this means is that a genotype of the form#n ...repcode... > ...endcode...means that the repcode part will be repeated n times, and the endcode once in the end.There's one more detail: when a cell divides ('new cell inherits the repeat counters, and not the old one. Thus

8 Genotype (format f4) 28

only one cell will continue the repetition.Examples: ex8a, ex15. ex16. ex17.

8.3 Genetic operators

Mutation produces some localised changes in an f4 genotype. Mutation operates on the tree representation ofa genotype. A single mutation can change a code, change a parameter of a code, add a new code (division,neural link, repetition marker, or simple code), or delete a code. A mutation operator can consist of severalsingle mutations. The amount of change of a mutation is estimated from the ratio of number of changed codesand total number of codes.

Crossover operates on f4 genotype trees, and exchanges two subtrees of two genotypes. The size of thesubtrees varies, between 10 and 90 percent of the genotype.

8.4 Examples

exampleno.

f4 genotype corresp. f1 genotype (approx) description

ex0 X X a single stick

ex1 <X>X XXtwo sticks connectedone-after-the-other

ex2 <<X>X>X X(X,X)two sticks connectedto the same third one(branching)

ex3 <,<,,<,X,,>X>X>X X(,X,,,X,,X,,)a 3-way branchingwith differentbrancing angles

ex4 <X><X><<X>X><X>X XXX(XX,X) more branching

ex5 <<X><<X>X>X>X X(X,X(X,X))more complexbranching

ex6 <X>l<X>l<<X>X>LLLX XlXlX(LLLX,X)different lengthfactors

ex7 <<X>RR<<X>X>X>X X(X,RRX(X,X))branching withrotation R

ex8a #3<X>lC>X XlCXlCXlCX repetition, C

ex8b <X>lC<X>lC<X>lCX" XlCXlCXlCX curvedness C

ex9 <X><N[1:2]>N[-1:3] X[1:2][-1:3]

a stick with twoneurons attached toit. The two neuronsare connected toeach other

ex10 <X><X><N|[1:2]>N[-1:3.5] XX[|1:2][-1:3.5]a structure with twoneurons and abending muscle

ex11<X><<,<X,><N@[1:20]>N[G:30]>X>X

XX[@1:20][G:30](X,,X,)a structure with arotating muscle anda gyroscope sense

ex12 <X>N|[*:1][G:2] X[|*:1,G:2]

8 Genotype (format f4) 29

a stick with abending muscle

ex13 <X>N<[*:0]>[-1:10]<> X[*:0][-1:10][-2:10]duplicating linksupon neuron division

ex14<X><<X>N|[0:1]><X><N@[-1:1.2][1:2.3]>N[G:1]

XX[|0:1]X[@-1:1.2,1:2.3][G:1]various neurons andlinks

ex15 #10,<<X>X>>LLXX(,,X(,,X(,,X(,,X(,,X(,,X(,,X(,,X(,,X(,LLX,X)X)X)X)X)X)X)X)X)X)

repeating division 10times

ex16 #10,<<X><<X>X>X>>LLX

X(,X(,X(,X(,X(,X(,X(,X(,X(,X(,LLX,X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X)),X(X,X))

even morerepetitions

ex17 rr<X>#9<,<X>RR<<llX>LX>LX>>X

rrXX(,X(,X(,X(,X (,X(,X(,X(,X(,X,llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX)),llRRX(LLX,LLX))

a worm-likecreature, composedof repeated identicalsegments ('kukac')

ex51 <X><X>N| XX[|] /* ?? */two sticks and abending musclebetween them.

ex52 <X><X>N@ XX[@] /* ?? */two sticks and arotating musclebetween them.

ex53 <LL<X>X>llX LLX(llllLX,X)3 sticks in a Yformation

Related links

f1 genotype format• All Framsticks genotype languages•

8 Genotype (format f4) 30

9 Simulation Parameters

If you need help, read the hints (tooltips) which appear when you stop the mouse pointer over a name of aparameter in the program. Documentation below is provided in addition to those hints and discusses onlysome issues.

See also:

Tips for usersInterfaceInterface parameters

This page:

ExperimentFilesError reportingWorldGeneticsUser scriptsNeurons

9.1 Experiment

Experiment definition: choose experiment definition which controls behavior of the Framsticks system. It is ascript file with the ".expdef" extension. All available experiment definitions are summarized here. Advancedusers can create their own experiment definitions and thus exploit the full potential of the system. Press"Apply" each time you change the experiment definition.

Parameters of the standard experiment definition are available here (see also tips).

Two experiment definitions more:

standard-log.expdef in scripts_sample subdirectory (provided as an example of logging all geneticoperations).

standard-tricks.expdef in scripts_sample subdirectory (provided as an example of complex fitnessfunctions with customized performance measurements, and changing creature locations during theirsimulation).

Initialize experiment: perform initialization actions for the selected experiment definition (for example, createappropriate gene pools and populations, clear them, insert the initial genotype, reset counters, etc.). It isrecommended to perform initialization before running an experiment.

Experiment: Gene pools: <gene pool name>

An experiment definition may group genotypes into "gene pools". Each of them has separate settings. Settingsaffect all genotypes belonging to a given group (gene pool).

Fitness formula: advanced users can enter a custom fitness formula here. For the "standard" experimentdefinition, the formula is automatically created when you change weights of fitness criteria, and it reflects

those settings.

Scale fitness?: if turned on, fitness is modified linearly according to the scaling rules. Thus final fitness iscomputed, which is equal to:

1.0 for creatures with average fitness• 0.0 for creatures with fitness less or equal to the value of (average fitness – Shift coefficient *standard deviation of fitness)

Scaling coefficient for creatures with maximal fitness.•

Experiment: Populations: <population name>

An experiment definition may group simulated objects into "populations". Each of them has separate settings.Settings affect all individuals/objects which are simulated and belong to a given group (population).

Energy calculation: calculate energy balance during simulation?

Death: remove objects when their energy reaches 0 (creatures die)?

Neural net simulation: after a creature is put into the world, activate its neural network

Off – don't simulate neural networks at all• Immediately• After stabilization – start brain simulation when the creature completely stops (all initial vibrationsstop).

Performance sampling period: especially important for estimating distance and velocity. Low values causevibrations/little movements to be counted as velocity. High values let only smooth, straight moves to becounted.

Performance calculation: after a creature is put into the world, calculate its performance

Off – don't calculate at all• Immediately• After stabilization – count measurements when the creature completely stops (all initial vibrationsstop).

NOTES. If you want to evolve quick creatures, calculating their speed including the result of falling downand turning over would be unfair. This is why "delay for stabilization" may be introduced. Otherwise,creatures could gain additional ("unfair") fitness bonus because of their initial position (creatures fall onto theground and earn speed without using neurons).

Speed and movements are measured using center of gravity position.

Consider the following special (educational) situations. (1) When a creature waits for stabilization, otherliving and active creatures may push it and move it, so that it cannot stabilize. (2) When you set immediatesimulation of neural network and after-stabilization performance calculation, a creature might start movingimmediately and would never stabilize. Thus performance and energy wouldn't be calculated, and such acreature would live forever as long as it kept moving. (3) In water environment, stabilization may be difficultto achieve.

9 Simulation Parameters 32

Muscle static work, Muscle dynamic work, Assimilation productivity: these settings influence energy balance.When non-zero values are used, creatures may spend more energy than Idle metabolism, and can gain energyby assimilation.

9.2 Files

Save backup: if you set this value to a number N>0, the simulator writes an EXPT (experiment state) fileevery N events. An "event" is triggered by an experiment definition. With the "standard" experimentdefinition, an event occurs after a creature dies and its genotype's performance is updated. Names forsuccessive autosave files are generated automatically by adding numbers to the last filename you used whensaving the EXPT file. For example, when you save an experiment state under the filename speed1.expt, andset this parameter to 250, you will get the files speed1_001.expt, speed1_002.expt, and so on. Each file (log)will be saved after evaluating 250 creatures.

Overwrite: if not set, the simulator will change filenames if needed so that it will not overwrite old files.

Show file comments: comments from loaded files will be displayed in the messages window.

9.3 Error reporting

Choose level of details for messages in the Messages window. Decide when genotypes/creatures are checkedagainst errors.

Fail on warnings: some genotypes cause problems when they construct creatures. They are valid syntactically,but warnings are generated while a creature is built from such a genotype. These warnings are called "buildproblems", and an example of this situation is when a genotype provides many identical muscles in the sameplace in the body. This is not allowed, and thus some muscles are disabled (which causes warnings).

If you enable "Fail on warnings", such genotypes will not be simulated, only those that are entirely correct.Otherwise, genotypes with build problems (after they are fixed) will also be simulated.

9.4 World

Type: For 'Blocks' and 'Height field' you have to provide a "map" of heights. 'Height field' world has smoothslopes.

Size: Side length of the (square) world.

Map: description of world heights, it can be:

randomly generated world: r (size1) (size2) (seed)size1,size2 are number of blocks in west-east and north-south direction. seed can be omitted, fordifferent numbers you get different worlds.

custom layout: m (size1) (size2)followed by world map (size1*size2 digits)5 means 'level zero' block height, 6-9 is a 'hill', 1-4 is a 'hole'example (a cross-shaped hill):

m 3 3 575 777 575

9 Simulation Parameters 33

additional characters "-" and "|" are slope surfaces between blocks ("-" is WE direction, "|" is NSdirection). They are valid only between digits and only for 'Blocks' world type.more sophisticated example:

m 5 5 22-66 222-6 2|333 -6-33 4|498

custom layout: M (size1) (size2)works just like 'm', but you can use floating point numbers instead of digits (so you can use 5.35, notjust 5). Note that with 'M', the value of 0 means 'level zero' height, which is different from 'm'convention.

Water level: the main surface is at 0.0 height and you set the water level here.

Boundaries: what happens when a creature crosses the boundary of the world?

None – the world is unlimited,• Fence – creatures cannot go outside,• Teleport – creatures are moved to the opposite side when trying to cross the border.•

9.5 Genetics

Remember history...: the history of genetic operations (which genotype is mutated from which, whichgenotype was crossed over with which, etc.) is remembered so that you can draw a tree of evolution. Suchhistory can consume large amounts of memory when it contains many (for example, tens of thousands)genotypes.

Genetics: Neurons to add

Checked neurons are those which may be introduced into genotypes during mutations. Note: these settingswork for f0 and f1 genotype formats, and not (yet) for f4. f4 uses "NGTS*|@" neuron set.

Genetics: f0

Relative mutation probabilities for f0 genotype language.

Genetics: f1

Settings for f1 genotype language.

Excluded modifiers let you disable using some genotypic symbols during mutations: you can prevent somefeatures from being present in the evolved genotypes. Excluding 'E' and 'e' is needed when energeticefficiency mode is disabled (so that the creatures will not change their starting energy). And, for example, ifyou don't want your creatures to use different sticks' weights to improve swimming ability in water, exclude'W' and 'w'.

Proportional crossover: when turned off, random substrings of two parent genotypes are exchanged to formtwo offspring genotypes (in two-point crossing over). When turned on, cut points in the second parent will beselected proportionally (based on neural genes) to the cutpoints chosen randomly in the first parent. Thus, if

9 Simulation Parameters 34

both parents have the same number of neurons, then this will be preserved in their children. If, additionally,both parents have identical bodies and neural genes are aligned in both parent genotypes, then their childrenwill also have identical bodies. This may be important if you perform crossover only within species (amongsimilar genotypes – individuals).

Genetics: f1: Morphology contains detailed mutation probabilities concerning physical structure parts ingenotypes. Genetics: f1: Neuron net contains detailed mutation probabilities concerning neuron net parts ingenotypes.

Genetics: f4

Detailed mutation probabilities concerning f4 genotype language. When mutation occurs, it can be either Addnode, Delete node, or Modify node. Values expressing probabilities can be adjusted here. Mutation types areshown below.

Add nodeAdd division♦ Add neural connection♦ Add neural parameter♦ Add repetition♦ Add random symbol♦

Delete node• Modify node•

The number of codes which are randomly mutated is also random, varying from 0% to 25% of the genotypegenes.

Genetics: Similarity

Determines how the dissimilarity of two genotypes is evaluated. This is important during crossing over, whichcan depend on the dissimilarity of the two parent genotypes (and can make crossing over of differinggenotypes impossible). Similarity can also be involved in fitness reduction for speciation and creating niches.Enter weights for genotype/phenotype criteria concerning 'body' and 'brain'. Refer to scientific papers (a draftfrom Theory in Biosciences 120, or a LNCS paper) for the idea of dissimilarity computation method (sincepublication time, the procedure has been updated in minor details). Dissimilarity is also used for clustering ofindividuals using UPGMA method.

Genetics: Conversions

Specific converters can be enabled and disabled here. They convert various formats of genotypes. Unless youare an experienced user, leave all of them enabled.

9.6 User scripts

These scripts are loaded automatically from the "scripts" subdirectory. Advanced users can create their ownscripts.

9.7 Neurons

Neurons: Simulation

9 Simulation Parameters 35

Random initialization: if set to zero, neuron states are equal to zero when each individual is created from itsgenotype and put into the simulator. If you enter a positivie value, neural states are random, and thus NNcontrol has to be more robust (and does not depend on specific initial state values).

Neurons: Active

These settings decide which neurons are simulated in creatures. If a neuron is inactive, its state is initializedwhen a creature is 'born', and then the state does not change.

9 Simulation Parameters 36

10 "Standard" experiment definition: parametersreference

This is the basic experiment definition, which can be used to perform a range of common experiments.Advanced users can create their own experiment definitions.

Genotypes are stored on the genotypes list. The main idea of this experiment is to evaluate them and createnew, probably 'better' ones. Every entry on the genotypes list represents a group of identical genotypes.

There are two main parameters of the system architecture: the capacity of genotypes list (N) and the capacityof the virtual world (n). The main routine schedules an individual (a genotype) to the world simulator in orderto test it (when there is a free space there, it is, when the number of simulated individuals is less than n). Afterits death the fitness value is calculated (see: Parameters: Fitness).

Note that when n=1,there are no interactionsbetween simulatedcreatures and the systemperforms like a typicalevolutionary algorithm,where the fitness of anindividual does notdepend on the otherindividuals.

"standard.expdef" system architecture.See animation.

10.1 Tasks performed in each simulation step

if needed, create new creatures in the world (depends on 'simulated creatures' settings – n)• if population on the genotypes list exceeds 'capacity' (N), some genotypes have to be deleted (seeparameters below)

calculate next step in a 3D world simulation (muscles and neurons: new positions, forces, excitationsetc.)

calculate energy flow• if some creatures run out of energy, "kill" them and update the genotypes' performance.•

Shortcuts for this page:

Parameters

SelectionFitnessEnergy

See also:

General simulation parameters

10.2 Parameters

Initial genotype: the genotype placed in gene pool when the "Initialize experiment" action is called.

Gene pool capacity: the maximal number of genotypes (including copies) in the gene pool.

Delete genotypes: which genotypes will be deleted when capacity limit is reached:

Randomly• Inv. proportional fitness (Better fitness = lower chances for deletion)• Only the worst (remove the one with minimal fitness)•

Simulated creatures: the number of creatures automatically put into the simulated world.

Reset performace data: sets "copies" count to zero for each genotype. Thus performace values aremeaningless, and first genotype evaluation (and performance averaging, when copies will turn to 1) willoverride them.

Parameters: Selection

How to choose genotypes for simulation, and how to modify them. Enter how many genotypes relatively willbe

Unchanged – the new genotype is a copy (clone) of the existing (selected) one• Mutated – the new genotype is a mutation of the existing (selected) one• Crossed over – the new genotype is a crossover of the existing (selected) two•

Minimal similarity: Only the genotypes that are less dissimilar (i.e. more similar) than the given threshold canbe crossed-over. This disables breeding of totally different genotypes, whose offspring would probably beinefficient/unable to live. See also Genetics: Similarity.

Parameters: Fitness

These parameters describe how the genotypes' fitness is calculated. Fitness is the weighted sum of criteriashown.

Velocity and Distance are calculated from creature's center of gravity position measured during its lifetime.

Turn on criteria normalization to have the criteria normalized to the interval [0,1] before weighting.

Use similarity speciation to reduce the fitness of genotypes in the gene pool according to their pairwisephenotypic similarity. Note that this operation is time consuming, and requires n2/2 dissimilarity computationsevery time the gene pool contents changes. See also Genetics: Similarity.

Parameters: Energy

10 "Standard" experiment definition: parameters reference 38

Starting energy: new creature's starting energy (per one stick). This parameter is the base energy value whenno energy modifiers ('E'/'e' genes) are used. Such genes modify the actual energy relative to this setting.

Idle metabolism: energy requirement for one living stick per one simulation step.

Automatic feeding: a given number of energy balls will be placed randomly in the world all the time.

Ball's energy: amount of energy in one ball.

Ingestion multiplier: how fast a creature can ingest energy.

Aging time: When apositive value is set,energy consumption(Idle metabolism) growsnon-linearly with lifetime (see picture below).This setting can be usedto stop creatures whichingest more energy thanthey spend from livingforever.

10 "Standard" experiment definition: parameters reference 39

11 Tips on evolution design, parameters, etc.

Framsticks has a powerful, flexible simulator capable of performing various evolutionary processes. Here youwill find help concerning setting simulation parameters and general tips on evolutionary process design. Thetext below concerns the "standard" experiment definition only. Other experiment definitions can be used,extended or developed.

The first question you have to answer is whether you want to simulate a directed or a spontaneous evolution.If you want to run a directed evolution, you will have to explicitly define the fitness criteria used forevaluating of evolved creatures. The simulator will select creatures which are better according to the criteriayou choose. You may try to run some kind of a spontaneous evolution, where you will have to define the rulesof living/survival of virtual creatures, and use life span as the selection criterion. Thus the life span will serveas an estimate of reproductive abilities of creatures. A better realization of a spontaneous evolution isavailable within the reproduction.expdef experiment definition.

11.1 Directed evolution

When performing a directed evolution, the user has to choose the optimization criteria explicitly. This isgenerally set in the Experiment | Parameters | Selection window. There you set weights for all the criteria. Forexample, if you set all the weights to zero except "Structure size", the fitness of creatures will correspondexactly to their size. Thus during the evolution bigger creatures will be selected more often than smaller ones.All other fitness criteria of creatures will be ignored.

You can choose many criteria with different weights. You can even use negative numbers. For example,setting "Velocity" to a positive number and "Structure size" to a negative number causes a preference for fast,but small creatures. Of course you have to carefully adjust the actual weight values so that the proper tradeoffis maintained. Setting the "Lifespan" criterion to a non-zero value simulates a spontaneous evolution and youshould read the "Spontaneous evolution" section (below).

It is important to consider turning on the scaling mechanism, which allows scaling of fitness values in apopulation. This mechanism normalizes fitness values so that the best genotype is (after scaling) always thesame number of times better than the average one. Therefore, better individuals are constantly more preferredduring selection, no matter how much better they are. If you are using a tournament selection, consider thetournament size (the bigger the size, the stronger the selection pressure).

In most cases, during a directed evolution effects of interaction of many individuals in the simulated world arenot important. Thus you can set "Simulated creatures" to 1 (to evalutate only one creature at a time).

When simulating speed-oriented evolution, you should generally set high values for "Performance samplingperiod", enable "Performance calculation" after stabilization, set "Starting energy" to 100 or more (to allow areasonable time of living and speed evaluation after stabilization), and set world "Boundaries" to "None". Youcan also exclude some characters from the genotype. See "General remarks".

11.2 Spontaneous evolution

With spontaneous evolution, the user has to define more parameters and be more careful. The "Lifespan"criterion should be set to a positive weight. The number of simultaneously "Simulated creatures" should beadjusted in conjunction with the world size, so that not too many of them are simulated, but the interaction isstill possible.

"Aging time" should be set to a positive value. You might also set positive values for "Muscle static work","Muscle dynamic work", "Assimilation energy" and "Automatic feeding", depending on how realistic modelyou wish to simulate. "Boundaries" may be set to "Teleport" and the world can be land or water.

Remember, the evolution is not directed by any criteria except the life span. The creatures are not evaluatedfor their specific actions; any behavior that causes prolonged life span is rewarded.

11.3 General remarks

Note that most of the settings described are to be adjusted reasonably, and it is recommended that you knowhow they work. Being familiar with genetic algorithms and other evolutionary optimization techniques is agreat advantage and help.

You should study the meaning of the parameters and anticipate their behavior; it is also good to think over theloop of the evolutionary process simulated in Framsticks and ensure that the settings are rational. Always readhints (tips) about the parameters.

To allow speciation, you can set the "Similarity speciation" and, possibly, the "Genetics: similarity"parameters. See also the "Minimal similarity" parameter.

To simplify the creatures, you may disable some modifiers, receptors and control. You can also disallowundesirable behavior in this way. For example, when simulating creatures on land and evolving them forspeed, the S (Smell) receptor is not required. A lot of modifiers (ingestion, assimilation etc.) are alsoredundant in this situation and should be excluded. Similarly, the T (Touch) receptor is not needed underwater (except for touching the bottom, which should most probably not be perceptible by creatures).

Good default values that you should not worry about are those in "Genetics: structure", "Genetics: neuron net"and "Genetics: similarity". "Death" should generally be turned on, unless you are interactively experimentingwith the simulation.

A detailed description of all the parameters is available here.

11 Tips on evolution design, parameters, etc. 41

12 Experiment definitions summary

This page summarizes basic experiment definitions that are available within Framsticks. Each section presentsone experiment definition along with its properties and short descriptions. All these settings are available inthe Framsticks GUI and for scripts.

Jump to experiment definition:

Standard Experiment• Asexual reproduction in the world• Demonstration of evolution• Neuroanalysis• Learn where food is, explore and exploit• Boids• Generational evolutionary optimization experiment• Mazes• Text writer• Dance• Framsbots - Game• Batch evaluation of loaded genotypes

12.1 Experiment definition: Standard Experiment

(short name: standard)

This experiment definition can be used to perform a rangeof common experiments. It provides

– one gene pool– one population for individuals– one "population" for food– steady–state evolutionary optimization– fitness as a weighted sum of performance values– or custom fitness formulas– fitness scaling– selection: roulette or tournament– multiple evaluation option, average and standard deviation available– can produce logs with average and best fitness– can detect stagnation and stop automatically– can save best genotypes

This experiment definition has 39 properties – see table below:

Experiment: Parameters

Initial genotypeThe gene pool will be replaced with the supplied genotype when theexperiment begins.Use the empty initial genotype if you want to preserve the current gene pool.

Gene pool capacity

Delete genotypes

Simulated creatures

Initial placementFor 'Central' placement, newborn creatures are placed at the world center, ifpossible.

Initial orientation Initial heading of newborn creatures

Initial elevation

Vertical position (above the surface) where newborn creatures are placed.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Clear performanceinfo

Sets the number of instances of each genotype to zero (as if it has never beenevaluated).Genotype performance values stay intact, yet they are meaningless if agenotype has no instances.

Experiment: Parameters: Selection

Unchanged

Multiple evaluation

If more than zero:– each genotype will be evaluated many times– fitness will be averaged– fitness standard deviation will be stored in the 'user1' field of a genotype– there will be no "Unchanged" genotypes ("Unchanged" value is consideredzero).

Mutated

Crossed over

Minimal similarityOnly genotypes with dissimilarity below this threshold will be crossed over.Value of 0 means no crossover restrictions.

Selection rule

Experiment: Parameters: Fitness

Constant Constant value added to total fitness

Life span Weight of life span in total fitness

Velocity Weight of horizontal velocity in total fitness

Body parts Weight of body size (number of parts) in total fitness

Body joints Weight of structure size (number of joints) in total fitness

Brain neurons Weight of brain size (number of neurons) in total fitness

Brain connections Weight of brain connections in total fitness

Distance Weight of distance in total fitness

12 Experiment definitions summary 43

Vertical position Weight of vertical position in total fitness

Vertical velocity Weight of vertical velocity in total fitness

Criterianormalization

Normalize each criterion to 0..1 interval before weighting

Similarityspeciation

If enabled, fitness of each genotype will be reduced by its phenotypicsimilarity to all other genotypes in the gene pool

Experiment: Parameters: Energy

Starting energy Base starting energy level (for each stick)

Idle metabolism Each stick consumes this amount of energy in one time step

Automatic feeding Number of energy pieces in the world

Food's energy

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobile food.

Ingestion multiplier

Aging time Idle metabolism doubles after this period (0 disables aging)

Experiment: Parameters: Extras

Stagnation (autostop)

No improvement period required to stop simulation (stagnation). 0 disablesautomatic stopping.

Minimal fitnessMinimal fitness that allows to automatically stop evolution when stagnationdetected

Boost phase afterstagnation

After stagnation has been detected, switches negative selection to "deleteworst", doubles "multiple evaluation" and starts another stagnation detectionphase."Delete worst" results in extremely quick convergence and high selectionpressure, similarly to "local search" optimization techniques.

Sound onimprovement

Emit sounds on improvements? (frequency depends on the magnitude ofimprovement)

Save improvementsSaves (on each improvement) best found genotype or a complete experimentstate to a file in scripts_output subdirectory.

Log fitness

Sends [LOG] messages with genotypes count and minimal, average and bestgene pool fitness, which can be used to produce graphs by external tools likegnuplot or Excel.It also sends the [LOGTITLE] message on experiment initialization, whichsummarizes most important parameters of your experiment. It can be used asa graph title.

12 Experiment definitions summary 44

12.2 Experiment definition: Asexual reproduction in theworld

(short name: reproduction)

Spontaneous evolution. Each creature with a sufficient energy level produces an offspring, which isthen put close to its parent.Food is created at a constant rate and placed randomly.

This experiment definition has 11 properties – see table below:

Experiment: Parameters

Initial genotype

Creation height

Vertical position (above the surface) where new creatures arerevived.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Mutations

Restart after extinctionRestart automatically this experiment after the last creature hasdied?

Experiment: Parameters: Energy

Starting energy Initial energy for the first creature

Reproduction energyCreature can produce offspring when its energy level reaches thisthreshold

Idle metabolism Each stick consumes this amount of energy in one time step

Feeding rate How fast energy is created in the world

Food's energy

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobilefood.

Ingestion multiplier

12 Experiment definitions summary 45

12.3 Experiment definition: Demonstration of evolution

(short name: evolution_demo)

This experiment definition demonstrates the process of evolution.Individuals are placed in a circle. A new individual is cloned, mutated or crossed over.Then it is evaluated in the middle of the circle, and, depending on its fitness, may replace a poorer,existing individual or disappear.

This experiment definition has 19 properties – see table below:

Experiment: Parameters

Initial genotypeInitial genotype, mutated to create initial population of genotypes.You need to (re)initialize the experiment to (re)create initial populationof genotypes.

Delete genotypes

Simulated creaturesYou need to (re)initialize the experiment to change this setting andcreate initial population of given size.

Initial orientation Initial heading of newborn creatures

Initial elevation

Vertical position (above the surface) where newborn creatures areplaced.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Predefined setup

Number of steps eachcreature lives

Number of simulation steps for the creature in the center of craturescircle.Beware to performance sampling period when setting this value.

Number of idlevisualization steps

Number of idle visualization steps:– after parent (parents) approaches (approach) the center and beforenew creature is born in the world– after new creature is born in the world and before parent (parents)returns (return) to original place (places)– after central creature disappearance– after replacement of circle circumference creature by central creatureIf this parameter is set to zero, than simulation speeds up.If this parameter is set to big value, then some simulation details maybe better observed.It is possible to change this value during simulation, to obtain differentgoals.

Experiment: Parameters: Selection

Unchanged

12 Experiment definitions summary 46

Mutated

Crossed over

Minimal similarityOnly genotypes with dissimilarity below this threshold will be crossedover.Value of 0 means no crossover restrictions.

Selection rule

Experiment: Parameters: Fitness

Constant Constant value added to total fitness

Vertical position

Velocity Weight of horizontal velocity in total fitness

Body parts Weight of body size (number of parts) in total fitness

Criteria normalization Normalize each criterion to 0..1 interval before weighting

Similarity speciationIf enabled, fitness of each genotype will be reduced by its phenotypicsimilarity to all other genotypes in the gene pool

12.4 Experiment definition: Neuroanalysis

(short name: neuroanalysis)

This experiment evaluates all genotypes in the gene pool.During simulation, the output signal of each neuron isanalyzed, and its average and standard deviationare computed. These data are then saved in the 'Info'field of the genotype.

This experiment definition has 3 properties – see table below:

Experiment: Parameters

Evaluation time

Restart from the firstgenotype

Initial elevation

Vertical position (above the surface) where newborn creatures areplaced.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

12 Experiment definitions summary 47

12.5 Experiment definition: Learn where food is, exploreand exploit

(short name: learn_food)

When an individual encounters food, it eats a bit of it and remembers its location.It also gets "refreshed" (i.e. gets a full amount of energy). Energy of eachindividual provides information on how recent (current) is the food locationinformation that the individual stores. Information recency is visualized asbrightness of individuals (light green ones have recently found food).When individuals collide, they learn from each other where food is (by averaging their knowledge).A newborn individual moves randomly and receives (duplicates) knowledge from thefirst knowledge–rich individual that it collides with.An individual that cannot find food for a long period of time dies, and a newbornone is created.

–=–

An interesting phenomenon to be observed in this experiment is how sharing informationhelps explore food location. Food items can be added either close to previous items,or randomly (in the latter case, the information about food location is not very usefulfor individuals). You can turn off automatic feeding and keep adding food manually to seehow learning influences behavior of the population. See the "share knowledge" parameter (on/off).

With learning, individuals do not have to find food themselves.They can also get in contact with other individuals that knowwhere the food was, and exchange information (the values learnedare proportional to the recency of information). It is interestingto see how knowledge sharing (cooperation, dependence) versusno sharing (being self–sufficient, independence, risk) influences minimal,average and maximal life span in the neighboring and random food placement scenarios.

Notions of exploration of the environment and exploitation of knowledgeabout the environment are illustrated as well in this experiment.

–=–

The dynamics of this system depends on the following parameters:– number of individuals and world size– size and shape of their body (affects collisions and sharing of knowledge)– food eating rate– food placement (neighboring or random)– learning strategy (e.g. weighted averaging of food coordinates)– behavior (e.g. move within circles, small after finding food, then larger and larger)

–=–

Technical:Food location (x,y) is stored in user1,2 fields of each individual.

12 Experiment definitions summary 48

This experiment definition has 11 properties – see table below:

Experiment: Parameters

Number ofcreatures

Share knowledgeShare knowledge about food position when two creatures collide?

Initial genotype

Creation height

Vertical position (above the surface) where new creatures are revived.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Experiment: Parameters: Energy

Starting energy Initial energy for the first creature

Idle metabolism Each stick consumes this amount of energy in one time step

Feeding rate How fast energy is created in the world

Food's energy

Food placementRandom placement contradicts 'learning food location' and therefore constitutesa test/benchmark for this experiment definition.

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobile food.

Ingestionmultiplier

12.6 Experiment definition: Boids

(short name: boids)

Boids, developed by Craig Reynolds in 1986, is an artificial life program, simulating the flockingbehaviour of birds.

As with most artificial life simulations, Boids is an example of emergent behaviour; that is, thecomplexity of Boids arises from the interaction of individual agents (the boids, in this case) adheringto a set of simple rules. The rules applied in the simplest Boids world are as follows:

* separation: steer to avoid crowding local flockmates* alignment: steer towards the average heading of local flockmates* cohesion: steer to move toward the average position of local flockmates

12 Experiment definitions summary 49

(http://en.wikipedia.org/wiki/Boids)

This experiment definition has 6 properties – see table below:

Experiment:Parameters

Number of boids

Rule 1 - Separation

Rule 2 - Alignment

Rule 3 - Cohesion

Neighborhood range

Separation distance

12.7 Experiment definition: Generational evolutionaryoptimization experiment

(short name: generational)

A simple "genetic algorithm" experiment:

– two gene pools (previous and current generation)– one population for individuals– generational replacement of genotypes– selection: roulette (fitness–proportional)– fitness formula entered directly into the group's field

This experiment definition has 8 properties – see table below:

Experiment: Parameters

Initial genotype

Gene pool size

Evaluation time

Restart epoch Re–evaluate all genotypes in the current generation

Initial elevation

Vertical position (above the surface) where newborn creatures are placed.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

12 Experiment definitions summary 50

Experiment: Parameters: Selection

Unchanged

Mutated

Crossed over

12.8 Experiment definition: Mazes

(short name: mazes)

This experiment definition can be used to evaluate (and evolve)creatures moving between two specified points in a maze. These pointsare indicated by start and target marks (in the second population).

Genotype's user1 field (which acts as a maximized fitness) contains– energy left (when target found during lifespan)– distance to the target (as a negative value)when a creature died away from the target.

Press "SHIFT" and click the right mouse button to manually setthe start and finish points.

Use maze[1,2].sim settings for this experiment definition.

This experiment definition has 39 properties – see table below:

Experiment: Parameters

Initial genotype

The gene pool will be replaced with the supplied genotype when theexperiment begins.Use the empty initial genotype if you want to preserve the currentgene pool.

Gene pool capacity

Delete genotypes

Simulated creatures

Initial placementFor 'Central' placement, newborn creatures are placed at the worldcenter, if possible.

Initial orientation Initial heading of newborn creatures

Initial elevation

Vertical position (above the surface) where newborn creatures areplaced.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

12 Experiment definitions summary 51

Start X positionsA comma–separated list of X positions (based on the world map) ofstarting points

Start Y positionsA comma–separated list of Y positions (based on the world map) ofstarting points

Start headings A comma–separated list of initial headings (in degrees)

Target X positionsA comma–separated list of X positions (based on the world map) oftarget points

Target Y positionsA comma–separated list of Y positions (based on the world map) oftarget points

Target radius The target is a circle with the radius defined here

Clear performance info

Sets the number of instances of each genotype to zero (as if it hasnever been evaluated).Genotype performance values stay intact, yet they are meaninglessif a genotype has no instances.

Experiment: Parameters: Selection

Unchanged

Multiple evaluation

If more than zero:– each genotype will be evaluated many times– fitness will be averaged– fitness standard deviation will be stored in the 'user1' field of agenotype– there will be no "Unchanged" genotypes ("Unchanged" value isconsidered zero).

Mutated

Crossed over

Minimal similarityOnly genotypes with dissimilarity below this threshold will becrossed over.Value of 0 means no crossover restrictions.

Selection rule

Experiment: Parameters: Fitness

Constant Constant value added to total fitness

Life span Weight of life span in total fitness

Velocity Weight of horizontal velocity in total fitness

Body parts Weight of body size (number of parts) in total fitness

Body joints Weight of structure size (number of joints) in total fitness

Brain neurons Weight of brain size (number of neurons) in total fitness

Brain connections Weight of brain connections in total fitness

12 Experiment definitions summary 52

Distance Weight of distance in total fitness

Vertical position Weight of vertical position in total fitness

Vertical velocity Weight of vertical velocity in total fitness

Criteria normalization Normalize each criterion to 0..1 interval before weighting

Similarity speciationIf enabled, fitness of each genotype will be reduced by itsphenotypic similarity to all other genotypes in the gene pool

Experiment: Parameters: Energy

Starting energy Base starting energy level (for each stick)

Idle metabolism Each stick consumes this amount of energy in one time step

Automatic feeding Number of energy pieces in the world

Food's energy

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobilefood.

Ingestion multiplier

Aging time Idle metabolism doubles after this period (0 disables aging)

12.9 Experiment definition: Text writer

(short name: text_writer)

This experiment definition displays formatted (and flowing) text usingcreatures as letters and digits. It requires the "fonts.gen" file.Only big letters and digits can be used in the text.

Initialize the experiment to situate the text.

The text can be formatted using HTML–like tags:

<left><center><right><justify> – are used to start a paragraph

<hNUMBER> – sets the height (elevation) of the text (see also the 'Gravity' setting)

<hsNUMBER> – sets hotizontal spacing between letters

<vsNUMBER> – sets vertical spacing between lines

12 Experiment definitions summary 53

<f0><f1> – select the font (f0 is more regular)

This experiment definition has 3 properties – see table below:

Experiment: Parameters

Text The text you want to see

Collisions When turned on, nearby letters will collide and bounce

Speed Text movement: 1–slowest, 100–fastest

12.10 Experiment definition: Dance

(short name: dance)

A synchronous framsdance :–)

This experiment definition has 38 properties – see table below:

Experiment: Parameters

Initial genotype

The gene pool will be replaced with the supplied genotype when theexperiment begins.Use the empty initial genotype if you want to preserve the currentgene pool.

Gene pool capacity

Delete genotypes

Simulated creatures

Initial placementFor 'Central' placement, newborn creatures are placed at the worldcenter, if possible.

Initial orientation Initial heading of newborn creatures

Initial elevation

Vertical position (above the surface) where newborn creatures areplaced.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Land dance

Water dance

Number of dancers

12 Experiment definitions summary 54

Dance tempo

Change arrangement

Beat

Experiment: Parameters: Selection

Unchanged

Multiple evaluation

If more than zero:– each genotype will be evaluated many times– fitness will be averaged– fitness standard deviation will be stored in the 'user1' field of agenotype– there will be no "Unchanged" genotypes ("Unchanged" value isconsidered zero).

Mutated

Crossed over

Minimal similarityOnly genotypes with dissimilarity below this threshold will be crossedover.Value of 0 means no crossover restrictions.

Selection rule

Experiment: Parameters: Fitness

Constant Constant value added to total fitness

Life span Weight of life span in total fitness

Velocity Weight of horizontal velocity in total fitness

Body parts Weight of body size (number of parts) in total fitness

Body joints Weight of structure size (number of joints) in total fitness

Brain neurons Weight of brain size (number of neurons) in total fitness

Brain connections Weight of brain connections in total fitness

Distance Weight of distance in total fitness

Vertical position Weight of vertical position in total fitness

Vertical velocity Weight of vertical velocity in total fitness

Criteria normalization Normalize each criterion to 0..1 interval before weighting

Similarity speciationIf enabled, fitness of each genotype will be reduced by its phenotypicsimilarity to all other genotypes in the gene pool

Experiment: Parameters: Energy

Starting energy Base starting energy level (for each stick)

12 Experiment definitions summary 55

Idle metabolism Each stick consumes this amount of energy in one time step

Automatic feeding Number of energy pieces in the world

Food's energy

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobilefood.

Ingestion multiplier

Aging time Idle metabolism doubles after this period (0 disables aging)

12.11 Experiment definition: Framsbots - Game

(short name: framsbots)

Framsbots is a simple game inspired by the classic Robots game.The aim of this game is to run away from hostile creatures and make all of them hit each other.Just click somewhere (left–click or double–right–click) to move your creature (the one that is in themiddle of the world in the beggining). Your creature will go towards the point you clicked.All the enemies will move towards you. Use this information to make them hit each other, so they willloose energy and die.If you see an apple, try to get it. You will gain energy and you may even get a new life!Use shift+left mouse drag to rotate world.

Read more about this game:http://www.framsticks.com/wiki/FramsBots

This experiment definition has 16 properties – see table below:

Experiment: Parameters

Enemy creature type

Player creature type

Level Number of a level to play (–1 is random)

Show additional debug messages

Experiment: Parameters: Enemies

Number of enemy creatures

Starting energy of enemy creature Base starting energy level

12 Experiment definitions summary 56

Multiplier of energy taken by Enemy

Multiplier of energy taken by frozen Enemy

Multiplier of energy taken when Enemies collide

Multiplier of energy taken from alone Enemy

What to do when Enemies die

Experiment: Parameters: Player

Starting energy of player creature Base starting energy level

Experiment: Parameters: Food

Starting energy of food Base starting energy level

Amount of energy lost How much energy food looses each step

Food probablity Probability of food appearing after enemy killed

Experiment: Parameters: Azimuth

Maximum length of positions history vectors

12.12 Experiment definition: Batch evaluation of loadedgenotypes

(short name: standard-eval)

Use this experiment to evaluate all genotypes one by one.Use gene pool capacity parameter to set the required number of evaluations of each genotype.

The genotypes for evaluation _must_ be different.

First load your genotypes for evaluation, then initialize experiment,then adjust all simulation parameters, and finally run the simulationto perform all evaluations.

After evaluation, fitness of each genotype contains the average fitness,user1 field contains standard deviation, and user2 field contains theaverage time (in seconds) needed for single evaluation.

This experiment definition has 33 properties – see table below:

Experiment: Parameters

Initial genotypeThe gene pool will be replaced with the supplied genotype when theexperiment begins.Use the empty initial genotype if you want to preserve the current gene pool.

Gene pool capacity

12 Experiment definitions summary 57

Delete genotypes

Simulated creatures

Initial placementFor 'Central' placement, newborn creatures are placed at the world center, ifpossible.

Initial orientation Initial heading of newborn creatures

Initial elevation

Vertical position (above the surface) where newborn creatures are placed.Negative values are only used in the water area:0 = at the surface–0.5 = half depth–1 = just above the bottom

Clear performanceinfo

Sets the number of instances of each genotype to zero (as if it has never beenevaluated).Genotype performance values stay intact, yet they are meaningless if agenotype has no instances.

Experiment: Parameters: Selection

Unchanged

Multiple evaluation

If more than zero:– each genotype will be evaluated many times– fitness will be averaged– fitness standard deviation will be stored in the 'user1' field of a genotype– there will be no "Unchanged" genotypes ("Unchanged" value is consideredzero).

Mutated

Crossed over

Minimal similarityOnly genotypes with dissimilarity below this threshold will be crossed over.Value of 0 means no crossover restrictions.

Selection rule

Experiment: Parameters: Fitness

Constant Constant value added to total fitness

Life span Weight of life span in total fitness

Velocity Weight of horizontal velocity in total fitness

Body parts Weight of body size (number of parts) in total fitness

Body joints Weight of structure size (number of joints) in total fitness

Brain neurons Weight of brain size (number of neurons) in total fitness

Brain connections Weight of brain connections in total fitness

Distance Weight of distance in total fitness

12 Experiment definitions summary 58

Vertical position Weight of vertical position in total fitness

Vertical velocity Weight of vertical velocity in total fitness

Criterianormalization

Normalize each criterion to 0..1 interval before weighting

Similarityspeciation

If enabled, fitness of each genotype will be reduced by its phenotypicsimilarity to all other genotypes in the gene pool

Experiment: Parameters: Energy

Starting energy Base starting energy level (for each stick)

Idle metabolism Each stick consumes this amount of energy in one time step

Automatic feeding Number of energy pieces in the world

Food's energy

Food's genotype

The default food model is a simple, single part object://0m:Vstyle=foodp:(this genotype is used when you leave this field blank).You can specify another genotype to create "intelligent" or mobile food.

Ingestion multiplier

Aging time Idle metabolism doubles after this period (0 disables aging)

12 Experiment definitions summary 59

13 Graphical User Interface (GUI) for Windows

Other interfaces:

command line (allplatforms)

Amiga GUI• network server•

See also: Interface parameters, Simulator parametersBottom: Mini-tutorial, GUI command-line usage

13.1 Introduction

Click on the "Window" menu. Notice that there are seven windows to show/hide. By default, five of them arealready open: Groups, Artificial world, Body & Brain, and two lists: genotypes and individuals. Genotypesand individuals (or, generally, simulated objects) can be grouped into Gene pools and Populations,respectively.

You can revive individuals by selecting their genotypes (upper list) and pressing the "Simulate" button. Theselected genotypes are then "grown" and placed in the artificial world. Selecting them on the "Populations"list makes the camera follow the selected creatures (display rate is adjustable in the listbox in the top rightcorner of the world window).

Use the menu to start and stop the simulation. You can also invoke some functions using the toolbar on thetop, or using keyboard shortcuts.

You can kill or delete living creatures using buttons. Killing means that the program treats the creature as if itsenergy had reached zero (so it is like a "natural" death). Deleting means just removing it from simulation.

Update listbox (in the "Populations" window) sets the frequency for refreshing information about genotypes,creatures, etc. When you double-click a genotype on the list, the genotype data window will be opened:

13.2 Genotype data window

You can see/edit properties of genotypes. While editing the genotype, you can interactively see the changes(instant body and brain preview), as long as the genotype is valid. Selecting a genotype fragment highlightsparts of the morphology and brain which are created by the fragment. It also works the other way: you canselect body or brain parts to see what genes are responsible for creating these parts (these genes areunderlined). Hold down the Shift key while selecting parts of body and brain to add new parts to the selection,or to toggle them.

You can give any name to your creature ('Name' field). If you leave it blank, the name will be generatedautomatically.

13.3 Body and brain window

In the body panel, left click selects parts of the body or neurons/receptors/effectors. Hold down Shift to addmore parts to the selection. Right mouse drag rotates the structure. The mouse wheel zooms.

In the brain panel, left click selects parts of the brain: neurons, receptors, and effectors.Hold down Shift to add more parts to the selection. The mouse wheel zooms. You canmove neurons by draging them while you hold the Shift key down. Press the Alt keyand drag the mouse horizontally to zoom the neural diagram (as shown on the rightpicture). When zoomed, you can drag the diagram to pan it.

When the neural network shown belongsto a living creature, double clicking on aneuron makes a signal window pop up.You can not only see signal flow inneurons, but also adjust levels ofexcitations and thus control the brain of aliving creature (as shown on the leftpicture). Also, neural connections aredisplayed in various colors reflecting thesignal level. Click on the scale indicator(the green "1x") and drag the mousehorizontally to scale the chart.

Helpful hints are displayed when you stop the mouse pointer over an object.

13.4 Artificial world window

In this window, left mouse drag rotates the world. Right mouse drag pans the view, and mouse wheel zooms.Double clicking on a simulated object will focus the camera on that object (although this will not be reflectedby a selection of that object on the populations list).

Press Shift + right mouse click to invoke an action from the action list. Right double click will invoke the firstaction from the list without displaying it.

Press Control + left mouse click to grab some object with a robot arm and move it by dragging the mouse.Release the left mouse button first to drop the object. Release the Control key first to leave the robot armholding the object.

13.5 More hints

Be sure to explore the menus which appear when you click on a small arrow in top left corner of windows.Also, right click on genotypes and individuals which are listed in gene pools and populations to see manyoptions.

Messages produced by the program can be viewed in the "Messages" window.

13 Graphical User Interface (GUI) for Windows 61

13.6 A GUI mini-tutorial

Launch the Framsticks application1. Load genotypes from walking.gen (Menu:File->Load genotypes from...)2. Load parameters from manual.sim (Menu:File->Load simulator parameters from...)3. Select 'Basic Quadruped' on the Genotypes (upper) list4. Click the Simulate button and choose the "Creatures" population5. Select 'Basic Quadruped' on the Individuals (lower) list6. Start simulation (Menu:Simulation->Run)7. You can watch as the creature moves, play with it, grab with the mouse (control + left mouse button),move the camera (left or right drag on the world window), zoom (mouse wheel), etc.

8.

Double-click on the 'Basic Quadruped' in the upper window to examine its data.9. Want to try out your own creature? Look at the 'genotype' section, and try to modify it or create a newone. Then you can place it in the simulator world.

10.

If you would like to start some evolution now, you should change some parameters: turn on 'death' – creatureswill be removed when they run out of energy, set the number of creatures to be placed automatically in theworld, set the selection criterion... and of course enter the starting genotype in the genotypes list: this can bethe simple 'bacteria' (single X) or you may wish to improve any other genotype by evolution.

13.7 Command-line parameters for the Framsticks GUI

Framsticks.exe [-go | -demo] [-help] [file.sim] [file.gen] [...]

Examples:

Framsticks.exe ev11_11.gen ev11_12.gen

Framsticks.exe water.sim ev.gen -go

Framsticks.exe -demo demo-chase.sim demo-chase.gen

Framsticks.exe manual.sim

The first example loads two genotype files.The second example loads a water environment and a genotype file, and starts evolution.The third example loads an environment and genotypes, and runs the demo mode (80% displaying time, 20%pure simulation).The fourth example loads a simulator settings file.

13.8 Advanced notes

Simulator settings files may contain partial information (only a subset of parameters). That may bevery useful when defining various environments and batch processing.

You can drag *.gen, *.sim, and *.expt files and drop them on Framsticks.exe file in order to launchFramsticks and load the dragged files. You can also double-click files with such extensions to launchFramsticks and load the clicked file.

13 Graphical User Interface (GUI) for Windows 62

14 Interface parameters

If you need help, read the hints (tooltips) which appear when you stop the mouse pointer over the name of aparameter in the program. Documentation below is provided in addition to those hints and discusses onlysome issues.

See also:

Simulation ParametersInterface

This page:

GeneralVisual stylePerformance chartsSimulator chartsExport world

14.1 General

Save on exit: save all settings from this window when you exit Framsticks?

Demo mode: allows you to leave your computer evolving, while occasionally displaing simulated creatures.However, display slows down simulation, so the less % of time you choose, the faster the evolution willproceed. Using "demo mode" is good for demonstrations and presentations of Framsticks.

Keep extensions associated: should be turned on if you want Framsticks file extensions to be associated withthis program. This allows you to open such files by double-clicking them, and also displays appropriate iconsfor such files. When this option is turned on, Framsticks ensures that these associations are valid each timeyou run the program.

14.2 Visual style

Style: registered users (full license) can choose from a list of visual styles for OpenGL view. Advanced userscan create their own styles and themes with their own textures and settings. Source code for styles is in the"3dobj" subdirectory.

14.3 Performance charts

Simulator charts

Performance charts concern living (currently simulated) creatures. You have to select a creature to see itsperformance on the chart.

Simulator charts concern genetics, gene pools and populations.

Selected property: choose a property (criterion) to add to the Charts window. After you select it, press"Apply" and then the "Add chart" button.

14.4 Export world

Export world: POV-Ray

Registered users with a "full" license can export scenes from the simulated world in POV-Ray format.POV-Ray is a powerful, freeware raytracer. To render a scene, you have to install POV-Ray. To make amovie, you need additional software which joins individual frames rendered by POV-Ray. You can get moreinformation at the official POV-Ray site, www.povray.org.

Framsticks can create scene files for use with POV-Ray. It gives you the possibility to view photorealisticpictures and movies from your creatures' artificial world. To render such pictures, POV-Ray needs the"framsticks.inc" include file, so you have to make it accessible (e.g. copy it to your POV-Ray includedirectory). This file is very important, as it contains the definitions of all the rendered objects – sticks,muscles, receptors, water, fence, hills, etc. If you know POV-Ray, you can even modify this file to obtaindifferent Framsticks scenarios.

After the export has been enabled, the simulator creates the file "world.inc" in the selected directory (this filecontains all the static objects in the simulated world: ground, sky, light etc.). Then, an exported scene file iscreated in each simulation step (but observing the skip frames parameter). Every scene file #includes"world.inc". If POV-Ray has trouble accessing "world.inc", copy this file to the directory where .pov scenefiles are created.

The meaning of POV-Ray export parameters is analogous to those of 'Other formats' section (see below).scene_%04d.pov is the default output files pattern for POV-Ray export.

Export world: Other formats

Registered users with a "full" license can export scenes from the simulated world in a range of formats.However, exported files are often simplified, and some formats on the list may be not available.

Output files pattern: when the scene export is enabled, the program creates exported scene files. Names forsuccessive scene files are generated automatically. For example, when your output files pattern isframe_%05d.ac, you will get the files frame_00001.ac, frame_00002.ac, and so on ('5' in the pattern meansfive digits, '0' means zero-padding). If you set the pattern to img%d.ssg, you will get the files img1.ssg,img2.ssg, and so on ('%d' is simply replaced by consecutive numbers without any special formatting).

Flatten scene: joins all world objects into one object. This is required for most export formats, otherwise youmay only get a single object for each object type.

Enable export: turns on exporting mode, where an exported scene file is created in each simulation step (butobserving the skip frames parameter). To check whether the program is in exporting mode, see the Exportenabled checkbox.

Export world: OpenGL image

When the OpenGL world view is activated, bitmaps from the world window may be exported as image files.

14 Interface parameters 64

15 OpenGL visualisation OpenGL is an industrial standard for 3D graphics (see www.opengl.org). It is becoming more and morepopular; the development of new 3D graphics accelerators and faster processors available for everyone makesit an important and useful standard.

Framsticks OpenGL gives a very impressive three-dimensional view of thevirtual world and body structures of the creatures. Creatures' sticks aredisplayed as solid cylinders with textures, and all objects are shaded (almostlike renderings). All this is possible in real time.

Click on the picture to get a full-sized view. Download a free program, FramsView (for Windows or Linux)to see 3D OpenGL Framsticks structures. You can also download the trialware Framsticks Theater (forWindows or Linux) to see real time, 3D OpenGL view of various simulations.

15.1 Some OpenGL styles

(advanced users can create their own styles!)

Standard

(default Framsticks visualstyle)

Arena

(a round arena)

Football

(football players and balls)

15 OpenGL visualisation 66

Spooksticks

(description here)

Space

(is there anything morebeautifulthan infinite space?)

15 OpenGL visualisation 67

Laboratory

(biochemical laboratory)

Matrix

(no one can be toldwhat the matrix is.You have to see it foryourself...)

15 OpenGL visualisation 68

16 User Interface – command line

Framsticks command line interface is free. It is faster and simpler than the GUI (no overheads), and it isrecommended, especially for long-term experiments.

To learn about command-line parameters, run frams -?

16.1 Interactive command-line

To run the interactive command-line program (with its own shell), just execute it. (For Windows console, runframs.exe; for UNIX/Linux, run frams).

Enter help to see help, enter lm to see more options. See frams.ini file, too. Note that you can access classbrowser (it is also available in Framsticks GUI).

To quit the program, enter qu, or the End-Of-Line character (^Z for Windows, ^D for UNIX/Linux).

16.2 Command-line

You can use arguments, for example:

frams "lo e0.gen" "st 100000000" "sa last.gen" qu

means that you

run the program (it always loads default parameters from default.sim)• load e0.gen (a file with genotypes)• simulate 100 000 000 steps• save genotypes to last.gen• quit (qu)•

Quotation marks are needed for parameters which contain spaces. Another example:

frams "lo exp_03.expt" "go"

means that you

run the program (it always loads default parameters from default.sim)• load exp_03.expt (a file with genotypes and simulation settings)• run simulation until the Control-C (or Control-Break) is pressed•

Thus, if the exp_03.expt activates "autosave" option, then you will have periodic snapshot files of thesimulation state. You can examine them with the GUI without stopping the command-line simulation, whichcan be interrupted by pressing control-C at any time.

16.3 Batch

You can use batch mode, for example:

frams < commands.txt

where commands.txt file contains the commands you would enter interactively.

16.4 User-defined actions, scripts and macros

See cliutils.ini file for more examples.

16 User Interface – command line 70

17 Script writing

The Framsticks system can interpret commands written in a simple language (FramScript). FramScript can beused for a range of tasks, from custom fitness functions, macros, and user-defined neurons, to user-definedexperiment definitions, creatures behaviors, events, and even 3D visualization styles.

Understanding FramScript will let you exploit the full potential of Framsticks, because your scripts cancontrol the Framsticks system. The following documents are related to script writing:

FramScript syntax• Contexts, objects, methods, and variables – reference. Temporarily off-line, use Framsticks GUI orCLI.

Experiment definitions• Script writing: pdf• Little how-to: pdf• FramClipse: for easier scripting!•

See also the contents of the "scripts" subdirectory, and the *.ini files in the command-line interfacedistribution.

18 FramScript language

The FramScript syntax and semantics is very similar to JAVA, C, C++, PHP, etc. In FramScript,

all variables are untyped and declared using "var" or "global" statements• functions are defined with the "function" statement• references can be used for existing objects• no structures and no pointers can be declared• there is the Vector object which handles dynamic arrays• FramScript code can access Framsticks object fields as "Object.field"•

Before execution by FVM (Framsticks Virtual Machine), FramScript source code is first translated to FVMassembler source code, and then transformed to FVM machine code. Scripting is a powerful instrument andlets an advanced user control the Framsticks environment and use it according to their needs. However, errorreporting while processing scripts is not perfect: if a script is erroneous, do not expect the translator to alwaysprecisely locate the bug.

18.1 Statements

(brackets [] denote optional parts)

if (expression) statement; [else statement;] for (expression;expression;expression) statement while (expression) statement; do statement; while (expression);switch(expression) { case constant: statements... default: statements... } { statement; [statement;] } return [expression]; break [level]; continue [level]; label_name: goto labelname[:]; var name[=expression][,name2[=expression2]][...];function name([parameter_names]) {statements}@include "filename"asm { source code for FVM }

Remarks:

"level" is a positive integer specifying the loop you want to "continue" or "break". "break 1;" isequivalent to "break;", "break 2;" refers to the loop containing the innermost loop, and so on.

"goto" can be dangerous is some cases (like variable declarations jumped over), so it is recommendedto avoid it.

18.2 Variables

Variables must be declared before they are used. Unlike in C, the declaration does not specify the variabletype.

Variables are untyped, but the values are typed. The value can be of one of 5 types: integer, floating point,string, object reference or the special empty value (null).

Some operators act differently depending on the value type.

Example:

var int=123, float=1.23, string="123";int+=0.0001; // result = 123float+=0.0001; // result = 1.2301string+=0.0001; // result = "1230.0001"

That's why sometimes you will need to use constructs like ""+float or 0+string, in order to explicitly forcetype conversion. Note that the result may be of different type depending on the order of variables (int+stringwill be integer, float+int will be floating point, int+float will be integer, etc.). Consequently, float+" "+int willproduce a single floating point value, whereas ""+float+" "+int will produce a string of two values separatedby a space char.

Global variables are declared using the "global" statement. Unlike the local ("var") variables, globals preservetheir values between FramScript calls. This is useful when a function is called from outside the code module,as it happens in experiment definitions, styles, neurons and user scripts.

Example:

global counter;function eventHandler(){ counter=1+counter; }

function getCount(){ return ""+counter; }

18.3 Expressions

Most of the C language expressions are also valid in FramScript. This includes arithmetic and logicaloperators, parentheses, function calls, and assignments. Moreover, the following FramScript specificopearator are available:

"typeof" expression – determine the expression value type. The return value should be interpreted asfollows:

0 = empty (null)♦ 1 = integer♦ 2 = floating point♦ 3 = string♦ "classname" = object of class "classname". Thus typeof typeof expression is equal to 3 if andonly if the expression returns object reference

"." (dot) – member access operator (like in C++). It can be applied to any expressions containingobject references, or to the special static object names. Static object names are equal to the classnames shown in the Class Navigator, e.g.:

var expdefname=Simulator.expdef; // access object fieldSimulator.load("experiment.expt"); // invoke object methodvar two=Math.sqrt(4); // invoke object function

There is only one "static object" for each class. Some objects usually have a single instance and areaccessed using this method (like the Simulator or Math in the example above).Multiple objects of the same class are accessed indirectly with using object references:

var g=LiveLibrary.getGroup(0); // get the referencevar info="This group is called "+g.name; // use the reference

18 FramScript language 73

Sometimes, the static object is used to create more objects:

var v=Vector.new(); // static object creates a dynamic objectv.add(123); // the reference is usedvar s=v.size;

"ClassName.*" can be used as a reference to the special static object if it has to be passed to somefunction:

var v=callNew(Vector.*);var d=callNew(Dictionary.*);

function callNew(obj){return obj.new();}

".[expr]" – indirect member access operator. Works like the regular "dot" operator but the membername is passed as an expression:

var which=2;var value=Genotype.["user"+which]; // works like Genotype.user2

[] – vector operator (vector is a simple array-like object)The [] operator can be used in two ways:

[ expr1, expr2, ... ] – vector creation expression. It is a short form of:

v=Vector.new(); v.add(expr1); v.add(expr2); ...

object [ expr ] – "get" access operator. Works the same as object.get(expr). Thus youcan access a Vector object like a regular array in C:

var v=["one","two","three"];var third=v[2]; // == v.get(2)var d=Dictionary.new();d.set("name","value");var value=d["name"]; // works for any object implementing the "get" method

Note that "object [ expr ] = expression" will not work, because [] acts as "get". You need to use "set"explicitly to alter the vector object.

var v=[]; // empty vectorv.set(10,"10th value"); // v.set(...) will expand the vector when required

Note 2: See the difference between the "get" operator "[]" and the indirect member access operator".[]"

var d=Dictionary.new();d.set("size",123);var v1=d["size"]; // ==123 - equivalent of d.get("size"), gets the previously set valuevar v2=d.["size"]; // ==1 - equivalent of d.size, gets the object field value

function FUNCTIONNAME – creates the function reference.• call (FUNCTIONREF)([arguments,...]) – invokes the function using the functionreference obtainad from the "function" operator:

var calltable=[function one,function two,function three];var selector=1;var fun=calltable[selector];var result=call(fun)(argument1,argument2); // function two will be called

18 FramScript language 74

18.4 Functions

Functions are defined as follows:

function name([parameter_names]) {statements}

All parameters are passed by value (copied). However, an argument (or a return value) can contain objectreference, in which case it is the reference that is actually copied.

A function can return a value to the caller using the "return expression;" statement. If a bare "return;" is used,the return value is undefined.

Example:

function factorial(n) { if (n<3) return n; return factorial(n-1)*n;}

Functions can also have multiple names, which is useful when you need many functions with an identicalbody – for example:

function onLeftClick,onMiddleClick,onRightClick(x,y) { //do something...}

18.5 Using Framsticks classes, methods, and variables

See FramScript reference to learn about internal Framsticks classes, methods, and variables. You can also usethe class browser (available both in GUI and command-line interfaces).

18 FramScript language 75

19 What is an experiment definition, and how tocreate your own expdef

The most important feature of Framsticks is that you may define your own rules for the simulator. There areno predetermined laws, just a script � an experiment definition. This script is a set of instructions in somelanguage, which is interpreted by Framsticks program and executed.

This script defines behavior of the Framsticks system in a few associated areas:

Creation of objects in the world. The script defines where, when and how much of what objects willbe created. An object is an evolved organism, food particle, or any other element of the worlddesigned by a researcher. Thus, depending on some specific script, food or obstacles might appear,move and disappear, their location might depend on where creatures are, etc.

Objects interactions. Object collision/contact is an event, which may cause some action defined by thescript author. For example, contact may mean energy ingestion, pushing each other, destruction, orreproduction.

Evolution. A steady-state (one-at-a-time) selection model, where a single genotype is inserted into agene pool at a time, can be used. But a standard (i.e. generational replacement) evolutionary algorithmapproach is also possible (a new gene pool replaces the whole old gene pool). Another possibility istournament competition for all pairs of genotypes. In general, the script can define many gene poolsand many populations, and perform independent evolutions under different conditions.

Evaluation criteria are flexible, and do not have to be as simple as the performances supplied by thesimulator (but they will have to be based somehow on performances). For example, fitness mightdepend on time or energy required to fulfill some task, or degree of success (distance from target etc.).

So one can use Framsticks for simulation of various ecosystems, with very diverse laws. This system is veryversatile! The script is built from "procedures" assigned to system events. Currently there are the followingevents:

onExpDefLoad � occurs after experiment definition was loaded. This procedure should prepare theenvironment, create gene pools and populations.

onExpInit � occurs at the beginning of the experiment.• onExpSave � occurs on save experiment request.• onExpLoad � occurs on load experiment request. After this event, system state should resemble thestate before onExpSave.

onStep � occurs in each simulation step.• onBorn � occurs when a new organism is created in the world• onKill � occurs when a creature is removed from the world• on[X]Collision � occurs when an object of group [X] has touched some other object.•

Thus a researcher may define the behavior of the whole system by implementing appropriate actions withinthese events. A single script (experiment definition) may use parameters, so it usually allows to perform awhole bunch (class) of diversified experiments.

19.1 Illustrative example (standard experiment definition)

The file "standard.expdef" contains the full source for the script used to optimize creatures on a steady-statebasis, with fitness defined as a weighted sum of their performances (see parameters description). This script isquite versatile and complex. Below its general idea is explained, with simplified actions assigned to systemevents:

onExpDefLoad()

create single gene pool "Genotypes"• create two populations "Creatures" and "Food"•

onExpInit()

empty all gene pools and populations• place the beginning genotype in "Genotypes"•

onStep()

if too little food: create new object in "Food"• if too few organisms: select a parent from "Genotypes"; mutate, crossover, or copy it. From theresulting genotype create an individual in "Creatures"

onBorn()

move new object into a randomly chosen place in the world• set starting energy according to object type•

onKill()

if "Creatures" object died, save its performance in "Genotypes" (possibly creating a new genotype). Ifthere are too many genotypes in "Genotypes", remove one.

onFoodCollision()

send energy portion from "Food" object to "Creature" object.•

When you look at the standard.expdef file (in the "scripts" subdirectory), you will see it is written in a simplelanguage. Thus, when creating your own script, computer science background is helpful. A documentation onscript writing is available here. The existing scripts should serve as examples (see cliutils.ini file incommand-line frams distribution for illustrative examples). Any file with the ".expdef" extension, which ispresent in the "scripts" directory, will automatically appear on the list of experiment definitions to choosefrom.

19 What is an experiment definition, and how to create your own expdef 77

20 Programming: contexts and classes summary

FULL INFORMATION IS AVAILABLE IN THE HTML VERSION OF THE CLASSESDOCUMENTATION. THIS IS A SUMMARY ONLY.

The most recent version is always available online. You can download it zip'ped for off-line use.

Framsticks classes are grouped in contexts. Context hierarchy is presented as nested boxes in the frame on theleft. From a specific context, you can access its objects as well as objects of its parent contexts. Most classeshave corresponding static objects that can be accessed as ClassName.member (like static in C and Java).

Introduction

Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

20.1 All contexts and classes

Global context

CheckpointEventCollision CrCollision CreatureCreatureSettingsCreatureSignalsCreatureSnapshotDictionary EnergyParticlesFile FunctionReferenceGenePoolGenePoolsGenMan GenManStatsGenoGenotypeInterface Joint Loader Math MechJoint MechPartModel ModelGeometryModelSimilarityModelSymmetryNeuro NeuroClassNeuroClassLibraryNeuroDef NeuronsSimEnabledNeuroSignalsODE Orient Part PopulationPopulationsPOVExport Ref Signal SignalView sim_paramsSimulatorSlaveSimulatorsstats StopEventString UserScriptsVector WireframeAppearanceWorld WorldMapWorldSignalsXYZ

Experiment definition

ExpPropertiesExpState

Neuron definitions

n Neuro NeuroProperties

Fitness formula

this

Visual style definition

CreatureElement GeomBuilderGL j Loader m Material MechJoint MechPartn pSceneVertexBuilder VisPropertiesVisualModel VisualStyle World WorldMap

Signal label formula

Signal

Command line interface

ClassBrowserCLI RowFormat

Framsticks Theater

CreatureChartsCreatureSelectionDynaChartDynaChart2DGLDisplay GUIGUIElement ImageExportMaterial Matrix NeuroDiagramObj3D RectangleShaderSharing ShowManagerShowPropertiesSimStatsChartsTrackingCamVisualStyle Window

Generated from Framsticks source code, version 5.0rc13 (Fri Mar 30 01:42:33 2018)

20.2 Global context

Objects defined in the global context are available in all other places.

Classes defined in Global context:CheckpointEventUsed in onSlaveCheckpoint() which is called when a Slave Simulator checkpoint is reached.

CollisionUsed in collision handlers (On___Collision).

CrCollisionUsed in creature collision handlers (On___CrCollision).

CreatureThe object inside the simulated world, including its physical structure, neural network andperformance data.

CreatureSettingsCreature building parameters

CreatureSignalsSignal sources associated with a creature.

CreatureSnapshotA data object consisting of the same fields as the serialized Creature.

DictionaryDictionary associates stored values with string keys ("key" is the first argument in get/set/removefunctions).

EnergyParticles• FileProvides read/write access to the filesystem.

FunctionReferenceFunction reference objects are created using the 'function' operator.

GenePoolGenePool objects are accessed by GenePools[index], or Genotype.

GenePoolsManages all genotypes in the experiment, organized in one or more groups.

GenManManages various genetic operations, using appropriate operators for the argument genotype format.

GenManStatsStatistics for genetic operations.

GenoAll information about a single genotype.

Genotype•

20 Programming: contexts and classes summary 79

A Genotype with the associated performance information.InterfaceUsed to query for object member descriptions.

Joint• LoaderSupport for loading files in the Framsticks format.

MathMathematical functions library.

MechJoint• MechPart• Model• ModelGeometryApproximately estimates sizes, volume, and area of a Model based on the geometry of its parts.

ModelSimilarityEvaluates morphological dissimilarity.

ModelSymmetryCalculates bilateral symmetry.

NeuroLive Neuron object.

NeuroClassThe static NeuroClass object refers to the class selected in the NeuroClassLibrary.

NeuroClassLibrarySet of Neuron classes.

NeuroDef• NeuronsSimEnabled• NeuroSignalsSignals attached to a neuron.

ODEODE Parameters.

Orient3D orientation, stored as 3x3 matrix.

Part• PopulationA set of Creature objects, sharing some high level simulation properties (performance calculation, NNsimulation, collision detection, event handling).

PopulationsManages all Creature objects in the experiment, organized in one or more groups.

POVExport• RefReference objects.

SignalSignals broadcast information in a channel (being an abstract communication medium that could beimagined as sound, smell, vision or anything else).

SignalViewThis object can be used by an Experiment Definition or a Framsticks Theater show script to configurethe preferred Signal visualization in the experiment.

sim_paramsThis object groups all simulator parameters so they can be loaded or saved with a single call (seescripts/standard_loadsave.

SimulatorThe Framsticks simulator.

SlaveSimulators•

20 Programming: contexts and classes summary 80

This is a vector of slave Simulator objects.stats• StopEventUsed in onSlaveStop() which is called when a Slave Simulator is stopped.

StringString functions library.

UserScripts• VectorVector is a 1-dimensional array indexed by an integer value (starting from 0).

WireframeAppearanceThis object defines appearance of the elements of creatures (applies to the 'wireframe' display mode).

WorldEnvironment properties.

WorldMapEnvironment details for "Blocks" and "Heightfield" world type.

WorldSignalsUse this object to create stationary signals (not associated with any moving object) and to receivesignals from any location in the world.

XYZ3D vector

Global context

Experiment definitionNeuron definitionsFitness formulaVisual style definitionSignal label formulaCommand line interfaceFramsticks Theater

20.3 Experiment definition

ExpProperties and ExpState objects are created according to "property:" and "state:" sections in the expdeffile.

Classes defined in Experiment definition:ExpProperties• ExpState•

Globalcontext

>>

Experiment definition

Neuron definitionsFitness formulaVisual style definitionSignal label formulaCommand line interfaceFramsticks Theater

20.4 Neuron definitions

Neuron definition consists of 3 parts:- custom fields definition ("property:" sections, available as "NeuroProperties" object)- "function init()" (will be called at the neuron creation time)- "function go()" (should set new Neuro.state value)

Classes defined in Neuron definitions:n• NeuroLive Neuron object.

NeuroProperties•

20 Programming: contexts and classes summary 81

Each neuron contains a reference to the "NeuroProperties" object with neuron's own custom fields(also known as parameters or properties).

Global context >> Experiment definition >>Neuron definitions

20.5 Fitness formula

Fitness formula calculates genotype fitness. You can access Genotype fields using "this" object.Example: return this.velocity*100;

Classes defined in Fitness formula:thisA Genotype with the associated performance information.

Global context >> Experiment definition >>Fitness formula

20.6 Visual style definition

The style definition comes from the "style" files. It defines the appearance of the OpenGL display. VisParamsproperties are created according to the "property:" sections in the file.

Framsticks calls user defined functions to create and update the object's visual elements during the simulation.

Each function name is built as follows: "[<element_Vstyle>_]<model_Vstyle>_<element>_<action>"

- action="build" when the visual model is first created (load or create geometry and set initial attributes)- action="update" each time the visual model is displayed (modify geometry to reflect current position orattributes)

"<element>" refers to the kind of the element being processed (part, joint, neuron, model).The script can access different objects depending on the kind:1. partcan access:- "MechPart" after calling Element.useMechPart()- "Creature" after calling Element.useCreature()

2. jointcan access:- "MechJoint" after calling Element.useMechJoint()- "MechPart" after calling Element.useMechPart1() or Element.useMechPart2()- "Creature" after calling Element.useCreature()

3. neurocan access:- "n" after calling Element.useNeuro()- "Creature" after calling Element.useCreature()

4. modelcan access:- "Creature" after calling Element.useCreature()

20 Programming: contexts and classes summary 82

"<element_Vstyle>" and "<model_Vstyle>" are element's and model's Vstyle fields. <element_Vstyle> isomitted when the field is empty. Empty model's Vstyle is replaced with "default". Both <element_Vstyle> and<model_Vstyle> can contain several words separated by "_". This is interpreted as a kind of subclassing, i.e.Framsticks will automatically look for the general version of the function when the specific one is not found.Example:Assuming a part with Vstyle="green" in a model with Vstyle="food" the following functions will be trieduntil a match is found:- green_food_part_...- food_part_...- default_part_...So if the experiment requests visualizing some element as "green food" but the visual style only definesgeneric form of "food", Framsticks will automatically choose the best available visualization.

Classes defined in Visual style definition:CreatureThe object inside the simulated world, including its physical structure, neural network andperformance data.

ElementInformation about current visual element: Part, Joint or Neuro.

GeomBuilderScene graph access (build and manipulate the 3D object tree).

GLOpenGL constants used in GeomBuilder and Material functions.

j• LoaderLoads 3d objects files.

m• MaterialManipulate 3d objects surface properties (Material objects can be associated with geometry nodes).

MechJointCurrent joint properties during the simulation

MechPartCurrent part properties during the simulation

n• p• SceneAdditional properties to be used in the current view

VertexBuilder• VisProperties• VisualModelVisual representation of the Creature object.

VisualStyle• WorldEnvironment properties.

WorldMapEnvironment details for "Blocks" and "Heightfield" world type.

Global context >> Experiment definition >>Visual style definition

20 Programming: contexts and classes summary 83

20.7 Command line interface

Command line objects are available in "frams" and "theater".

Classes defined in Command line interface:ClassBrowserObject reference, can be used to provide online hints.

CLICommandline support functions.

RowFormatUsed for creating simple listings of objects (in command line applications).

Global context >> Experiment definition >>Command line interface

Framsticks Theater

20 Programming: contexts and classes summary 84

21 Software package remarks

The what's new list is available.

21.1 Files and file types

All of the Framsticks data files are text files, so you can view and edit them with any text viewer/editor(notepad, wordpad, type, more, vi, pico). However, manual modification of most of these files is notrecommended and should not be needed. The following files are used:

Type Contents Location

GEN genotypes any

SIM settings for the given experiment definition any

EXPTcombination of SIM and GEN contents (a"snapshot" of some experimentation moment)

any

EXPDEF scripts which define experiment definitions"scripts"subdirectory

NEURO scripts which define custom neurons"scripts"subdirectory

SCRIPT any user-defined scripts"scripts"subdirectory

STYLEscripts which define visual styles for OpenGLgraphics

"3dobj"subdirectory

The detailed technical documentation of file and data formats used in Framsticks is available here.

21.2 Sample files provided

'default.sim' keeps default ("factory") parameters for the simulator. The file is always loaded when theprogram starts.

'f-x.sim' describes more sophisticated world and more complex simulation rules (not intended forevolution – just to play with Framsticks and enjoy simulation).

'manual.sim' is good for testing (creatures do not die etc.).• 'speed.sim' is good for velocity-oriented evolution on the ground. It is originally identical with the'default.sim'.

'swim.sim' is good for velocity-oriented evolution in water.• 'demo-chase.sim' is a setup where creatures try to chase each other and eat food. Use with'demo-chase.gen'.

21.3 Release notes

21.3.1 Simulator

'W' and 'w' (weight) modifiers are temporarily disabled (they work under water only)• in v2.x: destructive collisions, missing from v1.78•

21.3.2 MS Windows graphical user interface

Windows 98/ME or 2000/XP recommended. For Windows 95/98/NT you may need to installupgrades/service packs to fix bugs in Windows OpenGL

Windows NT does not display icons correctly•

21.3.3 Amiga graphical user interface (old)

camera/World Display settings are not saved• problems with window refreshing• the program was not tested with Kickstart 2.0, which may cause some problems• OpenGL window is for viewing only (camera can be moved in World window)•

21.4 Reporting bugs

Please report any bugs to [email protected]. When reporting bugs, be sure to mention these things:

the name and version of the Framsticks program which causes problems,• operating system you are running (with/without service pack, which?),• if the bug is repeatable, and under what conditions? Try to find the simplest sequence of steps toreproduce the problem,

parameters of the simulator when the error occurs,• attach files pertinent to reproducing the bug, like settings, genotypes, and your own scripts,• enclose the "messages.out" file, if some errors are listed there.•

21 Software package remarks 86

22 Events and FAQ

22.1 Framsticks-related events

April 21, 1998: Demonstration on a DEMO session of European machine learning conference,Chemnitz, Germany; a paper.

November 1998: Netherlandish CD-Magazine, C'TROM 18 – demo movies and pictures, projectdescription.

November 17, 1998: CALResCo awards this site as one of the best visual Artificial Life resourcesavailable on the web.

March 1999: Chip and Chip CD Polish edition (3/99) – an article, WWW site, application.• March 17, 1999: an interview for Radio BIS (Poland) – artificial intellgence and artificial life.• March 1999: an interview for Reporter (Poland) – artificial life and artificial intellgence.• May 25-28, 1999: Polish conference "Evolutionary Algorithms and Global Optimization" (a paper).• September 13-17, 1999: Poster, demonstration and paper in the 5th European Conference on ArtificialLife, Lausanne, Switzerland. M. Komosinski awarded for the outstanding work in the field ofArtificial Life.

September 1999: Interview for L'Hebdo, N° 38/99 (Internet version of the article – in French –available here).

October 15, 1999: An open lecture/presentation/demo on "Evolutionary Algorithms and Simulationsof Life", Poznan Univ. Tech., Poland.

November 19, 1999: Framsticks presentation at the LEGO Lab, Aarhus, Denmark.• January 7 and 14, 2000: Interviews/Articles in a Polish newspaper, Glos Wielkopolski.• February 2000: Interview for RMF FM radio.• April 11-14, 2000: INFOSYSTEM 2000 presentation. Country-distributed evolution, remote ONYX2graphical workstation visualization (OpenGL), parallel rendering.

June-July 2000: Evolutionary Art Exhibition "Darwin's coach", Geneva. Framsticks presentation.• July 2000: Framsticks Experimentation Center prototype.• July 2000: Presentation at the 2nd International Conference on Virtual Worlds, Paris, France. A paper.• August 2000: Presentation at the 7th International Conference on Artificial Life, Portland, USA. Apaper.

October 11-14, 2000: Presentation at the sgi2000: SGI Users' Conference, Krakow, Poland.Country-distributed evolution, remote ONYX2 graphical workstation visualization (OpenGL).

December 1-2, 2000: TheoLab – Research Unit for Structure Dynamics and the Evolution of Systems,Jena, Germany. Presentation on the workshop "Evolution and Neural Control of AutonomousSystems".

December 4, 2000: Seminar at the Chair of Systems Analysis, Department of Computer Science,University of Dortmund, Germany.

May 14-18, 2001: Seminar at the meeting "Complexity-Unifying Themes for the Sciences and NewFrontiers for Mathematics" of Santa Fe Institute for the Sciences of Complexity (SFI) and Max PlanckInstitute for Mathematics in the Sciences (MPI). Leipzig, Germany.

September 10-14, 2001: Presentation and paper on the 6th European Conference on Artificial Life,Prague, Czech Republic.

November 13/14, 2001: Framsticks in the Polish TV station, TVN. See snapshots.• December 2001: Two papers: for Artificial Life Journal and for Theory in Biosciences.• February 2002: Article in Software 2.0 (a computer magazine) about Alife, AI, and Framsticks.• April/May 2002: Articles/news in internet information services: PAP, Chip, WP, ONET. Interviewsfor radio: III P.R., TOK FM, Radio Krakow. Television: WTK.

March 2003: "Data Ecologies" workshop in Austria, "the Framsticks day".• September 2003: an interview for the Chip magazine.•

September 2003: International Conference on Computational Intelligence and Natural Computing,North Carolina, USA. A paper and presentation.

March 2004: An article for the "Scientific American" Polish edition.• July 2004: European Framsticks summer school in Lodz, Poland.• February 2005: Framsticks and the Framsticks deathmatch experiment described in the "Software 2.0Extra" magazine.

June 2005: Framsticks chapter in the Artificial Life Models in Software book.• November 2005: Vector eye and sensory-motor coordination experiments presented on the cognitivescience conference.

August-October 2006: Invited lectures at the University of North Carolina at Charlotte, USA.• September 2006: Interview for biota.org group.• November 2006: A paper introducing biologically-inspired sensory-motor coordination model, KES2006: International Conf. on Knowledge-Based & Intelligent Information and Engineering Systems,Bournemouth, UK.

December 2006: Framsticks workshop in Poznan, Poland.• April 2007: Invited lecture at the Robots Festival, Poznan, Poland.•

22.2 Frequently Asked Questions

Who can benefit from using the program/Why is it useful for me?• The program is a very good educational tool. As most of the information needed to use the program isavailable on these pages, the software will let you experiment with complex stick structures ("alive"or not), complex neural networks and a three-dimensional, water and land simulation. The applicationhas a special interface that you will quickly learn and use to build structures, test them, evolve, andimprove. If you study computer science, biology, robotics, physics, mechanics, etc., the program maybe a nice way of learning various topics. If you are a scientist, you may want to explore thecapabilities of the software and use them in a more advanced way (custom scripts and experiments). Ifyou are interested in computer graphics, you can make wonderful movies and pictures. You can alsouse our program to compete/play with other users (for example, who will grow or design a faster orstronger creature?) and for entertainment.You can also take part in a discussion to seek help or express your ideas.

How can I contribute?• You can conduct lots of experiments on your own, from very simple (speed-oriented) to verysophisticated with unpredictable results (spontaneous/open-ended evolutions). You can send us yourcreatures, and you can also take part in the challenges (see here, you may be rewarded!). You can alsodesign your own 3D visualization styles, create your own experiments, and help us with translation ofthe web pages. Or develop helper Framsticks software. If you are interested, please contact us.

Does this project have any practical applications?• The project in its current form is not used in industry. However, every technique used in Framstickshas lots of applications: evolutionary algorithms, optimization methods, neural networks, finiteelement method and the mechanic simulation etc. This research can be useful for people working incomputer science, robotics, biology, physics and many other scientists, and for non-professionals too.The program can be useful for all who are interested in any of the techniques used, also within a "tolearn by playing" approach.The most important goal is to use this program to perform various evolutionary experiments in acomplex environment. The study of achieved results helps understand better evolutionary mechanismsand yields interesting conclusions concerning behavior and structure of emerging creatures.

Why is the program in English only?• Web site translation is very time-consuming. Synchronization of continuous (and numerous!)corrections is a never-ending work. English is the most common scientific language, that is why itwas chosen.

How long does one evolution take?•

22 Events and FAQ 88

A speed-oriented evolution without speciation is relatively short. Assuming that the process beginswith no additional knowledge (starts with a single, simplest organism genotype), the methods ofmovement are usually discovered after several minutes. After a few hours, creatures are quite efficientin locomotion. More sophisticated evolutions (e.g. spontaneous/open-ended) take longer. Of course, itis crucial to adjust parameters properly in order to efficiently use the simulation time.

I would like to add a link to your project from my web pages.• Use http://www.framsticks.com/You can add a picture:

http://www.framsticks.com/files/common/artlife-evol.gif

http://www.framsticks.com/files/common/artlife-mini.gif

http://www.framsticks.com/files/common/artlife-midi.gif

http://www.framsticks.com/files/common/artlife.gif

http://www.framsticks.com/files/common/artlife-maxi.gif

If you need very high-quality graphical materials concerning this project (for printing, video, etc.), do contactus.

22 Events and FAQ 89

23 Framsticks resources (including survey results)

If you have some kind of material to be included here, let us know!

23.1 Documentation

Framsticks Manual: PDF file (includes the tutorial)• Framsticks Tutorial, step by step• A graphical interface (GUI) mini-tutorial• A short tutorial about Framsticks GUI: PDF file• Scripts in Framsticks: useful resources.•

23.2 Exercises and experiments – for teachers and students

Sample student exercises for the Bio-inspired Adaptive Machines course, from Swiss Federal Instituteof Technology, Lausanne (EPFL) - see also bottom of that page for a specification of a few exercisesmore

Interesting experimental exercises from the Virtual Life Lab, including the well-documenteddeathmatch educational challenge

A number of various tasks and ideas•

23.3 Selected publications and their BibTeX entries

M. Komosinski, Sz. Ulatowski, Framsticks: sztuczne zycie – zlozona symulacja stworzen i ichewolucji. W: Materialy konferencyjne III Krajowej Konferencji Algorytmy Ewolucyjne iOptymalizacja Globalna KAEiOG (Proceedings of Evolutionary Algorithms and Global OptimizationConference), Potok Zloty, Poland, May 25-28, 1999, 157-166. [In Polish]

M. Komosinski, Sz. Ulatowski, Framsticks: towards a simulation of a nature-like world, creatures andevolution. In: Proceedings of 5th European Conference on Artificial Life (ECAL99), September13-17, 1999, Lausanne, Switzerland, Springer-Verlag (LNAI 1674), 261-265.

M. Komosinski, The World of Framsticks: Simulation, Evolution, Interaction. In: Proceedings of 2ndInternational Conference on Virtual Worlds (VW2000), Paris, France, July 2000. Springer-Verlag(LNAI 1834), 214-224.

M. Komosinski, A. Rotaru-Varga, From Directed to Open-Ended Evolution in a Complex SimulationModel. In: Proceedings of 7th International Conference on Artificial Life (ALIFE7), Portland, USA,2000. MIT Press, 293-299.

A. Adamatzky, Software review: Framsticks, Kybernetes: The International Journal of Systems &Cybernetics, 29 (9/10), 2000. MCB University Press, 1344-1351.

M. Komosinski, M. Kubiak, Taxonomy in Alife. Measures of Similarity for Complex ArtificialOrganisms. In: Proceedings of 6th European Conference on Artificial Life (ECAL01), September10-14, 2001, Prague, Czech Republic, Springer-Verlag (LNAI 2159), 685-694.

M. Komosinski, G. Koczyk, M. Kubiak, On estimating similarity of artificial and real organisms. In:Theory in Biosciences, 120, December 2001, 271-286.

M. Komosinski, A. Rotaru-Varga, Comparison of Different Genotype Encodings for Simulated 3DAgents. In: Artificial Life Journal, 7 (4), 2001. MIT Press, 395-418.

P. Mandik, Synthetic Neuroethology. In: Metaphilosophy, 33 (1/2), January 2002. 11-29.• P. Mandik, Varieties of Representation in Evolved and Embodied Neural Networks. William PatersonUniversity Cognitive Science Technical Report 2002-03.

M. Komosinski, The Framsticks system: versatile simulator of 3D agents and their evolution. In:Kybernetes: The International Journal of Systems & Cybernetics, 32 (1/2), 2003. MCB University

Press, 156-173.M. Hapke, M. Komosinski, D. Waclawski. Application of evolutionarily optimized fuzzy controllersfor virtual robots. In: Proceedings of the 7th Joint Conference on Information Sciences (JCIS7),September 2003, North Carolina, USA, Association for Intelligent Machinery, 1605-1608.

M. Komosinski, Sz. Ulatowski, Genetic mappings in artificial genomes. In: Theory in Biosciences,2004.

A. Adamatzky, M. Komosinski (Eds), Artificial Life Models in Software.Springer-Verlag, 2005. ISBN 1-85233-945-4.

W. de Back, M. Wiering, E. de Jong. Red Queen dynamics in a predator-prey ecosystem. In:Proceedings of the 8th annual conference on Genetic and evolutionary computation, 2006, Seattle,Washington, USA. ACM Press, 381-382.

W. de Back. Master's thesis, Eco-evolutionary experiments with situated agents, 2006.• M. Hoffmann. Master's thesis, Structural coupling with environment and its modelling on neuraldriven agents, 2006.

23.4 Related web pages and projects

Framsticks Experimentation Center (experiments and genotypes database, news forums and more).• Wiki (projects, news).• Virtual Life Lab in Department of Philosophy & Robotics Lab, Utrecht University. See alsoExperiments in Synthetic Evolutionary Psychology.

From povray sequence to blender: Importing animation of creatures / Importer l'animation descréatures de framstick

Links to artificial life sites: see the "Links" section of the artificial life portal, alife.pl.• [In Polish] Strona Polskich Uzytkownikow Framsticks.•

23.5 Meet some Framsticks users

A lab class. Cognitive Science Laboratory,Department of Philosophy, William Paterson

University of New Jersey/USA.The symposium. Department of Philosophy & Robotics Lab,

Utrecht University/The Netherlands.

23 Framsticks resources (including survey results) 91

Lab classes. European Summer School, Lodz/Poland.The final competition. European Summer School,

Lodz/Poland.

Adaptive Machines course, Lausanne/Switzerland. Adaptive Machines course, Lausanne/Switzerland.

Framsticks workshop, Poznan/Poland. Framsticks workshop, Poznan/Poland.

23 Framsticks resources (including survey results) 92

Send us a photo of your group!

23 Framsticks resources (including survey results) 93

24 Framsticks Tutorial – step by step

This tutorial is also available in Polish.

About this document

The Framsticks Tutorial provides a step-by-step introduction to Framsticks. It covers basic issues related toprogram interface, simulation, genetics, and evolution. The tutorial also refers to a few more advancedfunctions, including writing user procedures, neuron types, etc. This tutorial can be used during Framsticksclasses, and for self-education as well. It requires the Framsticks GUI (available to download from theFramsticks web site) installed on an MS Windows operating system.

If you are a teacher, take some time to go through all steps and do the exercises. We recommend reading theFramsticks Manual first. You may want to skip some parts of the tutorial during the class, depending on yourdiscipline. For example, you may focus either on simulation, genetics, evolution, interactions, or scriptprogramming. Computer science, robotics, biology, cognitive science or philosophy require emphasis ondifferent sections. It is a good idea to first estimate the time needed for students to perform the tasks. Youmight also enumerate the goals that students should be able to learn (or be able to test) after they havecompleted this tutorial. You may ask students to prepare written report (or oral presentation) based on selectedexercises.

If you are a student or want to go through this tutorial to learn Framsticks, we recommend that you firstbrowse the Framsticks Manual. Then start with the tutorial. It is a good idea to ask somebody else (a friend) toindependently do these exercises as well, and later discuss them together and exchange ideas. If some partsare too difficult, you may skip them, and later go through the tutorial again. Refer to the Manual if you misssome information.

The full documentation is available on the official web site and in the Framsticks Manual. This tutorial is nota substitute for the documentation.

BasicsI. Meet Framsticks

Goal: see a few Framsticks creatures, their behavior, physical properties, interactions, etc.

Setting: use the Framsticks GUI for Windows. Set the SimulatorParameters/Experiment/Populations/Creatures/Death to "off", enable OpenGL (if available).This presentation can also be performed using the "Framsticks Theater" and the"presentation" show.

Load "walking.gen" and start the simulation◊ Simulate some interesting creatures: quadruped, lizard, hopping spider, etc. (rightclick on the genotype -> Simulate -> Creatures)

Basic user interface tasks:left button mouse drag: rotate camera⋅ right button mouse drag: pan⋅ left double click: zoom on creature⋅ wheel up/down: zoom⋅ control + left click: grab creature ("manipulator")⋅

1.

shift + right click: select action⋅ right double click: feed (perform first action)⋅

Framsticks GUI

Goal: Get to know the Framsticks GUI and basic concepts of the Framsticks simulator

Simulator Parameters: some parameters should be modified while playing with thecreatures:

Experiment/Populations/Creatures/Death � should be off.Otherwise the creatures could die unexpectedly.

Experiment/Parameters/Simulated Creatures � the simulatorwill spawn that many creatures automatically. Set this to 0 if you don't wantthe simulator to mess with your creatures

Genotype: description (building plan) of the creature. Can be saved in a file.(GUI: menu -> File -> Load/Save genotypes)

Body&Brain Window: click on the genotype to see the physical structure and neuronconnections

Creature: can be built from genotype(GUI: right click on the genotype -> Simulate -> Creatures)(GUI: right click on the creature -> Simulate -> Kill/Delete)

Mechanical simulation: can be MechaStick or ODE (rigid bodies). See theWorld/Simulation engine setting. Try both engines, use the manipulator toplay with creature bodies and note differences.

2.

Learn genetics

Goal: Learn how to design a simple structure in the 'f1' encoding

Click New to create a new genotype◊ Enter the genotype and watch the results in the structure preview window(See also the f1 genotype specification in the Framsticks Manual or in the help)

Enter X � a single line segment (stick) appears⋅ Enter a few more X's and move the cursor along the genotype. The structureview will highlight the corresponding body element. Click on the sticks tohave the corresponding genotype part underlined.

Branching: use parentheses (...) and commas to create tree-like structures.Example: XXX(XX,X). See how the additional commas influence thebranching direction: XXX(,,,XX,X)

Parentheses can be nested, try: XXX(XX,X(X,X)) (go through the genotypewith the cursor to make sure you know which stick is created from each X)

Rotate the branching plane: introduce the R/r modifiers. Insert R's one by oneand watch the resulting structure: XXX(XX,RRRX(X,X))

More shape modifiers: Q C L � insert into the genotype and guess how theywork. See the Framsticks Manual for explanation. Note the general rule:lowercase/uppercase letters have the opposite meaning.

Note that red background means that the genotype is invalid � like "X[", andpink background means a genotype error which can be correctedautomatically � like "X()". Some genotypes are valid in syntax, but problemsarise during building creatures. Try for example the "X[|][|]" genotype, whichhas two identical muscles in the same place in body. As this is invalid, anadditional entry will appear ("Build problems encountered!") in the smallarrow menu in both panels displaying body and brain. Click it to see the listof build problems.

3.

24 Framsticks Tutorial – step by step 95

Exercise 1: Build an interesting shape using this genotype language.◊ Exercise 2: Guess the genotype from the creature's shape

Solution: ask the tutor.

Exercise 3:Can you write another genotype resulting in the same shape?

Conclusion: Limitations of this 'f1' genotype encodingOnly tree-like structures: closed loops not possible (although you can buildan open-loop square easily, try to do it).

The stem and its branches are always placed on the same plane, the followingshape is not possible:

(However, those shapes can be built in Framsticks using another genotype encoding,called 'f0')

Neurons

Goal: add neurons (effectors, receptors) to the creature

Neural net description is mixed with the body genotype, like this: X[1:2]X[-1:3,0:1]XEach entity enclosed in square brackets is a single neuron. The number before ":" isthe neuron reference (0=self connection, +1=next neuron, -1=previous one). Anothernumber (after ":") is the connection weight. No neuron type name is specified, thus

4.

24 Framsticks Tutorial – step by step 96

the default "N" neuron is assumed. See the following examples and ensure youunderstand them well. Enter them as genotypes into the program:

cccXXXXX[0:0][-1:1][-1:1][-1:1][-1:1] (Chain of neurons)⋅ cccX[0:0]X[-1:1]X[-1:1]X[-1:1]X[-1:1] (Different neuron placement in thebody)

cccX[4:1]X[-1:1]X[-1:1]X[-1:1]X[-1:1] (Close the loop)⋅ cccXXXXX[0:0][0:0]X[0:0]X[0:0]X[-1:1,-2:1,-3:1,-4:1] (Multiple inputs)⋅

There are many different neuron types, see "Simulation Parameters: Genetics:Neurons to add" for a quick summary. Examples:

X[Sin,f0:0.1]� "Sin" is a neuron type (Sinus generator)� then you have to write a comma (another, obsolete � and more complex �notation does not require this comma, but let's use the simpler and newernotation)� "f0" is the property of the Sin neuron � a base frequency for the sinusgenerator

X[T][G][S][-3:1,-2:1,-1:1] � 3 receptors connected to a single neuron⋅ XX[T][-1:1][|,-1:1] � receptor (touch sensor) -> neuron -> effector (muscle)⋅

You can have a look at the f1 encoding reference.◊ Brain control

Goal: Monitor and control "living" neurons

Start with a simple version of our previous genotype: X(X,RRLX(X,X,X),X) (onesegment instead of three)

Add two strong muscle neurons. Set the muscle power ("p" property) to maximum(1):X(X,RRLX[|,p:1][@,p:1](X,X,X),X)

Make sure the simulator parameters are as follows:Experiment/Populations/Creatures: Death is disabled⋅ Experiment/Populations/Creatures: Neural net simulation is "Immediate"⋅ Experiment/Populations/Creatures: Performance calculation is "Immediate"⋅ Experiment/Parameters: Simulated creatures is set to 0⋅

Build a creature from this genotype and startthe simulation (Simulate -> Creatures,Simulation -> Run). The creature appears inthe world and on the populations list.

Select the creature by clicking on the populations list. This will associate theBody&Brain window with the living creature (and not with the genotype) and zoomthe camera on it.

Double-click on the first neuron in the Body&Brain window (on the neural netdiagram).

The tiny window inside the diagram is a probe. It can be used to display and changethe signal. Drag the thick black handle up and down. You can see the immediatemuscle response � the creature moves. Try to find the best signal pattern to make thecreature go forward.

5.

24 Framsticks Tutorial – step by step 97

Add the velocity indicator to the populations list: right click on the populations list ->"Show columns" -> "Velocity". Now you can read the current velocity whilecontroling the creature.

Click the red hold label to release the neuron output.◊ Brainbuilding

Goal: Make the creature move on its own

We will use the "Sin" neuron (sinus generator) to obtain the required pattern.

Connect the new Sin neuron:

X(X,RRLX [N] [Sin,f0:0.02,-1:0.1][*] [N,-2:1.5,-1:0.4][|,-1:1,p:1][@,p:1](X,X,X),X)

Explanation:⋅ [Sin,f0:0.02] is the sinus generator with constant output frequency of 0.02⋅ -2:1.5 means "connect to the second previous neuron, weight 1.5"⋅ [*] is a neuron which produces a constant value of one (1).⋅

Build the creature and select it on the list. The creature moves!◊ This time the probe will show the varying signal for the generator, neuron and themuscle. Add the first probe to the neuron in front of the muscle. Click and hold theleft mouse button on the "1x" label and drag to the right. This will increase the timerange of the displayed signal making it more readable.

Add the second probe to the neuron in front of the Sin generator. Move the handle upand down slowly. This way you can control the frequency of the generator, becausethe Sin generator changes its frequency according to the input signal. Observe thefirst probe.

Exercise 1: Set Experiment/Populations/Creatures: Performance sampling period =1000. Find the optimal pattern (resulting in the highest velocity). You can change thegenerator frequency and the constant value (the second input for the neuron in frontof the muscle).

Add another probe to the second muscle. Try to make the creature turn left or right bychanging the signal.

Exercise 2: Make a creature that can turn towards food. Youcan start with this genotype:X(X,RRLX [Sin,f0:0.02] [*] [N,-2:1.5,-1:0.4] [|,-1:1,p:1][@,1:1,p:1] [1:0,2:0](X[S],X,X[S]),X)The new [S] receptors, placed on the creature's "head", willprovide different signal values when the food is close to either side of the creature.Can you use this information to set up the proper weights in the controlling (middleon the picture) neuron? Adjust weights so that the creature does not turn over when itturns!

Exercise 3: Using the "Energy" sensory neuron and a genotype from exercise 1,make a creature that moves fast (high frequency of the pattern generator) when has alot of energy, and slows down gradually until it dies. Then implement the opposite

6.

24 Framsticks Tutorial – step by step 98

behavior.Communication7.

Goal: Make the creatures talk to each other

The creatures we built in previous exercises can already sense the environment in one simpleway: looking for energy sources. Now it's time for a more dynamic interaction: usespecialized neurons to send and receive signals between creatures.

Disable energy calculation or death, set Experiment/Populations/Creatures: Neuralnet simulation to "Immediate"

Build the following creature (name it Sender): X[Sin][Light,-1:1] and examine itsbehavior.As the name suggests, Light is the light-emitting effector. Connecting it to a sinegenerator creates a periodically flashing device (for positive values of sinus). Notethe grid of squares appearing while the light is on – that's the way Framsticksvisualizes signal strength.

Add more Senders◊ Try controlling the Light effector using a neural probe.◊ Now let's design the other end – the Receiver: XX[SeeLight][|,-1:1]Add several Receiver creatures and examine their reaction to light signals.

Deleteallcreatures,leavingonlyoneSender,andaddthefollowinggenotype(called Feedback):X(X,X[*][SeeLight][Light,-1:1,-2:-0.5]) Place several Feedback creatures and one Sender, forming a line. Each Feedbackreacts to incoming light by enabling its own light emitter, but only above the certainactivation threshold (depending on the input weight of the * neuron). The wholechain of creatures acts like a light conductor, passing the signal between creatures.Note: You may need to carefully adjust the distance between Feedback creatures –bring them closer if there is no reaction, increase distance if their mutual influence istoo big.

Make the light signal propagate more slowly. How could this be achieved?◊ Can you make a cockroach (a creature that avoids light and looks for food when it'sdark)?

See the Fireflies show (Framsticks Theater). Experiment with the basic Fireflygenotype in the Framsticks GUI:X[SeeLight] [*] [-1:2.26,6:-2,in:0.01,fo:0.01,si:1] [*][-2:1,-1:-0.5,si:9999,fo:1,in:0] [*] [-2:2,-6:0.3,-1:-0.4,in:0.01,fo:0.01,si:1] [*][-2:1,-1:-0.5,si:9999,fo:1,in:0] [Light,-1:-1]

Imagine evolution of fireflies. Our goal would be to get creatures that synchronizetheir flashing despite random starting conditions. How would you define the fitness

24 Framsticks Tutorial – step by step 99

function? How a creature would be evaluated?Read the light.neuro and seelight.neuro files – they implement simplecommunication neurons we used in this section. Adding more communicationchannels is as easy as copying these files. See also the Scripting section below.

See the Boids show (Framsticks Theater) or Boids expdef (Framsticks GUI) for moresophisticated inter-creature communication involving scripting.

EvolutionII. Evolutionary Optimization

Goal: Let the evolution improve your creatures

In the previous exercises, we tried to make fast moving creatures by hand. Let's see if theevolutionary algorithm in Framsticks can be used for this purpose.

Delete all genotypes and creatures (or restart Framsticks if you previously changed alot)

Add the following genotype:X(X,RRLX [Sin,f0:0.02] [*] [N,-2:1.5,-1:0.4][|,-1:1,p:1] [@,p:1](X,X,X),X)(this genotype is simplified because the Sin generator input is removed)

Set the simulator parameters:Experiment/Populations/Creatures: Death: enabled⋅ Experiment/Populations/Creatures: Neural net simulation: "Afterstabilization" (and the same setting for Performance calculation)

Experiment/Populations/Creatures: Performance sampling period: 1000⋅ Experiment/Parameters: Gene pool capacity: 20⋅ Experiment/Parameters: Simulated creatures: 1⋅ Experiment/Parameters/Selection: Crossed over: 0 (why we don't wantcrossing over?)

Experiment/Parameters/Fitness: Velocity: 1 (all other: 0)⋅ Genetics/f1/Morphology: All set to 0 (we don't want to mutate the body)⋅ Genetics/f1/Neuron net: Add/remove neuron and Add/remove neuralconnection set to 0, all other: 1

Open a chart. Go to Interface options -> simulator charts, select property "Genotypes:Fitness: Average Fitness", click Apply, click Add chart. Select property "Genotypes:Fitness: Maximal Fitness", click Apply, click Add chart. Close the window (pressESC), and show charts window by pressing [Shift-F6]. Think about the expectedshape of these charts, explain why.

Start the simulation. Watch the gene pool window. You can sort the "velocity"column to see if the evolution is making progress. Press [F9] to hide windows andmake the evolution run faster ([Shift-F4] will show the window with genotypes). [F4]restores the default layout.

There are many parameters influencing the algorithm. See the "parameters reference"in the Framsticks documentation.

Who is the winner? Is the evolved creature better than your hand-tuned one?◊ Identify what parts of the original genotype were changed by evolution, and what isthe meaning of changes.

Have a look at the charts. Compare average and maximal fitness (speed). Were yourexpectations correct?

Try to guess what might be the results of evolution if you set theExperiment/Populations/Creatures: Neural net simulation: "Immediate". Then clearall gene pools and populations and test your hypothesis experimentally. Set allparameters appropriately, clear charts, run the evolution, and compare its outcome to

1.

24 Framsticks Tutorial – step by step 100

the previous results.Tall structures, designed and evolved

Goal: compare manual design and evolution in the task of building tall creatures

Try to build as tall as possible, but stable, creature, using the 'f1' genetic encoding. Donot use neurons, just body. Save its genotype in a file, e.g. "my_tall.gen".

Exit Framsticks and launch it again (to ensure all parameters have their defaultvalues).

Set the simulator parameters:Experiment/Populations/Creatures: Death: enabled⋅ Experiment/Populations/Creatures: Neural net simulation: "Disabled"⋅ Experiment/Parameters: Gene pool capacity: 20⋅ Experiment/Parameters: Simulated creatures: 1⋅ Experiment/Parameters/Fitness: Vertical position: 1 (all other: 0)⋅

Add a simple X genotype.◊ Start the simulation. Watch the gene pool window. You can add the "Verticalposition" column (right click on genotypes list) and sort it to see if the evolution ismaking progress. Press [F9] to hide windows and make the evolution run faster([Shift-F4] will show the window with genotypes). [F4] restores the default layout.

Who is the winner? Is the evolved creature better than the one you designed?◊ Try to guess what might be the results of evolution if you set theExperiment/Populations/Creatures: Neural net simulation: "Immediate". Then clearall gene pools and populations and test your hypothesis experimentally. Set allparameters appropriately, run the evolution, and compare its outcome to the previousresults.

2.

Two-criteria optimization

Goal: discover multi-criteria optimization and related issues

Now you will have to evolve creatures that are both tall and simple. Look at theExperiment/Parameters/Fitness settings. You have to maximize "Vertical position"and minimize the number of "Body parts" at the same time.

Suggest the fitness function. Think about the values of vertical position and bodyparts. Enter your weights for these criteria, press apply, and then check theExperiment/Gene pools/Genotypes/Fitness formula.

What is the disadvantage of this way of computing fitness?◊ What is "normalization"? Try to guess the meaning ofExperiment/Parameters/Fitness/Criteria normalization.

Perform the experiment with evolution. Is the result satisfactory? If you haveproblems with getting interesting results, identify the reasons and ways ofovercoming this situation. Repeat the experiment again a few times or compare yourresult with your friends' results. Who has the best tall-and-simple creature? Considerboth criteria and try to compare all best evolved creatures.

3.

Additional exercisesIII. 'f0' genetic encoding

Read the section on the 'f0' encoding from the Framsticks Manual.◊ Build the following shapes: square, cube, tetrahedron, a tent. First draw these shapeson a sheet of paper and specify the 3D coordinates.Then suggest some other simple, but interesting shape, and build it.

Build a simple neural network with three neurons connected in a line (Touch, N,Bending muscle). Change the placement (embodiment) of the Touch sensor in the

1.

24 Framsticks Tutorial – step by step 101

body (assign it to different Parts).Check the 'f0' genotypes converted from their 'f1' analogues. Enter simple 'f1'genotypes (bodies and also bodies with brains), like the ones from section I.4, press"Apply" each time, and then inspect and understand the "Conversion: f0 genotype"field.

Evolution using 'f0'Repeat the experiments II.2 and II.3, this time using the 'f0' genetic encoding. To doit, empty the gene pool and populations, run the simulation and choose the simplest'f0' genotype from the list of choices. First formulate your expectations as to thedifferences between 'f1' optimized creatures and 'f0' optimized creatures. Later verifyif you were right.

◊ 2.

Another experiment definitions

Goal: see how the Framsticks simulator can be controlled by experiment definition scripts

Restart Framsticks. Set Experiment/Experiment definition to "neuroanalysis". Press"Apply". Read the Description. Close the parameters window. Load "walking.gen".Open the parameters window and press "Initialize experiment". Close the parameterswindow and run the simulation. Close the world window to speed up simulation. Donot touch anything until the simulation is automatically stopped. Then inspect somegenotypes and have a look at their Genotype/Info field. Discuss how the informationcomputed by this experiment definition can be used and what is the meaning of thesevalues.

Restart Framsticks. Set Experiment/Experiment definition to "reproduction". Press"Apply". Read the Description carefully. Press "Initialize experiment". Close thewindow and run the simulation. Open the Messages window. Watch the simulation.

Can you tell what is the maximal possible number of living creatures?1. Is it possible that all creatures die out?2. Can you tell how to predict the number of creatures that will appear?3. Is the evolutionary improvement taking place in such a setup or not?4. What is the difference between this setup and the experiments from sectionII?

5.

Restart Framsticks. Set Experiment/Experiment definition to "learn_food". Press"Apply". Read the Description carefully. Press "Initialize experiment". Close thewindow and run the simulation. Test the influence of theExperiment/Parameters/Share knowledge parameter on the system. See alsoExperiment/Parameters/Energy/Food placement parameter.

3.

ScriptingIV.

Goal: to learn using FramScript and understand its importance and potential

Value types and their conversions

In the Framsticks GUI open the Console window. Issue the following commands, one by one:

? 2+3? 2.0+3? 2+3.0? "a"+2? ""+2+3? 2+"12"? "2"+12? Math.time? Math.time%1000

1.

24 Framsticks Tutorial – step by step 102

? (0+Math.time)%1000? (0+Math.time)%1000

Try to explain how the results were computed.

Now first guess the result, and then check if you were right:

? 2.0*3? 2*3.0? 1+2.0*3.0? 1.0+2*3? 2*3.0+0.0? (2*3.0)+0.0? 2*(3.0+0.0)? 7+"3"+4? 7+("3"+4)? 2*3.5? 2*3.99

Hexadecimal notation can be helpful:

? 0xA? 0xff+10? 5+"0xf0"? "0xf0"+5

Now meet the arrays (the two last lines are intentionally incorrect):

? ["aa",4,"5"][0]? ["aa",4,"5"][1]? ["aa",4,"5"][2]? ["aa",4,"5"][Math.random(3)]? ["aa",4,"5"][3]? [aa,4,"5"][0]

Now some more values and their types, but introducing variables:

var a; a=5; Simulator.print(a);var a; a=5; a=a+3.0; Simulator.print(a);var a; a=5; a=3.0+a; Simulator.print(a);var a; a=5; a="abc"+a; Simulator.print(a);var a=5; Simulator.print("abc"+(0.0+a));var a=["aa",4,"5"]; Simulator.print(a[2]+3);

Types again, now using the typeof operator to check the type of expression in run-time:

? typeof(5)? typeof(3.0)? typeof(5+3.0)? typeof(3.0+5)? typeof("some text")? typeof("some text"+3)? typeof(3+"0")? typeof(null)

Comparisons, conversions and detecting null ("empty value"):

? 4==4.0? 4=="4"

24 Framsticks Tutorial – step by step 103

? 4=="5"? 4<"5"? null==0? null==0.0? typeof(null)==typeof(0.0)

A little puzzle � discover why:

? 44<"5"? "44"<5

? "blahblah"!=0? 0=="blahblah"

Further FramScript information can be found here.Scripting sample

Now have a look at this piece of code. Study every line to ensure you know how it works.

World.wrldsiz = 150; //make the world largeGenePools.clearGroup(0); //delete all genotypes in the first gene poolPopulations.clearGroup(0); //delete all creatures in the first populationSimulator.import("encoding_f1_best.gen", 2); //load genotypes from fileGenePools[0][7].genotype="X"; //this genotype is missing in the file...GenePools.group = 0; //select the first gene poolPopulations.group = 0; //select the first populationvar i,x,y;for (i=0; i<30; i++){ GenePools.genotype=i; //select i'th genotype (from 0th to 29th), and... var c=Populations.createFromGenotype(); //construct a creature made from the selected genotype x = 20+(i%10)*9; //compute target coordinates... y = 30+(i/10)*20; //discover how the values of x and y are computed! c.moveAbs(x - c.size_x/2, y - c.size_y/2, c.pos_z); //and move the center of the creature}

If you are using Framsticks in version older than 3RC4.8, use the following script instead:

World.wrldsiz = 150; //make the world largeGenotypeLibrary.clearGroup(0); //delete all genotypes in the first gene poolLiveLibrary.clearGroup(0); //delete all creatures in the first populationSimulator.import("encoding_f1_best.gen", 2); //load genotypes from fileGenotypeLibrary.getGroup(0).getGenotype(7).genotype="X"; //this genotype is missing in the file...GenotypeLibrary.group = 0; //select the first gene poolLiveLibrary.group = 0; //select the first populationvar i,x,y;for (i=0; i<30; i++){ GenotypeLibrary.genotype=i; //select i'th genotype (from 0th to 29th) var c=LiveLibrary.createFromGenotype(); //and construct a creature made from the selected genotype x = 20+(i%10)*9; //compute target coordinates... y = 30+(i/10)*20; //discover how the values of x and y are computed! c.moveAbs(x - c.size_x/2, y - c.size_y/2, c.pos_z); //and move the center of the creature}

If you discovered how the coordinates are computed based on the number of creature(varialble i), now ensure that the simulation is stopped, copy this piece of code, paste it intothe console window, and execute it. See how the creatures are located: make the worldwindow full screen and rotate the world.

2.

24 Framsticks Tutorial – step by step 104

As you can see, this piece of code automates many operations.Your own fitness functions

Have a look at the Experiment/Gene pools/Genotypes/Fitness formula. This formula isautomatically updated each time you change weights for the optimization criteria. However,you can create the fitness formula according to your wishes using if ... then, temporaryvariables, loops, etc. First you have to learn about the fields you can use in the fitnessformula. In the Framsticks GUI, choose menu "Help" and "FramScript: reference". Check the"Fitness formula" context and the "this" class, its methods and values ("attributes").

Then see the "Math" class in the global context. Now is the time for your experiments.Implement the following fitness functions, and for each function, explain its meaning andverify it practically. Take care of special situations (divisions by zero, square roots ofnegative values, etc.).

Number of Joints + 0.01 * number of Neurons1. Square root of velocity2. (Number of Parts + number of Neurons) divided by the number of neural connections3. Conditional fitness: if a creature has less than 5 Parts, then fitness is creature height.Else fitness is creature height diminished by 0.1*(number of Parts minus 5).

4.

(advanced task) Fitness is the number of Joints divided by the volume(size_x*size_y*size_z) of the Model made from Geno.

5.

3.

See more scripting resources including the full reference for contexts, classes and methods.Your own neuron classes

If you are going to write larger pieces of code in FramScript, consider usingFramclipse.

1.

Find the "scripts" subdirectory within the Framsticks installation directory. Have alook at file extensions and their contents. Then view the "threshold.neuro" file. The*.neuro files have three parts: preamble (basic neuron description), code (delimitedby the ~ signs) and properties (neuron parameters). Look at the file carefully anddiscover how exactly the threshold neuron works. Then run Framsticks and use thegenotypeX[*][Thr,-1:1,t:-0.2,hi:0.3,lo:0.8]to test it.

2.

Now have a look at the source of the noisy neuron (the noisy.neuro file). Can youexplain how it works? (a brief description of this neuron is also available in theFramsticks chapter of the book Artificial Life Models in Software). Find out whatgenotype to use to test this neuron. Then verify if your explanation was correct.

3.

Discover what procedures ("methods") can be used in FramScript. In the FramsticksGUI, choose menu "Help" and "FramScript: reference". Take some time to browsevarious classes that come to your attention. Check out the "Math" class, its methodsand values ("attributes").

4.

Copy or save the noisy.neuro under the different name (exa.neuro) but in the samedirectory. Edit this file and change the neuron name by modifying the appropriateline: "name:ExA" (neuron names must start with a capital letter). Long name shouldbe "Exercise A". Now try to modify the function go() so that the output of the neuronis the sinus function. Save the file, restart Framsticks, see the Messages window forerrors. If everything is fine, create a genotype to test your ExA neuron. If your neuroncode was invalid, try to correct it or ask the tutor.

5.

4.

24 Framsticks Tutorial – step by step 105

Now there comes the real exercise (a).You have to design the neuron whichoutputs the signal as shown on the figure.Note that your ExA neuron should haveone parameter (t) to set the period of thispattern (the number of simulation stepsafter which the pattern repeats). Instead ofrestarting Framsticks each time to loadyour new neuron code, try clicking the Simulation Parameters/User scripts/Reloadneuron definitions.

6.

If you were successful, solve the next three tasks. For each of them, create a separatefile (exb.neuro, exc.neuro, exd.neuro). In Exercise (d), you need two parameterswhich specify the widths (in time steps) of the high and low output states. For sometasks, you may need to introduce the init() function to initialize some Fields. Ask thetutor if you cannot cope with some problem, or skip this problem if you cannot gethelp.

7.

There are five more challenges for you! First, build a neuron which makes the inputsignal smooth by averaging the current input with the two previous inputs. Useweighted input sum, not individual inputs.

8.

Then build a neuron which outputs the maximum value of its inputs. Design theappropriate neural network to test it.

9.

Then build a neuron which multiplies the first input by the second one, and outputsthe result.

10.

Then build a memory cell. The first input is the value to save. The second input is thecontrol signal: if it is less than zero, then your neuron should memorize the first inputvalue (and output it). If the control signal is zero or more, your neuron should outputthe memorized value regardless of the first input.

11.

Finally, build a neuron which outputs two values at the same time using channels.Your neuron should compute weighted input sum and output it as (always) positivevalue in the first channel, and (always) negative in the second. Later you can use theChSel neurons to select a single channel from a multichannel output.

12.

Note that although we designed regular neurons here, the go() function can use informationabout the world and other creatures, so you can easily design your own sensors. Effectors canbe built as well, but in most cases you need to modify the experiment definition script tomake them work properly.Your own macros5.

24 Framsticks Tutorial – step by step 106

Find the "scripts" subdirectory within the Framsticks installation directory. Have alook at the contents of files with extension ".script". They are similar to the *.neurofiles, right? And also have the "code:" section

Now analyze carefully and ensure you understand "neuroclsreport.script","foodcircle.script", "creaturescircle.script" and "gallery.script". In the FramsticksGUI, find the Simulation Parameters/User scripts. You can run the scripts to see howthey work.

Remember the sample in section IV.2? It can be saved in a *.script file and executedwith just one click.

If you want to experiment and modify some .script file, first copy it with a differentname. Then modify the source and restart the GUI to test your changes. Alternatively,you can test your macros by pasting their source to the console window. When youare done, implement the following macros:

arrange all living creatures (from population #0) in a square (and issue a messagewhen there are no creatures to arrange)

1.

as above, but the tallest creature should stand in the middle2. arrange them in a line, according to their height3. increase the water level in the World by +0.54. print a report � display the number of objects (genotypes, creatures) in all gene poolsand populations, and the names of gene pools and populations

5.

for each genotype, add 10 mutants to the gene pool. The original genotypes shouldremain unchanged, and mutants should have numbers appended to their originalnames

6.

jiggle creatues! for all creature groups, for each living creature, for all its MechPart's,add a small random number to its velocity. It is a good idea to put the jigglingfunction in the experiment definition, and run it e.g. every 200 simulation steps.

7.

(advanced task) as above, but for all MechParts with the Touch neuron, add a smallconstant number to MechPart.vz

8.

If, for some reason, you would like to save some data in a regular file duringsimulation, you can use the File object. See thescripts\neurof0html.script, no need to understand in detail how it works,but it illustrates how the File object can be used. You can run this script and see thefile created in the scripts_output subdirectory.

Command-line interface (CLI)

Goal: meet the Framsticks CLI and learn how to use it for automated experiments

Download the CLI and prepare it for use.1. Run "frams". Enter "lm". Inspect the "frams.ini" file, pay attention to the init()function and learn how macros are associated with implementing functions.

2.

Experiment with the following macros: im, sa, st, lg, lc, qu.3. See that you can enter commands as in IV.1.4. load "walking.gen", set the gene pool capacity to 20 (using FramScript), run thesimulation until 100 creatures are evaluated (using FramScript while loop), and saveresults to "walk2.gen".

5.

Create a "cmds.txt" file with the commands you issued in the recent exercise, quitframs, and use it in batch mode. Run the Windows (or Linux) command-lineinterpreter (cmd.exe or sh), and enter:

frams < cmds.txt

6.

6.

24 Framsticks Tutorial – step by step 107

Learn how to use parameters in the command line � enter

frams --help

and then, for example,

frams "? 2+3" "lo walking.gen" "lg" "qu"

7.

Make neuroanalysis.expdef evaluate all genotypes from walking.gen, and then savethe resulting gene pool ("sa walk-analyzed.gen"). If you use an experiment definitionother than standard.expdef, you have to set it as an argument in command-line likethis: frams "ex neuroanalysis". Don't forget about initializing theexperiment.

8.

Create a "cmds-neu.txt" file with the commands you issued in the recent exercise,quit frams, and use it in batch mode.

9.

Your own experiment definition

See the scripts/*.expdef files, choose some simple expdef, discover what "onSomething"events are implemented, save the expdef with a different file name, modify it, restart the GUI,and test your modifications. Have a look at simple learn_food.expdef andgenerational.expdef. If you successfully completed previous tasks, you are now ableto implement your own definitions of experiments. Some ideas for experiment definitions tocreate:

Compute Genotype's distance as a difference between the place of birth and the placeof death.

1.

Compute fitness as the height of the topmost Part, averaged during the life span(measured in onUpdate events).

2.

Cleaning: when two creatures collide outside of the world center, move the biggerone to the world center. If this place is already occupied (collision with anotherobject, use LiveLibrary.creatBBCollisions), the creature is moved higher.

3.

Fight for resources (arena): creatures are born on two sides of a spot and the onewhich is able to cover most of the spot gets higher fitness.

4.

Pursuit and evasion: two gene pools, two contradictory fitness functions, one groupof creatures is evolved to escape, the other one � to follow them.

5.

7.

Your own Framsticks Theater show

See the scripts/*.show files, choose some simple show, discover what "onSomething" eventsare implemented, save the show with a different file name, modify it, restart the theaterapplication, and test your modifications. You have to use a registered version of the theater totest your new shows.

8.

Your own OpenGL style

Have a look at the 3dobj/*.style files. Proceed similarly as described above. Read the tutorialon scripting, it includes a related example. You need a registered Framsticks GUI to test yournew OpenGL styles. See also the Spooksticks story.

9.

24 Framsticks Tutorial – step by step 108

25 If you have questions

If you have questions or problems that were not resolved by available documentation, help, and publications,have a look at the on-line forums, where Framsticks users can share ideas and help each other. Before asking aquestion, please check the documentation.

Or you may want to contact Framsticks authors.