Ambient Life Configs: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ") |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{TOC|side}} | ||
== Ambient Life Distribution == | == Ambient Life Distribution == | ||
Line 106: | Line 106: | ||
class Insect; | class Insect; | ||
class Bird; | class Bird; | ||
class ButterFly: Insect | class ButterFly : Insect | ||
{ | { | ||
model = "aglais_urticae.p3d"; | model = "aglais_urticae.p3d"; | ||
Line 128: | Line 128: | ||
{{GameCategory|arma1|Addon Configuration}} |
Latest revision as of 10:58, 6 December 2023
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 Specialisation
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 overridden 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 another way than a man. With true value, ambient flies backwards.
autocenter = false; // important for proper rtm animation (bones mounted on proper place)
};
// ...
};