User Tools

Site Tools


arma:config:ambient_life

Ambient Life Configs

Ambient Life Distribution

Ambien life is the birds, insects and possible other animals that are created/spawned around players area.

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)
	};
...
};

Ambient Parameters

Rain 0..1 rain intensity
Night 0..1 night “intensity”
Meadow 0..1 how much does the surrounding have a character of a meadow
Trees 0..1 how many tress are growing in the area
Hills 0..1 how much is the place “hilly” (160 ASL → 0, 400 ASL → 1)
Houses 0..1 how many houses or other building are around
Windy 0..1 wind streght (0 m/s →0, 20 m/s → 1)
Forest 0..1 forest density
DeadBody 0..1 is the place close to a dead body? (0 m →1, 10 m → 0)
Sea 0..1 is the place close to a sea? (0 m→1, approx. 100 m→0)

Parameters can be combined into Simple Expressions, like:

meadow*(1-rain)*(1-night)
(10-5*rain)*(1-sea)*(windy factor [0.2,0.5])
arma/config/ambient_life.txt · Last modified: 2007-11-23 20:23 by snakeman