Ignore:
Timestamp:
03/25/16 17:44:20 (9 years ago)
Author:
sz
Message:

experiment scripts updated to match the upcoming Framsticks version (ExpParams? ==> ExpProperties?, Fields ==> NeuroProperties?, prop: ==> property)

Location:
experiments/frams/deathmatch/data/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/deathmatch/data/scripts/deathmatch-levels.inc

    r231 r480  
    22// 1. global variable levels
    33// 2. function initLevels() that initializes levels structure
    4 // 3. function nextLevel() that puts into ExpParams.level variable the value of next level's index (or -1 if random)
     4// 3. function nextLevel() that puts into ExpProperties.level variable the value of next level's index (or -1 if random)
    55
    66// descriptions of game levels
  • experiments/frams/deathmatch/data/scripts/deathmatch-smellPopulation.neuro

    r231 r480  
    1515function go()
    1616{
    17   if (Populations.size>Fields.pop)
    18         Neuro.state = Populations[Fields.pop].senseCreaturesProperty(
     17  if (Populations.size>NeuroProperties.pop)
     18        Neuro.state = Populations[NeuroProperties.pop].senseCreaturesProperty(
    1919                Neuro.position_x, Neuro.position_y, Neuro.position_z,
    2020                "energy", Neuro.creature);
     
    2424~
    2525
    26 prop:
     26property:
    2727id:pop
    2828name:population
  • experiments/frams/deathmatch/data/scripts/deathmatch.expdef

    r233 r480  
    9797  //add Teams populations (group above 2)
    9898  var i = 0;
    99   teams = ExpParams.teamCount;
     99  teams = ExpProperties.teamCount;
    100100  if (teams == 1)
    101101        teams = GenePools[0].size;
     
    128128  for (var i = 0; i < Populations.size - 2; i++)
    129129  {
    130         for (var j = 0; j < ExpParams.teamSize; j++)
     130        for (var j = 0; j < ExpProperties.teamSize; j++)
    131131        {
    132132          var g; //Genotype object
    133           if (ExpParams.teamCount != 1)
     133          if (ExpProperties.teamCount != 1)
    134134            g = GenePools[0].random();
    135135          else
     
    179179{
    180180  var levelNumber;
    181   if (ExpParams.level == -1)
     181  if (ExpProperties.level == -1)
    182182    levelNumber = Math.random(levels.size);
    183183  else
    184     levelNumber = ExpParams.level;
     184    levelNumber = ExpProperties.level;
    185185
    186186  var level = levels.get(levelNumber);
     
    198198function tryCreateHPBox()
    199199{
    200   if (Populations[0].size >= ExpParams.hpBoxTotalCount) return;
    201  
    202   if (Math.rnd01 > ExpParams.hpBoxProbability) return;
     200  if (Populations[0].size >= ExpProperties.hpBoxTotalCount) return;
     201 
     202  if (Math.rnd01 > ExpProperties.hpBoxProbability) return;
    203203 
    204204  var food = Populations[0].add("//0\nm:Vstyle=hpbox\np:");
    205205  food.name = "HP Box";
    206   food.idleen = ExpParams.hpBoxIdleEnergy;
    207   food.energ0 = ExpParams.hpBoxStartingEnergy;
     206  food.idleen = ExpProperties.hpBoxIdleEnergy;
     207  food.energ0 = ExpProperties.hpBoxStartingEnergy;
    208208  food.energy = food.energ0;
    209209  food.nnenabled = 0;
     
    212212function tryCreateUpgradeBox()
    213213{
    214   if (Populations[1].size >= ExpParams.upgradeBoxTotalCount) return;
    215  
    216   if (Math.rnd01 > ExpParams.upgradeBoxProbability) return;
     214  if (Populations[1].size >= ExpProperties.upgradeBoxTotalCount) return;
     215 
     216  if (Math.rnd01 > ExpProperties.upgradeBoxProbability) return;
    217217 
    218218  var weapon = Populations[1].add("//0\nm:Vstyle=weaponbox\np:");
    219219  weapon.name = "Weapon Box";
    220   weapon.idleen = ExpParams.upgradeBoxIdleEnergy;
    221   weapon.energ0 = ExpParams.upgradeBoxStartingEnergy;
     220  weapon.idleen = ExpProperties.upgradeBoxIdleEnergy;
     221  weapon.energ0 = ExpProperties.upgradeBoxStartingEnergy;
    222222  weapon.energy = weapon.energ0;
    223223  weapon.nnenabled = 0;
     
    244244          cr.user2 = [0,0,0,0,0,0]; //kills (0), assists (1), total damage dealt (2), total damage received (3), HP boxes collected (4), Upgrade boxes collected (5)
    245245          cr.user3 = []; //who dealt damage to this creature
    246           cr.energ0 = ExpParams.creatureStartingEnergy;
     246          cr.energ0 = ExpProperties.creatureStartingEnergy;
    247247          cr.energy = cr.energ0;
    248248      place_inTeamSpot(cr);
     
    284284
    285285  var x, y, z;
    286   x = (ExpParams.teamSpawningAreaSize) * Math.rnd01 - cr.size_x / 2 - ExpParams.teamSpawningAreaSize/2;
    287   y = (ExpParams.teamSpawningAreaSize) * Math.rnd01 - cr.size_y / 2 - ExpParams.teamSpawningAreaSize/2;
     286  x = (ExpProperties.teamSpawningAreaSize) * Math.rnd01 - cr.size_x / 2 - ExpProperties.teamSpawningAreaSize/2;
     287  y = (ExpProperties.teamSpawningAreaSize) * Math.rnd01 - cr.size_y / 2 - ExpProperties.teamSpawningAreaSize/2;
    288288 
    289289  //vector of length half the world size minus spawning area size
    290   var vect = [0.0 + World.wrldsiz/2 - ExpParams.teamSpawningAreaSize/2 - 1.0, 0.0];
     290  var vect = [0.0 + World.wrldsiz/2 - ExpProperties.teamSpawningAreaSize/2 - 1.0, 0.0];
    291291  vect = rotateVector(vect, radius);
    292292 
     
    366366function applySuddenDeathModifier()
    367367{
    368   if (idleSimulationSteps < ExpParams.stagnationInterval) return;
     368  if (idleSimulationSteps < ExpProperties.stagnationInterval) return;
    369369
    370370  for (var i = 2; i < Populations.size; i++)
    371371    for (var cr in Populations[i])
    372       cr.energy -= ExpParams.stagnationHealthReduce;
     372      cr.energy -= ExpProperties.stagnationHealthReduce;
    373373}
    374374
     
    384384            if (cr.user1[0] > 0) cr.user1[0]=cr.user1[0] - 1;
    385385            if (cr.user1[0] < 0) cr.user1[0]=0.0;
    386             if (cr.user1[1] > 0) cr.user1[1]=cr.user1[1] - ExpParams.upgradeBoxDecay;
     386            if (cr.user1[1] > 0) cr.user1[1]=cr.user1[1] - ExpProperties.upgradeBoxDecay;
    387387            if (cr.user1[1] < 0) cr.user1[1]=0.0;
    388388          }
     
    432432function print(msg)
    433433{
    434   if (ExpParams.debug)
     434  if (ExpProperties.debug)
    435435    Simulator.print(msg);
    436436}
     
    483483  var dice2 = 0;
    484484  var changed = 0;
    485   for (var i = 0; i < ExpParams.diceCount; i++)
    486   {
    487     dice1 = dice1 + Math.random(ExpParams.diceSides) + 1;
    488         dice2 = dice2 + Math.random(ExpParams.diceSides) + 1;
    489   }
    490   var energy1 = 0.0 + ExpParams.creatureDamage * dice1;
    491   var energy2 = 0.0 + ExpParams.creatureDamage * dice2;
    492   energy1 += ExpParams.upgradeMultiplier * c1.user1.get(1);
    493   energy2 += ExpParams.upgradeMultiplier * c2.user1.get(1);
     485  for (var i = 0; i < ExpProperties.diceCount; i++)
     486  {
     487    dice1 = dice1 + Math.random(ExpProperties.diceSides) + 1;
     488        dice2 = dice2 + Math.random(ExpProperties.diceSides) + 1;
     489  }
     490  var energy1 = 0.0 + ExpProperties.creatureDamage * dice1;
     491  var energy2 = 0.0 + ExpProperties.creatureDamage * dice2;
     492  energy1 += ExpProperties.upgradeMultiplier * c1.user1.get(1);
     493  energy2 += ExpProperties.upgradeMultiplier * c2.user1.get(1);
    494494  if (c1.population == c2.population)
    495495  {
    496     energy1 = ExpParams.friendlyFireDamageMultiplier * energy1;
    497         energy2 = ExpParams.friendlyFireDamageMultiplier * energy2;
     496    energy1 = ExpProperties.friendlyFireDamageMultiplier * energy1;
     497        energy2 = ExpProperties.friendlyFireDamageMultiplier * energy2;
    498498  }
    499499 
     
    511511    c1.energy = c1.energy - energy2;
    512512        if (c1.energy < 0) c1.energy = 0;
    513     print(c2.name + " [" + c2.population.name + "] rolled " + dice2 + " and dealt " + energy2 + " [+" + (ExpParams.upgradeMultiplier * c2.user1[1]) +" bonus] damage to " + c1.name + " [" + c1.population.name + "]");
    514         c2.user1.set(0, ExpParams.attackCooldown);
     513    print(c2.name + " [" + c2.population.name + "] rolled " + dice2 + " and dealt " + energy2 + " [+" + (ExpProperties.upgradeMultiplier * c2.user1[1]) +" bonus] damage to " + c1.name + " [" + c1.population.name + "]");
     514        c2.user1.set(0, ExpProperties.attackCooldown);
    515515        c2.user2.set(2, c2.user2[2] + energy1);
    516516        c1.user2.set(3, c1.user2[3] + energy1);
     
    543543    c2.energy = c2.energy - energy1;
    544544        if (c2.energy < 0) c2.energy = 0;
    545     print(c1.name + " [" + c1.population.name + "] rolled " + dice1 + " and dealt " + energy1 + " [+" + (ExpParams.upgradeMultiplier * c1.user1[1]) +" bonus] damage to " + c2.name + " [" + c2.population.name + "]");
    546     c1.user1[0] = ExpParams.attackCooldown;
     545    print(c1.name + " [" + c1.population.name + "] rolled " + dice1 + " and dealt " + energy1 + " [+" + (ExpProperties.upgradeMultiplier * c1.user1[1]) +" bonus] damage to " + c2.name + " [" + c2.population.name + "]");
     546    c1.user1[0] = ExpProperties.attackCooldown;
    547547        c1.user2[2] = c1.user2[2] + energy1;
    548548        c2.user2[3] = c2.user2[3] + energy1;
     
    588588function onFoodCollision()
    589589{
    590   if (ExpParams.pickupNotStagnation == 1) idleSimulationSteps = 0;
     590  if (ExpProperties.pickupNotStagnation == 1) idleSimulationSteps = 0;
    591591
    592592  //collect HP Box (by eating it :D)
     
    605605function onUpgradesCollision()
    606606{
    607   if (ExpParams.pickupNotStagnation == 1) idleSimulationSteps = 0;
     607  if (ExpProperties.pickupNotStagnation == 1) idleSimulationSteps = 0;
    608608
    609609  //collect Upgrade Box (by eating it :D)
     
    643643
    644644//reinit populations on change
    645 function ExpParams_teamCount_set()
     645function ExpProperties_teamCount_set()
    646646{
    647647  initPopulations();
    648648}
    649649
    650 function ExpParams_level_set()
     650function ExpProperties_level_set()
    651651{
    652652  initLevel();
     
    657657# Team
    658658
    659 prop:
     659property:
    660660id:teamCount
    661661name:Number of teams in Deathmatch
     
    664664help:If set to 1, the number of teams will be equal to the number of genotypes in gene pool.
    665665
    666 prop:
     666property:
    667667id:teamSize
    668668name:Number of creatures per team
     
    670670group:Team
    671671
    672 prop:
     672property:
    673673id:teamSpawningAreaSize
    674674name:Spawning area size for team
     
    676676group:Team
    677677
    678 prop:
     678property:
    679679id:creatureStartingEnergy
    680680name:Starting energy of creature
     
    686686# Attack parameters
    687687
    688 prop:
     688property:
    689689id:diceSides
    690690name:Number of sides of dices
     
    692692group:Attack rules
    693693
    694 prop:
     694property:
    695695id:diceCount
    696696name:Number of dices to roll per attack
     
    698698group:Attack rules
    699699
    700 prop:
     700property:
    701701id:creatureDamage
    702702name:Basic damage multiplied by result of dice roll
     
    704704group:Attack rules
    705705
    706 prop:
     706property:
    707707id:friendlyFireDamageMultiplier
    708708name:Multiplier of energy taken when Creatures of the same team collide
     
    711711help:Set to 0 for no friendly fire, set to 1 if full damage should be dealt when interacting with team member
    712712
    713 prop:
     713property:
    714714id:attackCooldown
    715715name:Number of simulation steps between two consecutive attacks of a creature
     
    721721# Collectibles - HP Boxes & Upgrades
    722722
    723 prop:
     723property:
    724724id:pickupNotStagnation
    725725name:Collectible pick-up resets stagnation counter?
     
    727727help:If set to true picking up an item will restart counting towards stagnation, effects in longer battles.
    728728
    729 prop:
     729property:
    730730id:hpBoxStartingEnergy
    731731name:Starting energy of HP Box
     
    734734help:Base starting energy level for HP Box
    735735
    736 prop:
     736property:
    737737id:hpBoxIdleEnergy
    738738name:Amount of energy lost by HP Box
     
    741741help:How much energy HP Box looses each step (0 - it will not disappear)
    742742
    743 prop:
     743property:
    744744id:hpBoxProbability
    745745name:Probablity that new HP Box will spawn
     
    748748help:Probability of HP Box appearing each step of simulation
    749749
    750 prop:
     750property:
    751751id:hpBoxTotalCount
    752752name:Maximum number of HP Boxes on the field
     
    755755help:The total number of HP Boxes on the field will never exceed this number
    756756
    757 prop:
     757property:
    758758id:upgradeBoxStartingEnergy
    759759name:Starting energy of Upgrade Box
     
    762762help:Base starting energy level for Upgrade Box
    763763
    764 prop:
     764property:
    765765id:upgradeBoxIdleEnergy
    766766name:Amount of energy lost by Upgrade Box
     
    769769help:How much energy Upgrade Box looses each step (0 - it will not disappear)
    770770
    771 prop:
     771property:
    772772id:upgradeBoxProbability
    773773name:Probablity that new Upgrade Box will spawn
     
    776776help:Probability of Upgrade Box appearing each step of simulation
    777777
    778 prop:
     778property:
    779779id:upgradeBoxTotalCount
    780780name:Maximum number of Upgrade Boxes on the field
     
    783783help:The total number of Upgrade Boxes on the field will never exceed this number
    784784
    785 prop:
     785property:
    786786id:upgradeBoxDecay
    787787name:How fast upgrade boost fades from creature
     
    790790help:Each step creature damage bonus will be decreased by given amount until it reaches 0
    791791
    792 prop:
     792property:
    793793id:upgradeMultiplier
    794794name:Multiplier of bonus damage
     
    800800# Other
    801801
    802 prop:
     802property:
    803803id:level
    804804name:Level
     
    806806help:Number of a level to battle (-1 is random)
    807807
    808 prop:
     808property:
    809809id:stagnationInterval
    810810name:Number of idle simulation steps before Sudden Death
     
    812812help:If no combat occurs during given number of steps, the Sudden Death mode is turned on (0 = Sudden Death all the time)
    813813
    814 prop:
     814property:
    815815id:stagnationHealthReduce
    816816name:Sudden Death health reduce
     
    818818help:If Suddent Death is turned on, creatures will lose given amount of HP each simulation step
    819819
    820 prop:
     820property:
    821821id:debug
    822822name:Show additional debug messages
Note: See TracChangeset for help on using the changeset viewer.