CreaturesGroup class in Global context

A set of Creature objects, sharing some high level simulation properties (performance calculation, NN simulation, collision detection, event handling). The groups usually have different roles in the experiment (Creatures groups and Food group in standard.expdef)

17 members:

type and namedescriptioncomments
integer index
integer
group index  
string name
string
Group name  
integer creaturecount
integer
Number of creatures  
integer energy
integer, 0 .. 1 (false/true)
Energy calculation If turned off, creature's energy will be constant 
integer death
integer, 0 .. 1 (false/true)
Death Do creatures die when no energy? 
integer nnsim
integer, 0 .. 2
  • 0 = Off
  • 1 = Immediate
  • 2 = After freeze
  • Neural net simulation Freezing means stabilization 
    integer perfperiod
    integer, 0 .. 1000000
    Performance sampling period  
    integer enableperf
    integer, 0 .. 2
  • 0 = Off
  • 1 = Immediate
  • 2 = After freeze
  • Performance calculation Freezing means stabilization 
    integer colmask
    integer, 0 .. 65535
    Collision mask Collisions between objects can be handled in two ways:
    - standard 'mechanical' collision (simple 'rebound' effect)
    - special script handler (On[GROUPNAME]Collision function)
    Collision mask determines which one will be used (none and both are also possible).On each collision, colmask values of both colliding objects are logically ANDed.The resulting collision value is interpreted as follows:
    bits: 0 (1) enable standard handler
    1 (2) disable standard handler
    2 (4) enable custom handler
    3 (8) disable custom handler
    4 (16) enable standard handler (again)
    5 (32) disable standard handler ...
    ..............and so on (repeats each 4 bits)
    The handler X (standard or custom) is invoked if some X-enabling bits are active and all X-disabling bits are inactive (so disabling has higher priority).
    For clarity, we will label those bits with 4 small/capital characters: S (enable standard), s (disable standard), C (enable custom), c (disable custom).
    The pattern in the whole colmask value (16 bit) is then: cCsScCsScCsScCsS

    Examples:

    1.With one group, the resulting collision bits are always equal to the group colmask. There are four reasonable values:
    0 = ignore collisions
    1 = use standard handling
    2 = use custom handling
    3 = use standard and custom handling

    2.Two groups yield more interesting cases. Let us consider the 'standard.expdef' setting:
    Creatures colmask = 13 (- - - - c C - S)
    Food colmask = 148 (c - - S - C - -)
    There are three possible scenarios:
    - creature and creature: collision value = 13 (- - - - c C - S). Standard handling will be used because it is enabled by the 'S'. Custom handler is disabled because of 'c' (which takes precedence over 'C').
    - food and food: collision value = 148 (c - - S - C - -). As above, the sequence is just different.
    - creature and food: collision value = 13 AND 148 = 4 (- - - - - C - -). Custom handling will be used.
     
    float em_stat
    floating point, 0 .. 1
    Muscle static work Energy requirements for a muscle
    resisting an external force 
    float em_dyn
    floating point, 0 .. 1
    Muscle dynamic work Energy requirements for a muscle
    moving a stick 
    float en_assim
    floating point, 0 .. 1
    Assimilation productivity Maximal energy gain produced by a vertical specialized stick.
    Horizontal specialized sticks get half of this value. 
    function createFromGenotype
    function
      
    function createFromString
    function
      
    function createFromGeno
    function
      
    function getCreature
    function
    get creature object  
    function senseCreaturesProperty
    function
    senseCreaturesProperty arguments:
    - x,y,z (sensor position)
    - property (name or Class:id)
    - except (creature object)
    works like a smell sensor for a given property (for all creatures in this group except "except").
    The following function reproduces the "classic" framsticks "S" sensor:
    function smellReceptorValue(x,y,z,except)
    {
    var i,s=0; for(i=0;i<LiveLibrary.groupcount;i++)
    s+=LiveLibrary.getGroup(0).senseCreaturesProperty(x,y,z,"energy",except);
    return s;

    Global context