CfgWorlds: Subdivision & Ambient

I'm not aware of any documentation or threads concerning the Subdivision class. It is documented in the BISampleMap, but while I have a pretty good guess as to what it does, I'm not entirely sure of it.

I assume that this deals with the subdivision of the terrain mesh. While the typical terrain grid is 10 meters, ingame there is likely more than two triangles per 100m2. These parameters, then, control how the engine divides the terrain mesh in between each elevation data point. I don't know if this actually produces small variations in elevation inside each terrain grid square, but the WhiteNoise component seems to suggest so. I can't really say much about this, the comments from the BISampleMap pretty much explain everything.

        class Subdivision
        {
            // fractal component of subdivision
            // changes are smaller for smaller rectangles
            class Fractal
            {
                // texture roughness factor
                rougness = 5;
                // max. value for squares containing road
                maxRoad = 0.02;
                // max. value for squares containing track
                maxTrack = 0.50;
                // max. coeficient depending on slope
                maxSlopeFactor = 0.05;
            };
            // white noise component of subdivision
            // change size is independent on rectangle size
            class WhiteNoise
            {
                rougness = 2;
                // max. value for squares containing road
                maxRoad = 0.01;
                // max. value for squares containing track
                maxTrack = 0.05;
                // max. coeficient depending on slope
                maxSlopeFactor = 0.0025;
            };

            // do not divide surfaces that are under given limit
            minY = -0.0;
            // do not divide flat surfaces
            minSlope = 0.02;
        };



The Ambient class is more interesting. This determines the little things ingame that "make the world come alive". Specifically, this defines which birds, insects and wind-blown objects show up on the island, and where they show up. This snippet is from the BISampleMap, so it already includes helpful comments.

    class Ambient
    {
      /*
          Layer cost and species probability use expressions.
          Variables which can be used inside of expressions:
        rain: rain intensity.
        night: 1 during night, 0 during day.

        hills: 0 at 150 ASL, 1 at 400 ASL.
        windy: 0 at 0 m/s, 1 at 20 m/s.

        trees: tree density.
        sea: distance to sea.
        houses: house density.
        meadow: meadow character.
        forest: 1 in the forest.

      Any values are continuous/interpolated in the range of 0 to 1.
      Values they are independent unless notes otherwise
      (meaning meadow and forest can be 1 at the same time).

      You can observe these values in real-time using:
          diag_toggle "ambient"
      */

          class BigBirds
          {
            //Container radius:
                //Species are normally spawned at the edges of the circle defined by this radius.
                //One exception to this is the initial start of the simulation, where the whole
                //circle will be filled.
            radius = 300;
            //Points allowed for this container:
            //Xbox: 1 * (1 - night) * (1 - sea)
            cost = "((1 + forest + trees) - ((2 * rain)) - houses) * (1 - night) * (1 - sea)";
            //Classname in Species corresponds to type name:
            class Species
            {
              class Hawk
              {
                probability = 0.2;
                cost = 1;
              };
            };
          };

          class Birds
          {
            radius = 170;
            //Xbox: (1 - night) * (2 + 8 * sea)
            cost = "(1 - night) * ((1 + (3 * sea)) - (2 * rain))";
            class Species
            {
              class Seagull
              {
                probability = 0.2;
                cost = 1;
              };
            };
          };

          class BigInsects
          {
            radius = 20;
            //Xbox: 1 * (1 - night) * (1 - rain) * (1 - sea)
            cost = "(5 - (2 * houses)) * (1 - night) * (1 - rain) * (1 - sea) * (1 - windy)";
            class Species
            {
              class DragonFly
              {
                probability = 0.6 - (meadow * 0.5) + (forest * 0.4);
                cost = 1;
              };
              class ButterFly
              {
                probability = 0.4 + (meadow * 0.5) - (forest * 0.4);
                cost = 1;
              };
            };
          };

          class BigInsectsAquatic
          {
              radius = 20;
              cost = "(3 * sea) * (1 - night) * (1 - rain) * (1 - windy)";
              class Species
              {
                  class DragonFly
                  {
                      probability = 1;
                      cost = 1;
                  };
              };
          };

          //The wind is blowing various particles around:
          class WindClutter
          {
            radius = 10;
            //Xbox: (10 - 5 * rain) * (1 - sea) * (windy factor [0.2, 0.5])
            cost = "((20 - 5 * rain) * (3 * (windy factor [0.2, 0.5]))) * (1 - sea)";
            class Species
            {
              class FxWindGrass1 //Dark green grass.
              {
                probability = "0.4 - 0.2 * hills - 0.2 * trees";
                cost = 1;
              };
              class FxWindGrass2 //Dry grass.
              {
                probability = "0.4 - 0.2 * hills - 0.2 * trees";
                cost = 1;
              };
              class FxWindRock1 //Dust.
              {
                probability="0.4 * hills";
                cost = 1;
              };
              class FxWindLeaf1 //Green leaf.
              {
                probability = "0.2 * trees";
                cost = 1;
              };
              class FxWindLeaf2 //Dry leaf.
              {
                probability = "0.1 * trees + 0.2";
                cost = 1;
              };
              class FxWindLeaf3 //Green leaf with a dry spot.
              {
                probability = "0.1 * trees";
                cost = 1;
              };
            };
          };

          class NoWindClutter
          {
              //Xbox: 10
            radius = 15;
            //Xbox: 1 * (1 - rain) * (1 - sea) * (1 - forest) * (1 - houses) * (1 - (windy factor [0.1, 0.2]))
            cost = "(20 * (windy factor [0.1, 0.2])) * meadow * (1 - rain) * (1 - sea) * (1 - forest) * (1 - houses)";
            class Species
            {
              class FxWindPollen1
              {
                probability = 1;
                cost = 1;
              };
            };
          };

          class SmallInsects
          {
            radius = 3;
            //Xbox: (9 - 5 * hills) * (1 - night) * (1 - rain) * (1 - sea) * (1 - windy)
            cost = "(12 - 8 * hills) * (1 - night) * (1 - rain) * (1 - sea) * (1 - windy)";
            class Species
            {
              class HouseFly
              {
                probability = "deadBody + (1 - deadBody) * (0.5 - forest * 0.1 - meadow * 0.2)";
                cost = 1;
              };
              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;
              };
            };
          };

          class NightInsects
          {
            radius = 3;
            cost = "(9 - 8 * hills) * night * (1 - rain) * (1 - sea) * (1 - windy)";
            class Species
            {
              class Mosquito
              {
                probability = 1;
                cost = 1;
              };
            };
          };
        };


Each entry under this class basically works the same, though they define different things. The way it all works is explained in the comments. The animals (Hawk, SeaGull, HouseFly, etc.) used here are defined in animals.pbo\ca\animals\config.bin, while the wind-blown objects (FxWindLeaf, FxWindGrass, etc.) are defined in Ca.pbo\ca\config.bin.
Comments