Bay 12 Games Forum

Please login or register.

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

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

PatrikLundell

  • Bay Watcher
    • View Profile

Treesplosions are annoying as they can completely junglify an embark that was sparsely forested initially. Not only does an excessive tree take a toll on the FPS, they can also block off parts of the embark completely (especially in the caverns).

My suggestion is to implement an algorithm that causes sapling maturation to slow and stop as the tree density increases. I'd try something along these lines:
- When a sapling is due to mature, make a random determination of whether it is a candidate or if it succumbed to background circumstances (being eaten, parasites, ...). I believe this is basically how it works today, but instead of becoming a tree on a successful roll, the sapling would move to the next stage. The maturation threshold should probably be lowered to compensate for losses in the following stage, though.
- Each biome would have its own set of parameters that controlled maximum tree density.
- I'd try to use two factors to control the process: Distance and Density_Acceptance. The Distance would determine how far away other trees would influence the maturation of a sapling, while Density_Acceptance would be an adjustment factor that determines how many trees' worth of neighbors a sapling can tolerate to have any chance to mature (or, rather, when the chance is reduced to zero).
- I'd have a distance drop-off relation to give a higher weight to an adjacent tree than to one further away. You could e.g. give a weight of 1/distance to each tree within the cutoff Distance.
- You could either use an actual distance to a neighbor tree, or just use the larger of the X or Y distance.
- You would have an overall maximum distance of e.g. 20 tiles.
- Each tree within the maximum distance would add a value of 1/distance/Density_Acceptance of the biome that tree resides in, with 0 if that biome's Distance is shorter than the actual distance (this should result in a gradual density gradient in biome border regions).
- If a tile is a non tree supporting tile (air, rock, water, treeless desert, etc) I'd add a value of 1/320/distance (with a 20 tile max X/Y distance that should mean a single tile surrounded by non tree supporting tiles would have a 50% chance of maturing, if I've calculated it correctly). This is intended to provide some negative pressure from non tree supporting areas.
- The sum of all the results out to the maximum distance should then sum up to a chance of (1.0 - Sum) of maturing, which can be negative, i.e. no chance at all.
- I would probably only check the same Z level as that of the sapling, but it would be possible to check upwards/downwards if desired, to cater for trees below or a canopy above, with the associated complications of a potential floor in between. My guess is that taking Z levels into account isn't worth the effort.

A jungle might have a short Distance of e.g. 3, while a sparsely wooded desert might use the maximum Distance. Similarly, a jungle should have a higher tolerance for competition than less densely forested biomes.

I think sapling maturation happens infrequently enough that the extra CPU used to calculate maturation is more than offset by the savings resulting from not having to calculate the growth of as many trees.

Edit: Below I'm trying to summarize what's known/believed about the current tree behavior, including insights gained after the discussion below occurred.
- A bug correction report indicates adventure mode trees (and a lot of other things) are generated from tile related seeds as the tile is prepared for display.
- There is no indication there is currently any difference in the terminal tree density influenced by the biome. All biomes supporting trees will eventually end up equally dense, apart from inherent differences in canopy suppression (more below) and density of vegetation supporting ground tiles (lots of stones and surface clay can reduce the number of tiles available for vegetation).
- The initial tree density of a fortress biome is probably (my guess) generated using exactly the same algorithm as is used for adventure mode, and that one does, obviously, generate a different tree density appropriate for the biome (as per Toady's interpretation), but has no influence whatsoever for the further tree development.
- Saplings appear to spring up randomly in eligible tiles in competition with other vegetation.
- I haven't heard of any investigation that indicates any pruning of sapling type based on an over abundance of that type of the tree already on the map, although there have been speculations about such a mechanism, I find it unlikely to be present.
- I've speculated above and below that saplings have a random risk of dying rather than maturing. As far as I've seen, that is not the case. Instead, saplings die only because of canopy suppression, physical abuse (trampling), and physical obstructions blocking maturation (ceiling lower than two tiles. Note that bridges do not count as ceilings: trees below will mature and sprout though the bridges [0.40.24, unlikely to have changed]).
- It's currently believed saplings below the canopy of another tree will die, thus providing a small uneven zone around the tree where competition is kept at bay. My experiments indicate this suppression acts ONLY on the level directly above the ground, i.e. the canopy acts identically to a floor above. I've got 3 cases where saplings have matured with a canopy above two tiles above the ground. However, any canopy part, including twigs, seem to suppress sapling maturation if at the appropriate elevation.
- Palm trees and the like have very small canopies, young trees have small, usually lopsided, canopies, and cavern trees are just terrible, with many types just sprouting a pole that may, after many years, grow into a hat, leaving ample time for fences to form. I haven't been able to look too closely at palm trees as I haven't embarked in such biomes much, but there is a risk their canopies actually appear only 2 levels above the ground if they look like real world counterparts, in which case they would provide no suppression at all.

Edit 2:
- After observing a multi biome embark, I've seen the tree maturation rate being considerably higher in the forest biomes than in other biomes. This observation does not contradict the observations above, as it means an undisturbed forest will reach the end density faster than sparser biomes, but the end density will still be the same.
« Last Edit: November 15, 2016, 11:02:17 am by PatrikLundell »
Logged

GoblinCookie

  • Bay Watcher
    • View Profile

Is this not presently in the game?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile

I'm not sure I understand the comment, but treesplosion is currently in the game, while curbing is not, according to my experience and understanding. Thus, this is a suggestion of a solution to a problem (or bug, if you like).

Edit: If the comment refers to the upcoming version I'm not aware of it being addressed, but if so, I'll happily see this thread sent to the waste basket as redundant.
« Last Edit: November 01, 2015, 07:52:34 am by PatrikLundell »
Logged

GoblinCookie

  • Bay Watcher
    • View Profile

I'm not sure I understand the comment, but treesplosion is currently in the game, while curbing is not, according to my experience and understanding. Thus, this is a suggestion of a solution to a problem (or bug, if you like).

Edit: If the comment refers to the upcoming version I'm not aware of it being addressed, but if so, I'll happily see this thread sent to the waste basket as redundant.

Yes, the number of trees increases from when you load the area.  The starting trees also grow a lot from when they started out, that is because the original trees on the map are abstracted originally and then loaded into the game.  New trees grow up, but they have be at a certain distance from the existing trees, for that reason there are always even after many years of play in a woodland some gaps in the jungle still exist. 

Basically, the total number of trees in the game is not intended to be the final number of trees, instead the map is supposed to jungle; the reason is that it makes for a more interesting forest with more interesting trees growing in a more realistic way than if Toady One simply established the total number of trees in an area as that would result in boring trees all the same size and shape.  Junglefication is a compromise between realism and memory limitations in world-gen. 

Since all trees must grow a given distance from other trees at the moment and there are variables in a biome deciding how wooded it is; I have yet to be convinced that your suggestion has not already in essence been implemented.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile

I'm not convinced you're correct unfortunately, and if you are, it probably needs adjustment. A sparsely wooded area shouldn't gradually turn into a jungle even if it very well could become slightly denser (but not a full blown forest), nor should caverns get so full of trees that large parts get inaccessible. It's certainly not the case currently that new trees have to be a certain distance from each other, since they happily spring up just beside (or between) other trees. In a jungle, I wouldn't be surprised to see 3 or 4 trees forming an L, a line, or a square, but that shouldn't happen on a savanna (or be quite rare, in any case).
I have the impression that sapling maturation might be faster in more forested biomes, but that's certainly not a fact.
Anyway, if adjustment of existing parameters removes or tones down the issue significantly I'm still happy. The problem is that I haven't seen any indication of anything that seems to limits tree growth, i.e. I haven't seen anything indicating the limitations you describe to be there. If you let trees grow for 10 years in an (originally) sparsely forested area you're forced to pave roads (or cut regularly) to allow caravans to reach you, and that should never be required in a sparse area, and there is no indication of a slowed down tree maturation: they just keep coming.
Logged

GoblinCookie

  • Bay Watcher
    • View Profile

I'm not convinced you're correct unfortunately, and if you are, it probably needs adjustment. A sparsely wooded area shouldn't gradually turn into a jungle even if it very well could become slightly denser (but not a full blown forest), nor should caverns get so full of trees that large parts get inaccessible. It's certainly not the case currently that new trees have to be a certain distance from each other, since they happily spring up just beside (or between) other trees. In a jungle, I wouldn't be surprised to see 3 or 4 trees forming an L, a line, or a square, but that shouldn't happen on a savanna (or be quite rare, in any case).
I have the impression that sapling maturation might be faster in more forested biomes, but that's certainly not a fact.
Anyway, if adjustment of existing parameters removes or tones down the issue significantly I'm still happy. The problem is that I haven't seen any indication of anything that seems to limits tree growth, i.e. I haven't seen anything indicating the limitations you describe to be there. If you let trees grow for 10 years in an (originally) sparsely forested area you're forced to pave roads (or cut regularly) to allow caravans to reach you, and that should never be required in a sparse area, and there is no indication of a slowed down tree maturation: they just keep coming.

The problem is that we do not know how dense the area is supposed to be (the starting area is unrealistically open in many cases), I certainly have not needed to pave roads for caravans and that was in an area classified as woodland after 7 years; it might be you have settled on a super-tree friendly area though.  I would not have imagined however that Toady One would not have adjusted the tree growth distance according to the biome as it is an obvious thing to do.  From what I have experianced the tree density we end up with is quite reasonable, there are many areas of my map that I have never touched with woodcutters and I see plenty of space to move around.

Yes trees do not spring up next to eachother and if they do they die off as saplings.  Trees grow around eachother, snaking and twisting to get at the available light so that we end up with funny shapes of trees rather than the standard issue ones we start off with.  Intially there is a whole batch of saplings, the first tree to grow up then kills off all the other trees; that is why you can slowly build yourself an orchard if you cut down all the trees that do not produce fruit. 
Logged

Neonivek

  • Bay Watcher
    • View Profile

Too many trees hurt the FPS?

News to me.
Logged

Ribs

  • Bay Watcher
    • View Profile

Too many trees hurt the FPS?

News to me.

The new tree mechanics (leaves especially) are bad for your fps.
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile

Why did I just think of a thermonuclear treesplosion.
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

I like them. How else can you make steel and soap? It's one of those bugs like quantum stockpiles that circumvent certain unfinished parts of the game and make it playable at this stage.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile

I like the trees, but with moderation (there are aspects/bugs I'd like changed, like immunity to magma and cave-ins, but not the tree concept itself). Even if you like spicy food, you still don't want to eat spices with traces of food in it. The FPS hit resulting from many trees is of course not liked by anyone.

With a tree growth logic along the lines I proposed (or the one GoblinCookie claims is present already) regular tree cutting should ensure maximum tree regrowth rate, while leaving trees mostly alone should gradually slow the growth until the embark is almost saturated according to the biome density (there would probably still be individual tiles left that could eventually fit a tree for a long time). Logging would open up for regrowth, as would spontaneous tree death (which I don't think happens, and I don't think it would add much except realism and logging job cancellations if it was).
Logged

Bakaridjan

  • Bay Watcher
    • View Profile

I also find the tree growth logic slightly buggy, at this point. Especially in what would not typically be a heavily forested environment, like deserts. I normally get magma forges set up in the first three years which is almost always before the treesplosion happens. So about the moment that I'm reducing my need for trees I get huge quantities of them and they're just annoying. I would really like to see fire/magma completely burn mature trees, both above and below ground.
Logged

Edmus

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

It is certainly too fast. My desert embark is a forest of saguaros.
Logged

GoblinCookie

  • Bay Watcher
    • View Profile

Too many trees hurt the FPS?

News to me.

They really do.  FPS takes a hit in spring and summer because that is when the trees grow.

It is certainly too fast. My desert embark is a forest of saguaros.


But how do we know how many saguaros are there supposed to be?
Logged

Dozebôm Lolumzalìs

  • Bay Watcher
  • what even is truth
    • View Profile
    • test

We know by looking at the initial generated density.  Obviously.
Logged
Quote from: King James Programming
...Simplification leaves us with the black extra-cosmic gulfs it throws open before our frenzied eyes...
Quote from: Salvané Descocrates
The only difference between me and a fool is that I know that I know only that I think, therefore I am.
Sigtext!
Pages: [1] 2 3 ... 8