Genotype encodings 

The Framsticks simulator supports various genotype formats. A "format" (i.e., a genetic encoding) is a language you can use to describe creatures. The properties of this language are extremely important from the viewpoint of evolution, because mutation and crossing over create new genotypes expressed by such a language.

The genetic encodings form a hierarchy (or a graph) like this:

Each ellipse above corresponds to a single genetic encoding and each encoding has their own operators of mutation and crossing over. Some of the encodings are higher level, so genotypes in such encodings are translated into other, lower level encodings (like fBfH). Ultimately, in order to be able to build a phenotype (a creature), an encoding must be translatable into f0 or f0s, which describe all basic building blocks needed for simulation.

The diagram below shows a more complete story. After a genotype expressed in any genetic encoding has been translated to f0 or f0s, this lowest-level representation can be used to build a phenotype (a "Model", as we call it in Framsticks). The Model is not alive, the neural network is not active and there are no forces from the environment. But a Model can be put into simulation, as the diagram below illustrates.

You may ask: "but how these genotypes actually look like?" They are strings of characters, but as mentioned above, each genetic encoding is a different language. The diagram below shows one simple genotype for each encoding – just as a single example of an infinite number of genotypes that can be produced by each of these encodings. One line in all diagrams is dotted – this is because the fn genetic encoding is specific: it does not produce any interesting phenotypes; instead it just encodes a list of real numbers for separate optimization experiments.

Note that in the diagram above, each genotype (except from the f1 genotype) starts with a "comment" indicating its format (encoding). Also note that in this diagram arrows do not mean "this particular genotype is translated into the other one". Arrows concern the translation of genetic encodings, and genotypes are given only as examples. Since we have only one genotype as an f0 example, it obviously is not a translation of many different genotypes, each in a different encoding, whose arrows point to f0.

If you are a Framsticks beginner, read about the f1 format first. For some people, the f0 or f0s format is even easier.

f0/f0s A low-level format which allows for building any creatures (least restrictive)
f1 An easy-to-use recursive language
f4 Describes the way of growing an organism (developmental encoding). Learn about f1 before reading f4
fH Describes how basic parts of an organism are joined
fB Encodes fH 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
fL A parametric Lindenmayer system (L-system) – rules of body and brain development
f9 "3D turtle" (just six capital letters for Left, Right, Down, Up, Back, Forth). Cannot encode the neural network
fF Foraminifera 10-parameter encoding
fS An encoding for solid shapes, inspired by f1
fG Gene regulatory network
f0Fuzzy Used for the evolution of fuzzy control systems embedded in f0 genotypes (see paper 1, paper 2 and video)
fn A special encoding for numerical optimization – just a vector of real numbers. See oper_fn.cpp for details.
... other encodings are easy to add


The "Comparison of Different Genotype Encodings..." research paper contains more formal and detailed description of f0, f1 and f4, their properties, and mutation and crossover operators. To learn about fH, fB and fL, refer to this master's thesis.

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

Although some genotype formats may look complicated, the direct ones are easy to learn. Just open the "new genotype" window and experiment with genotypes. You can enter anything valid and get an immediate preview! Select genes to see which creature parts are created by these genes. Click on creature parts to see which genes created them. This mechanism is explained in Genetic mappings in artificial genomes.

You can find sources of selected encodings in the SDK.