Natural Tree Expansion

by aster26

Aliens reproduce, why trees don't?

8 years ago
0.13 - 0.14
36

g Excellent Mod! Grow Area?

8 years ago

This mod is just what I was looking for, and seems to work well.
I appreciate your efforts!

Only thing that seems to be off, is the 192 tile range in which nothing grows outside of.
I understand it is for save size/performance, but is there a way I could crank this radius up some? I looked at both control.lua and config.lau and didn't see anything obvious where I could go about increasing the range. I did see the section on the subject in control.lua, but was unable to figure out how to accomplish what I was after.

Thanks again! Love the mod!

8 years ago
(updated 8 years ago)

Well, first I have to remember what I've done almost half a year.

The file you'd want to edit is control.lua, but it has tricky optimizations which makes understanding it difficult.

I used sort of "superchunks" to group a set of chunks, which is currently 4x4 chunks, in order to quickly determine proximity of player's structures. The number of 192 tiles comes from (chunk_size * 4 + 0.5) where chunk_size is 32 tiles (0.5 comes from average of distance from the edges of the superchunks). Those "superchunks" are stored in a local map "playermap".

So one way to expand the radius is to increase the size of superchunks by replacing likely "4"s in control.lua (I wanted it to be easily customizable by replacing it with a variable named playermap_freq, but somehow I forgot to finish that task).

Another way would be to stop using superchunks to detect player's structures at all. However, if my understanding is correct, there are more generated chunks in a map than you can see in the in-game map, so you may need more memory and disk space than you may expect.

New response