Ambient Life Configs
Jump to navigation
Jump to search
Ambient Life Distribution
There is a probabilistic way to define ambient life distribution, depending on current time, place and weather conditions, defined in CfgWorlds.
Layer cost and species probability use Simple Expressions.
Ambient Parameters which can be used inside of expressions:
As far as probabilities are considered, for each Species class, the probabilities need sum to one. In the following example, for instance:
probability="deadBody+(1-deadBody)*(0.5-forest*0.1-meadow*0.2)"; probability="(1-deadBody)*(0.5-forest*0.1+meadow*0.2)"; probability="(1-deadBody)*(0.2*forest)";
Which really sums into one, as one can easily check:
sum = deadBody+(1-deadBody)*(0.5 - 0.1*forest - 0.2*meadow + 0.5 - 0.1*forest + 0.2*meadow + 0.2*forest) = = deadBody+(1-deadBody)*1 = 1
More complete example follows:
class CfgWorlds { class DefaultWorld { /// ambient life configuration class Ambient { class SmallInsects { radius=3; //radius in meters, where ambient lives (distance from the player) cost="(10-5*hills)*(1-night)*(1-rain)*(1-sea)*(1-( (windy*2) min 1))"; //total number of all species /// species configuration class Species { class HouseFly { probability="deadBody+(1-deadBody)*(0.5-forest*0.1-meadow*0.2)"; cost=1; //when the fly lives, it pays this cost to the total sum cost SmallInsects::cost }; class HoneyBee { probability="(1-deadBody)*(0.5-forest*0.1+meadow*0.2)"; cost=1; }; class Mosquito { probability="(1-deadBody)*(0.2*forest)"; cost=1; }; }; }; ... }; }; };
Basic ambient behaviour
Basic ambient behaviour is defined in cfgVehicles.hpp.
class CfgNonAIVehicles { class Bird { scope = private; model=""; simulation = SeaGull; //which CPP class simulate ambient behaviour reversed = false; //default is not reversed (ambients are oriented in other way, than a man) //straightDistance,minHeight,avgHeight and maxHeight can be overiden by randomMove fsm function minHeight=5; avgHeight=10; maxHeight=50; straightDistance=50; // random move will use this to set the maximum distance, where to fly minSpeed=-0.5; // m/s maxSpeed=20; // m/s acceleration = 7; //m/s^2 turning = 1; // angular acceleration - relative (the higher, the more maneuvrable) flySound[]={"",db-30,1, 1}; singSound[]={"",db-30,1, 1}; canBeShot=true; //birds can, insect cannot airFriction2[]={25,12,2.5}; //defines the matrix for computing friction airFriction1[]={1500,700,100}; //multiplying columns changes friction in given coordinate airFriction0[]={40,20,60}; }; ... };
Ambient behaviour specialization
For particular species, default Bird or Insect values, defined in cfgVehicles.hpp can be specialized:
class CfgNonAIVehicles { class Insect; class Bird; class ButterFly: Insect { model = "aglais_urticae.p3d"; fsm[] = {"Butterfly"}; //there could be more FSMs for layered FSM system, but it is not implemented yet moves = CfgMovesButterfly; //animation subject is described on other place in wiki //straightDistance,minHeight,avgHeight and maxHeight can be overiden by randomMove fsm function straightDistance=2; // random move will use this to set the maximum distance, where to fly minHeight=-0.10; // allow landing avgHeight=0.3; // these Height values are used in random movement maxHeight=1.5; minSpeed=-0.1; // autopilot tries to make ambient fly within this range maxSpeed=1; // but it is modulated only in Z coordinate, yet (side speed is still problem) acceleration = 5; // m/s^2 this acceleration is used whenever possible. Ambient cannot fly with less effort. turning = 5; // turning ability (less value, less turning ability) reversed = false; // model is oriented in other way, than a man. With true value, ambient flies backwards. autocenter = false; //important for proper rtm animation (bones mounted on proper place) }; ... };