CreatureSnapshot class, available in: Global contextA data object consisting of the same fields as the serialized Creature. Typically used for reading a Creature back from a file; Population.add(snapshot_object) recreates the Creature object from the snapshot. When the creature is added to a population and it happens to collide with the terrain, the creature will be automatically moved upwards just enough to avoid the collision.
Serialized Creature preserves most of its data fields (including the 'data' dictionary) but only keeps aggregated information about its physical state, which is body orientation and location of the bounding box center. Individual physical body parts' locations, states and neuron states are lost.
Restoring the state of a formerly living, serialized creature using its CreatureSnapshot is not perfect. Apart from losing information about individual body and brain parts and their states, the usual flow of calculating performance may be disturbed, which is related to the 'performance sampling period' being interrupted as well as the specifics of the 'freezing period' mechanism. In consequence, the intended behavior of 'lifespan', 'steps_in_lifespan', and performance fields may be broken. For example, when period=100, after every 100 'steps_in_lifespan', the 'lifespan' increases by 100 and the new performance data is calculated. When the period is interrupted by saving/restoring, 'steps_in_lifespan' continues to increase from the saved value, but performance counters will be waiting another full 100 steps before the next update, losing the information from the unfinished period. The resulting 'lifespan' will be lower than it would have been without interruptions, and will be inconsistent with 'steps_in_lifespan'. Because of these issues, it is strongly advised to thoroughly inspect and test the behavior of the restored Creatures in various moments in their lifepspan, and use CreatureSnapshot only when necessary.
See also: scripts/standard_exploadsave.inc
See also: Population.add()
This class has 35 members:
sdleiF
XYZ bboxCenterBounding box center
float c_velocityRecent period velocitySee http://www.framsticks.com/a/al_params.html#exper-perfcalc
float c_vertposRecent period vertical positionSee http://www.framsticks.com/a/al_params.html#exper-perfcalc
float c_vertvelocityRecent period vertical velocitySee http://www.framsticks.com/a/al_params.html#exper-perfcalc
float center_xcenter.xCenter of gravity
float center_ycenter.yCenter of gravity
float center_zcenter.zCenter of gravity
Dictionary dataCustom fields dictionary
float distanceDistanceSee http://www.framsticks.com/a/al_params.html#exper-perfcalc
float energyEnergy
float energy0Starting energy
multiline string genotypeGenotype
int gnumGeneration
float idleenIdle energy consumptionThe amount of energy subtracted from the energy of this creature in each simulation step, as in: cr.energy-=cr.idleen;
multiline string infoInfoAdditional info or comments
int lifespanLifespanWhile the creature's performance measurement is enabled, the creature's lifespan is incremented in "performance sampling period" intervals.
string nameName
int nn_active0 .. 2
  • 0 = Off
  • 1 = On
  • 2 = Waiting for stabilization
  • NN activeThe initial value of this property is taken from Population.nn_active
    int numOrdinal numberActs as a unique identifier, but less strict than "uid". Unlike "uid", "num" can be changed and therefore can be saved and restored, providing persistence and continuity beyond a single application run. "num" is only guaranteed to be unique if it is autogenerated and not changed by the user, otherwise it is user's responsibility to manage the proper values of "num". Autogenerated "num" is always equal to the largest previously used "num" + 1. The largest previously used value is stored in Simulator.last_creature_num and can be changed as well (and is automatically saved and restored as a part of the Simulator state). Limitation: being a 32-bit integer, "num" overflows at about 2 billion counts.
    See also: uid
    Orient orientOrientationBy convention, the orientation of the creature is equal to the orientation of its first Part.
    int othermask0 .. 2147483647
    default=0
    Collision mask (other)Creature's othermask is set according to the Creature's Population.othermask. See Population.selfmask for detailed information about collision handling.
    int perf_measuring0 .. 2
  • 0 = Off
  • 1 = On
  • 2 = Waiting for stabilization
  • Performance calculationThe initial value of this property is taken from Population.initial_perf_measuring
    int physics_active0 .. 1 (false/true)
    default=1
    Body simulation(Physical) body simulation can be disabled for individual objects which makes them immovable. Disabled objects can still participate in collisions depending on their collisions masks. The initial value of this property is taken from Population.initial_physics_active.

    Bugs: the standard collision handler does not work for disabled objects when ODE simulation is used. It means that these objects won't physically interact with other objects. The custom (scripting) handlers work as expected.
    int self_collisions0 .. 1 (false/true)Self-collisionsEnable/disable detection of self-collisions (within a creature body). They can only occur when using the ODE simulation engine. If enabled, the creature will have its sticks collide during lifespan. The initial value of this property is taken from Population.initial_self_collisions.
    int selfmask0 .. 2147483647
    default=0
    Collision mask (self)Creature's selfmask is set according to the Creature's Population.selfmask. See Population.selfmask for detailed information about collision handling.
    int steps_after_birthSimulation steps after birth"Birth" is the moment when the simulation of a creature starts.
    int steps_in_lifespanSimulation steps in lifespan"Lifespan" is the period during simulation of a creature when its performance measurement is enabled.
    string uid#Unique identifier that is generated on object creation. "uid" is only unique during a single application run. Subsequent runs generate the same sequence of uid values.
    See also: num
    untyped user1User field 1
    untyped user2User field 2
    untyped user3User field 3
    float velocityAverage velocitySee http://www.framsticks.com/a/al_params.html#exper-perfcalc
    float vertposAverage vertical positionSee http://www.framsticks.com/a/al_params.html#exper-perfcalc
    float vertvelAverage vertical velocitySee http://www.framsticks.com/a/al_params.html#exper-perfcalc
    snoitcnuF
    function new()returns Creaturecreate new object
    Global context