# Tree growth algorithm

## Recommended Posts

So what determines when a tree grows?

In the screenshot, I grew all of these trees at roughly the same time.  Admittedly I did go from top to bottom, but I would not expect to see half of my tree farm already in the adult tree stage or some dead trees even while others are barely grown at all.

##### Share on other sites

lol "algorithm"

GetRandomWithVariance(TUNING.EVERGREEN_GROW_TIME[CURRENT_STAGE].base, TUNING.EVERGREEN_GROW_TIME[CURRENT_STAGE].random)

The first value is the base time, the second the variance possible. Here's the numbers from tuning.lua:

--day_time is ten segments on the clock

EVERGREEN_GROW_TIME =
{
{base=1.5*day_time, random=0.5*day_time},
--short
{base=5*day_time, random=2*day_time},   --normal
{base=5*day_time, random=2*day_time},   --tall
},

##### Share on other sites

Hmm, probably a hiccup in the system then unless I'm misunderstanding.  The screenshot was taken the day after they were planted.  Those short trees shouldn't be short for more than 20 day segments and the old trees should not have gotten old before 70 day segments which, with 16 segments per day mean that shouldn't happen before 4 days.  I've seen this before and thought I was just seeing things.  I wonder if my mods are messing up my world :\  They're only interface mods though.  Hmmm

Edit - I guess I should ask does that mean:

Normal = 2...5 * day_time

Or is it

Normal = 3...7 * day_time

I took variance to mean + or -, but maybe it's referring to a minimum?

##### Share on other sites

It is +/- variance. But to be honest, it feels like trees grow faster than that, I don't know why.

also, just for the record:

PINECONE_GROWTIME = {base=0.75*day_time, random=0.25*day_time},