Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4 ... 8

Author Topic: Curb treesplosion by gradually reducing tree maturation as tree density increase  (Read 15775 times)

PatrikLundell

  • Bay Watcher
    • View Profile

The embark selection shows you the (crude) tree density in the biome(s). The density encountered when actually embarking should be in line with that description, as well as be in line with an end state density. A jungle embark shouldn't have just a single tree, while a sparsely forested one shouldn't be covered in trees. So far I haven't encountered an embark that failed to match the pre embark description on embark (well, a single tree in the very sparse embark tile was below expectation, but not "unrealistically" so), but the ones I haven't logged vigorously have all degenerated into much denser than the expected sparse (or very sparse).
Barring stones and uneven terrain, sparse tree cover should mean there is no problem to find a wagon path to the entrance to the trade depot from the edge (you may of course have to remove a tree, or possibly two, directly in front of the entrance), and I would say the same should go for moderate as well.
Logged

GoblinCookie

  • Bay Watcher
    • View Profile

We know by looking at the initial generated density.  Obviously.

That is only the case if the total number of trees on the map initially is intended to be the final number of trees.  The reason to think it isn't is because they are all identical, if we had the final number of trees we thus end up with a pretty boring forest. 
Logged

Deboche

  • Bay Watcher
    • View Profile

It could be set with either a certain probability for a sapling to grow into a tree or for a sapling to appear at all. It'd be inversely proportional to the number of trees, simulating the way trees use up water or nutrients and prevent other trees from growing. So that a sparse terrain with 20 trees would be very unlikely to get a new one.
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile

It could be set with either a certain probability for a sapling to grow into a tree or for a sapling to appear at all. It'd be inversely proportional to the number of trees, simulating the way trees use up water or nutrients and prevent other trees from growing. So that a sparse terrain with 20 trees would be very unlikely to get a new one.
What's the formula...
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Deboche

  • Bay Watcher
    • View Profile

That's not that hard to figure out, it's just math. For each tree that's already mature(if we want to make it even more realistic, make it also dependent on the size of existing trees), it becomes less likely for a sapling to mature. So in a sparse terrain, as you reach 20 trees or whatever number you want, barely any saplings ever reach maturity.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile

It could be set with either a certain probability for a sapling to grow into a tree or for a sapling to appear at all. It'd be inversely proportional to the number of trees, simulating the way trees use up water or nutrients and prevent other trees from growing. So that a sparse terrain with 20 trees would be very unlikely to get a new one.
What's the formula...
My suggestion is in the first entry of this thread... That's just a suggestion for a starting point, though, as I'm more interested in a fix for the problem that a specific formula, but with something suggested, alternatives are more likely to appear, as well as criticism and improvements of existing suggestions.
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile

It could be set with either a certain probability for a sapling to grow into a tree or for a sapling to appear at all. It'd be inversely proportional to the number of trees, simulating the way trees use up water or nutrients and prevent other trees from growing. So that a sparse terrain with 20 trees would be very unlikely to get a new one.
What's the formula...
My suggestion is in the first entry of this thread... That's just a suggestion for a starting point, though, as I'm more interested in a fix for the problem that a specific formula, but with something suggested, alternatives are more likely to appear, as well as criticism and improvements of existing suggestions.
I'm trying to think of the formula that has a graph like that.
1/something.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Deboche

  • Bay Watcher
    • View Profile

Maybe you mean 1/ any exponential?
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile

Maybe you mean 1/ any exponential?
No.  Diminishing returns?
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Deboche

  • Bay Watcher
    • View Profile

My brain's exploding. I haven't done math since high school.
Logged

Edmus

  • Bay Watcher
  • Powerful toasting since 1893!
    • View Profile

Something like:
P=1/(xn)
Where n is the number of trees and x is a value from the biome and P is the probability the tree will grow to maturation.
Kinda crude, you'd want x to be very low in most cases. It'd give a constant growth rate up until a certain point.

Edit: Would have to be for biome tile, actually.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile

What I proposed expressed as code. Obviously, data types and data structures aren't like that, but it should be possible to understand what info the code make use of. For those who wonder what weird language the code is written in: it's Ada.

Void_Cost : constant Float := 1.0 / 320.0;
Global_Max_Distance : constant Integer := 20;

function Shall_Mature (Tree : in Tree_Pointer) return Boolean is
  Sum : Float := 0.0;
  Dist : Integer;
begin
  for I in -Global_Max_Distance .. Global_Max_Distance loop
    for K in -Global_Max_Distance .. Global_Max_Distance loop  --  I = 0, K = 0 is the sapling itself, but evaluating it doesn't matter since it adds 0.0.
       if abs (I) > abs (K) then
         Dist := abs (I);
       else
         Dist := abs (K);
      end if;

      if Tree.X + I in 1 .. Embark.Max_X and then  --  Assuming embark is in 1 .. X_Max, 1 .. Y_Max. It's probably 0 .. *_Max - 1 when C(++) is used.
         Tree.Y + K in 1 .. Embark.Max_Y then
           if Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Biome = Ocean or else
              Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Biome = Air or else --  And so on for all non tree bearing biomes. Probably done differently in practice.
              Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Biome = Rock then
                Sum = Sum + Void_Cost / Float (Dist);
            else

                if Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Biome.Tree_Maturation_Distance <= Dist and then then  --  Otherwise too far away to matter
                  Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Tree_Present then
                  Sum := Sum + 1.0 / Float (Dist) / Embark.Tile (Tree.X + I, Tree.Y + K, Tree.Z).Biome.Tree_Maturation_Density_Acceptance;
                end if;
            end if;
      else
         Sum := Sum + Void_Cost / Float (Dist);  --  Tiles outside the embark still apply the forest-less load.
      end if;
    end loop;
  end loop;

  return Random_Number >= Sum;
end Shall_Mature;
« Last Edit: November 08, 2015, 05:50:33 am by PatrikLundell »
Logged

endlessblaze

  • Bay Watcher
  • likes dragons for their fiery breath
    • View Profile

or you could just...you know....cut them down?

as already mentioned the trees should have space between them because they die if another tree is blocking the light.
Logged
Kids make great meat shields.
I nominate endlessblaze as our chief military executive!

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile

or you could just...you know....cut them down?

as already mentioned the trees should have space between them because they die if another tree is blocking the light.
Question:
Which of these is a desert?


(99% of dwarves can't tell the difference!)
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

PatrikLundell

  • Bay Watcher
    • View Profile

You can't cut them down if you've got a tree cutting agreement with the tree huggers, since the yearly tree regrowth is typically larger than the quota when the caverns are taken into account.

You can have the spacing rule mentioned by GoblinCookie, but that risks resulting in a samey pattern, and in nature trees occasionally grow right next to each other. Also, on biome boundaries you risk getting an artefact in the form of a "wall" of trees on the thicker side with a "void" on the other because the savanna distance to the jungle's trees prevents new savanna trees, but the trees on the savanna are out of the jungle's distance. It would work to stabilize the tree density, though.

Both of Bumber's pictures are of jungles with trees all over the place attacking from all directions at once (possibly not above: I don't think injury due to dropping of coconuts is implemented [yet])!
Logged
Pages: 1 [2] 3 4 ... 8