Bodies of creatures are divided into small pieces (at sticks' ends) which are ideal material points. This approach is called "finite element method": not every point of a material body is simulated – only a finite number of points, representing small volumes in the body. The simulator calculates all the forces affecting a given point: gravity, elastic reaction when joined with other points, ground reaction and friction when touching the ground, etc.
In our model some assumptions are taken to simplify calculations. A primitive but fast numeric integration method is used, so the results are not very exact when dealing with big forces.
|
The picture on the right shows sample forces calculated in the Framsticks physical simulator, Mechastick. The body is made from parts (points) and joints (sticks, rods). | ![]() |
Neural network is made from neurons and connections.
The Framsticks simulator supports many types of neurons (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 and editing scripts/*.neuro files.
Note: For most neurons, multiple inputs do not have idividual meaning and are aggregated with respect to their weights (weighted sum is computed).
| Neuron type | How simulated | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| N and Nu (sigmoid neurons) |
In each simulation step: #define NEURO_MAX 10.0 input=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;
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.
* | (constant output)
Outputs the value of 1.
|
Rnd | (random noise)
Outputs random values (uniform distribution) in the range of –1..+1
|
Sin | (sinus generator)
|
The output sinusoid has frequency
Fuzzy | (fuzzy control system) See this paper for details; see this movie for demonstration.
| |
Sigmoid neurons (with short name N) use a simple weighted sum of input signals. Excitation influences neuron state, which has some inertia. Stronger signals can change the state faster than weak signals. Output is flattened to a [-1,+1] range using basic sigmoidal function. See examples below: (input/state/output)
| Simple excitation. The state goes up when the input is positive and falls down when theinput reaches zero. Note that in this example the neuron's state can fall below zero due to its inertia. | ![]() |
| Short but strong impulse gives similar results to a weak and long one. | ![]() |
| In this example a strong signal causes saturation of the neuron (its state goes very high). Later signal changes do not influence the output. | ![]() |
| Force=0.1, inertia=0 Slow state change. Note the instant reaction after the input signal pulse when inertia is disabled. |
![]() |
| Force=0.1,
inertia=0.8 With inertia enabled, the neuron's state rises above the input pulse amplitude, and then drops below zero. The final state is achieved after several oscillations. |
![]() |
| Force=1, inertia=0 Maximum 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 the N neuron are as follows:
velocityt = velocityt–1 · inertia + force · (inputt – statet–1)
statet = statet–1 + velocityt
| outputt = |
| – 1 |
The following pictures show sample usage of the sigmoid parameter.
| Sigmoid=2.0 Default. | ![]() |
| Sigmoid=10.0 High values nearly produce a threshold function. | ![]() |
| Sigmoid=0.5 Low values give a nearly linear output function. | ![]() |
Basic muscles (actuators) and receptors (sensors) are illustrated below.
|
A muscle neuron ('|' or '@' in genotype)
can change the relative orientation 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 stays straight when the signal is equal to 0. Positive and negative values bend the constructon in the opposite directions. | ![]() |
![]() |
The "G" receptor (gyroscope, equilibrium sense) gives information about the stick's orientation relative to the gravity force. A gyroscope mounted on a horizontally aligned stick sends 0 to its outputs. Vertical position is perceived as -1 or +1 depending on which end is higher. |
![]() |
The "T" receptor (touch) can be imagined as a whisker attached to the stick. Its relaxed state is -1 (nothing detected in the whiskers' range). The signal value grows as the stick gets closer to any material object. Reaches 0 when the stick touches the ground. Higher values mean that the stick is pushed into the ground. |
![]() |
The "S" receptor (smell) excitation depends on the sum of the neighbor energy sources (energy balls and other creatures). Output range is from 0 (nothing detected) to 1 (maximum). Rich or closer energy sources smell 'stronger' than small or distant ones. |
| Neuron type | How simulated |
|---|---|
| | and @ (muscles) |
Change the relative orientation of the joint's parts. Use the "standard-xyz" OpenGL visualization style to get some hints about axes and the orientation of creature's parts.
Parameters:
|
| G (gyroscope) | state = (part1.z – part2.z) / stick_length |
| T (touch) |
|
| S (smell) |
state = (sum_all_energy_sources[ energy / distance2 ])/100
(if distance<1, then use 1) |
| Water (water detector / water pressure indicator) |
|
| Energy (energy level) |
|