Re-Plant Trees

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

LazyLoneLion
Fast Inserter
Fast Inserter
Posts: 183
Joined: Sun Mar 20, 2016 11:49 pm
Contact:

Re: (Re)planting Trees

Post by LazyLoneLion »

leoch wrote:If you want to know anything about forests, you should know that a newly planted forest takes quite a few years even in a tropical biome to grow big trees, ...
If you want to know anything about the real world (and not the game) you should know that you cannot (in the real world) keep 50 locomotives just in your pocket (or 500 to be said). You can't keep few thousands of chests inside (the same) chest either. You can't invent new technology just by producing several conveyor belts and manipulators, feeding them into some workshop to get some scince packs, feeding which into some automated laboratories you'll get new tech.

Besides it's not "a tropical biome" -- it's extraterrestrial biome. :)

And you can in the real world replant big trees with machines big enough. In fact it's quite usual in the real world.

User avatar
Syrchalis
Fast Inserter
Fast Inserter
Posts: 137
Joined: Wed Feb 15, 2017 9:03 am
Contact:

Re: (Re)planting Trees

Post by Syrchalis »

Always love when people throw around the realism card in games.

I wouldn't mind decorative plastic trees just so I can make an avenue.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: (Re)planting Trees

Post by bobingabout »

Treefarm... nuff said. That basically added this, with one major drawback. The lag monster from having to constantly monitor trees to make them grow.

If this was a base game mechanic, it would likely be far more processor efficient, so I'd have no problem with it, in fact I'd be all for it.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
SlondoTK
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun Apr 16, 2017 3:20 pm
Contact:

Possibility to Plant Trees

Post by SlondoTK »

TL;DR
The Player could have the possibility of planting trees on the map to reduce pollution or collect resources such as wood and the seedlings themselves.
What ?
The trees of the game slightly absorb the pollution generated by the automation, however with the course of the game the player is forced to destroy a forest to continue its expansion, when breaking a tree it could have a chance to release beyond the wood, some seed To plant again in the future.
Sequoia.jpg
Sequoia.jpg (136.85 KiB) Viewed 6293 times
Why ?
The game would have a greater range of things to do, we could eventually add achievements, the wood would become infinite, and logically could also happen to appear more things made of wood like walls, catapults, bridges (yes, small wooden bridges) And other cool stuff ..
Of course, without mods or anything, the game in vanilla mode.
Note
I was also thinking of new species of trees, such as pines, ipês (tree well known in Brazil), acacia ...

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Possibility to Plant Trees

Post by d3x0r »

There's a Mod for that - Bio Industries
there's also growth mods that do it automatically.

User avatar
SlondoTK
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun Apr 16, 2017 3:20 pm
Contact:

Re: Possibility to Plant Trees

Post by SlondoTK »

d3x0r wrote:There's a Mod for that - Bio Industries
there's also growth mods that do it automatically.
The intention is to see this in the game without mods, several things have already been added with mods ideas, an example is the fluid wagon

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Possibility to Plant Trees

Post by Jap2.0 »

SlondoTK wrote:
d3x0r wrote:There's a Mod for that - Bio Industries
there's also growth mods that do it automatically.
The intention is to see this in the game without mods, several things have already been added with mods ideas, an example is the fluid wagon
How about you look at the "I want to make suggestions, but I got links to mods!! :(" thread, which is stickied on this forum.
There are 10 types of people: those who get this joke and those who don't.

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Possibility to Plant Trees

Post by d3x0r »

Jap2.0 wrote:
SlondoTK wrote:
d3x0r wrote:There's a Mod for that - Bio Industries
there's also growth mods that do it automatically.
The intention is to see this in the game without mods, several things have already been added with mods ideas, an example is the fluid wagon
How about you look at the "I want to make suggestions, but I got links to mods!! :(" thread, which is stickied on this forum.
:) nice thread.
So a better request would be 'there's this mod that works really well to plant trees... would be nice if it could be included in vanilla' stating 1) that you know there is already a way to do what you want to do; and 2) give the developers a springboard from which to extend vanilla :)

https://mods.factorio.com/mods/LukeM/TreeSaplings
hmm 2 pages of mods... https://mods.factorio.com/?q=trees
none look like they add more tree models though.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Possibility to Plant Trees

Post by bobingabout »

In theory mods can do it... but constantly checking for trees being planted, and monitoring them to make them grow (Only an issue if you want trees that grow) can really lag the game down, especially if you place lots of them. it would be better if the devs wrote some sort of tree growing support natively into the game.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Possibility to Plant Trees

Post by Jap2.0 »

bobingabout wrote:In theory mods can do it... but constantly checking for trees being planted, and monitoring them to make them grow (Only an issue if you want trees that grow) can really lag the game down, especially if you place lots of them. it would be better if the devs wrote some sort of tree growing support natively into the game.
Once you place the sapling/seed, shouldn't it simply be incrementing a counter, then occasionally changing the entity (to increase the size of the model and possibly drops)? I'd think that would be fairly inexpensive, UPS-wise.
There are 10 types of people: those who get this joke and those who don't.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Possibility to Plant Trees

Post by orzelek »

Jap2.0 wrote:
bobingabout wrote:In theory mods can do it... but constantly checking for trees being planted, and monitoring them to make them grow (Only an issue if you want trees that grow) can really lag the game down, especially if you place lots of them. it would be better if the devs wrote some sort of tree growing support natively into the game.
Once you place the sapling/seed, shouldn't it simply be incrementing a counter, then occasionally changing the entity (to increase the size of the model and possibly drops)? I'd think that would be fairly inexpensive, UPS-wise.
There were mods like this (treefarm for example) that are no longer in use. Once you got above few hundred trees overhad of handling them was visible and started to affect performance. There were some attempts at optimizing but didn't help that much. Most people switched to mods that add some kind of assembling machine that has long recipe to produce wood and thats it. There is no way to beat that in overhead with tree planting/growing.

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: Possibility to Plant Trees

Post by Veden »

You may not be able to beat the overhead, but you could disperse the computation over time.

so only process a set number of trees per interval, which will cause the growth and the computation to remain constant no matter the size of the world or the trees within it.

Hannu
Filter Inserter
Filter Inserter
Posts: 850
Joined: Thu Apr 28, 2016 6:27 am
Contact:

Re: Possibility to Plant Trees

Post by Hannu »

Growth of trees could be slow process. Every chunk would be updated for example once in hour. If there were saplings on updated chunk there could be some probability for them to grow up. Game could also count trees from the chunk and 8 adjacent chunks and calculate how many new trees would appear by natural reproduction.

If one chunk was updated in every tick there could be 216000 chunks or 14700 * 14700 area exposed. It would certainly have negligible effect into UPS.

SyncViews
Filter Inserter
Filter Inserter
Posts: 295
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

Re: Possibility to Plant Trees

Post by SyncViews »

Mods to make a decentwood based fuel setup cause too much lag right now, but would be cool if devs could make a highly optimised version as a solar/nuclear alternative.

Make each tree give a meaningful amount of fuel value, and bots to auto plant and harvest. Or of course find another use for wood.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Possibility to Plant Trees

Post by bobingabout »

Jap2.0 wrote:
bobingabout wrote:In theory mods can do it... but constantly checking for trees being planted, and monitoring them to make them grow (Only an issue if you want trees that grow) can really lag the game down, especially if you place lots of them. it would be better if the devs wrote some sort of tree growing support natively into the game.
Once you place the sapling/seed, shouldn't it simply be incrementing a counter, then occasionally changing the entity (to increase the size of the model and possibly drops)? I'd think that would be fairly inexpensive, UPS-wise.
The problem is that the counting has to be done "on_tick".
To know what you're counting, you have to keep track of every tree that has been planted.
Now, while yes, you could spread the load out over all of the ticks... the more trees you plant, the more operations you have to perform every tick cycle.
It slows the game down.



Treefarm mod was the old mod's name. It was a good mod, but had these lag issues as mentioned previously. I used it myself. I recommended that people who played my mod pack used it. But I kept getting people asking me to implement it into my own mods "But less laggy".

Now, I made promices about my mods, that I wouldn't use lag inducing on_tick routines. (And I failed using only a very simple on_tick routine in my inserters mod to detect if you've walked away from the inserter you were configuring. Fairly sure I've fixed that now.) so my solution was the assembling machine long cycle "Greenhouse". Aaand, there you have it, why mods don't have growing trees anymore.


See... one of the main problems with scripts like this is that to perform an instruction in LUA, it takes several equivalent C commands. The more involved and long winded the instruction, the longer it takes realtime. If the same logic were implemented directly into the game's C code (Or is it C++? I forget, which I shouldn't, I have access rights to read the game's source code, I should browse that more often.) it could be far more efficient, and could handle orders of magnitude of thousands more trees before you notice the lag. It's just convincing the devs that not only are growing trees a good idea, but that they should do it.

One of the advantages of growing trees is also that they could spawn their own seedlings in neighbouring tiles. And grow themselves. Forests could repopulate themselves!

I'll stop here though...
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Koub
Global Moderator
Global Moderator
Posts: 7200
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Possibility to Plant Trees

Post by Koub »

bobingabout wrote:One of the advantages of growing trees is also that they could spawn their own seedlings in neighbouring tiles. And grow themselves. Forests could repopulate themselves!
Until every single tile out of your base is totally covered with trees. Maybe not that good idea :mrgreen:
Koub - Please consider English is not my native language.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Possibility to Plant Trees

Post by darkfrei »

I've just make a simple mod TickForTrees_0.0.2.zip, which makes aging-tree-table. Every tick for every tree just n = n+1 (not comparing).
It's really hard, after 30 seconds (it was 2000 chunks) the table was around 85k trees and frequency was dropped to 30 fps/ups.
Attachments
TickForTrees_0.0.2.zip
(1.15 KiB) Downloaded 99 times

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Possibility to Plant Trees

Post by d3x0r »

@bobingabout

TreeFarm - Lite supports 0.13; needs 3 lines added to make compatible with 0.15... (fuel types)

placed I dunno maybe 36 treefarm mk2's ... got it up to 0.1ms update in the scrpt so I guess I'd have to add another 360 to get to 1ms. and then 3600 farms to start affecting UPS.
but then I have a pretty good CPU even if it is 5 years old

:) make a conways game of life with trees eh?

- Really semi-motivated to make a high speed tree growth mod that flood fills everything ;really shouldn't even have to check to see if there is something in a spot before growing into it, just try, if it fails it fails.
:/ (And to go really far off topic; a function call is really slow; a call with parameters is slower. pairs() is slow. a linked list is faster than a for with an index into an array. That last point makes making a scheduler easier anyway. probably should start a different thread... )

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Possibility to Plant Trees

Post by d3x0r »

darkfrei wrote:I've just make a simple mod TickForTrees_0.0.2.zip, which makes aging-tree-table. Every tick for every tree just n = n+1 (not comparing).
It's really hard, after 30 seconds (it was 2000 chunks) the table was around 85k trees and frequency was dropped to 30 fps/ups.
F4 - show-time-usage

UPS 53.8 (17ms script update)
46.230 Script control.lua:25: game.tick = 2562000 Trees: 135939

(after mods below)
UPS 60.0 (12ms script update)
52.711 Script control.lua:28: game.tick = 2562600 Trees: 135939

UPS 34 (26ms script update)
325.351 Script control.lua:28: game.tick = 8861400 Trees: 312609

And then; you don't need to update tree age every for every tree, but instead you could update 1 tick every 2 seconds and handle 2,718,780 trees in the same time.

Code: Select all

	global.trees = nil

-- in tick change for ... pairs
	local cur = global.trees;
	while cur do
		cur.age_ticks = cur.age_ticks + 1
		cur = cur.next;
	end


-- in add surface trees
	for i, tree in pairs (trees) do
		global.trees = {next=global.trees, age_ticks = 0, entity = tree}
		global.next_ID = global.next_ID+1;
	end

Attachments
control.lua
(1.27 KiB) Downloaded 73 times

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Possibility to Plant Trees

Post by darkfrei »

d3x0r wrote: And then; you don't need to update tree age every for every tree, but instead you could update 1 tick every 2 seconds and handle 2,718,780 trees in the same time.
The best optimization is: don't update trees. Just take first tick of the tree and write to table. Then on tick you can compare (game.tick - tree.creation_tick) some of them and update. Then you can have no problem with fps anymore, just lower updating on your map.

Nice optimization with while cur do!

Post Reply

Return to “Ideas and Suggestions”