f0 Syntax
Each line in f0 describes one object in the model. Lines starting with the '#' sign are considered to be comments 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 of properties 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 property names are not recommended as they may be misinterpreted by future GDK versions with different property sets. There is an exception for easier editing: skipping inside the "natural" (= "unlikely to change") property sequences like x,y,z is allowed, you can write "x=1,2,3" instead of "x=1,y=2,z=3". (Such exceptional properties are marked by flag 1024 in the property definition, see Param::flags(int i) ). You can also skip the whole definition of a property and accept the default value. If you want to pass special characters (for ex. a comma) 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 sequence |
ob: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: |
f0 Semantics
Parts, Joint and Neurons have reference numbers used to attach other objects. References start with 0 and every new object in the class gets the next reference number.
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
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, you must 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) relative to the first part (p1). Orientation can influence some of the effectors/receptors and can be used as growing 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 as displacement applied to the second part (p2) relative to the first part (p1). Local coordinate system of p1 is first rotated (as defined by [rx,ry,rz]) and then translated by [dx,dy,dz]. This technique allows you 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
Neuron object
Creates instance of the Neuro object.
A signal processing unit, sensor, or effector. Neuron reference number is used in f0docneuroitem definition.
- 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
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)
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)
f0 Examples
To see these in Framsticks application, you have to start writing f0 genotype with "//0" (two slashes and zero and new line). The shortest f0 genotype is a single Part:
p:
A single stick, "X" in f1
p: p:1 j:0,1
Three sticks in line, "XXX" in f1, no "delta option" - absolute coordinates used in all parts
p: p:1,m=2 p:2,m=2 p:3, j:0,1 j:1,2 j:2,3
Three sticks line, "XXX" in f1, with "delta option" - relative positioning (dx=1)
p: p:m=2 p:m=2 p: j:0,1,dx=1 j:1,2,dx=1 j:2,3,dx=1
Three sticks star (120 degrees), "X(X,X)" in f1, no delta option, absolute coordinates are awkward and the sticks' length cannot be seen
p: p:1, m=3 p:1.50017, -0.865927 p:1.50017, 0.865927 j:0, 1 j:1, 2 j: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=3 p: p: j:0, 1, dx=1 j:1, 2, rz=-1.047, dx=1 j: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:1 j:0, 1, dx=1 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G n:p=1 n:j=0, d=@:p=0.25 n:p=1, d=T c:0, 2 c:0, 3, 2.3 c:1, 0 c:3, 0, 3.4 c:3, 3, 4.5 c:3, 5, 5.6 c:4, 3
Cyclic structure, parts are connected 0->1->2->3->0. Not possible in f1 or f4 formats.
p:0,0 p:1,0 p:1,1 p:0,1 j:0,1 j:1,2 j:2,3 j:3,0
