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

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

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

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

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

Illustrative example (standard experiment definition)

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

: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 the resulting genotype create an individual in “Creatures”
    :onBorn
  • move new object into a randomly chosen place in the world
  • set starting energy according to object’s type
    :onKill
  • if “Creatures” object died, save its performance in “Genotypes” (possibly creating a new genotype). If there 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 simple language. Thus, when creating your own script, computer science background is helpful. A documentation on script writing is available here. The existing scripts should serve as examples (see cliutils.ini file in command-line frams distribution for illustrative examples). Any file with the ".expdef" extension, which is present in the "scripts" directory, will automatically appear on the list of experiment definitions to choose from.