Wood
Moderator: bobingabout
Wood
Hi guys, I just started playing Bob's mods and I was wondering about the long-term viability of hand-chopping all the wood my factory needs. Is there a tech later that allows you to create wood or farm it or something? I haven't found anything yet and I think my factory will definitely use wood faster than I can chop it down the road.
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: Wood
You can make synthetic wood from heavy oil once you get to oil processing techs.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Wood
I'm out of tune with my own mod, it's been so long >.<
Anyway, yes, you can make synthetic wood from heavy oil. I think it comes under Plastics research.
Anyway, yes, you can make synthetic wood from heavy oil. I think it comes under Plastics research.
Re: Wood
I updated Treefarm Lite to work with 12.20.
You can find it here:
https://forums.factorio.com/forum/viewtop ... 20&t=18870
You can find it here:
https://forums.factorio.com/forum/viewtop ... 20&t=18870
- Buggi -
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
-
- Fast Inserter
- Posts: 124
- Joined: Fri May 22, 2015 3:31 pm
- Contact:
Re: Wood
I also wrote a very simple greenhouse mod to produce wood.
It's not as pretty as Tree Farm, but far less laggy if you're going big.
It's not as pretty as Tree Farm, but far less laggy if you're going big.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Wood
I think I was going to take a similar approach for wood manufacture in my mod. well, actually I had a couple of options, for example crafting seedlings from wood, then wood from seedlings with a net gain, but the end result is wood from nothing.SpeedDaemon wrote:I also wrote a very simple greenhouse mod to produce wood.
It's not as pretty as Tree Farm, but far less laggy if you're going big.
Re: Wood
Buggi is researching ways to speed Treefarm up, note if you make lots of them it will lag your game. Greenhouse works like a normal factory and so has no major performance concerns.
Re: Wood
Yeah, I really dug through the treefarm code and there is very little that can be done to optimize the backend.
The fact it has to scan the farm to check for trees that need to grow, plant seeds, or harvest is kind of intensive.
Currently it has a 60 tick delay on any sort of processing it does. The number of treefarms your game can support before experiencing lag is solely dependent on your computer. I could increase the delay.
The last game I played had 35 treefarms and was doing pretty well, but I have 32 gigs of ram and a beefy processor.
Also keep in mind the trees from treefarm once harvested give 5 wood instead of the vanilla 4 and they grow pretty fast.
The fact it has to scan the farm to check for trees that need to grow, plant seeds, or harvest is kind of intensive.
Currently it has a 60 tick delay on any sort of processing it does. The number of treefarms your game can support before experiencing lag is solely dependent on your computer. I could increase the delay.
The last game I played had 35 treefarms and was doing pretty well, but I have 32 gigs of ram and a beefy processor.
Also keep in mind the trees from treefarm once harvested give 5 wood instead of the vanilla 4 and they grow pretty fast.
- Buggi -
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
Re: Wood
Hi,
I know absolutely nothing to LUA, mods, and stuff, but I might have an idea for a lighter aglorithm CPU-wise.
Every time something happens to a farm (tree growth, seed plant, dunno ...) the farm could calculate when will be next event for that particular item that had an event in a sorted table of all future events. Like that, every tick, you wouldn't have to cycle through all the farms and all the farm items, but just check "I'm at that tick into the game, what are the events my treefarm mod has to process this tick" ? Then every time each is processed, it can calculate easily when will be the next event for that ressource, and add it to the aforementionned sorted table.
No more scanning, should avoid a lot of work. Would this help ?
I know absolutely nothing to LUA, mods, and stuff, but I might have an idea for a lighter aglorithm CPU-wise.
Every time something happens to a farm (tree growth, seed plant, dunno ...) the farm could calculate when will be next event for that particular item that had an event in a sorted table of all future events. Like that, every tick, you wouldn't have to cycle through all the farms and all the farm items, but just check "I'm at that tick into the game, what are the events my treefarm mod has to process this tick" ? Then every time each is processed, it can calculate easily when will be the next event for that ressource, and add it to the aforementionned sorted table.
No more scanning, should avoid a lot of work. Would this help ?
Koub - Please consider English is not my native language.
-
- Fast Inserter
- Posts: 124
- Joined: Fri May 22, 2015 3:31 pm
- Contact:
Re: Wood
Well, not exactly nothing. The greenhouses don't take modules, and they run at 100kW 100% of the time. On my current map, they are tied for #1 power hog with roboports.bobingabout wrote:I think I was going to take a similar approach for wood manufacture in my mod. well, actually I had a couple of options, for example crafting seedlings from wood, then wood from seedlings with a net gain, but the end result is wood from nothing.SpeedDaemon wrote:I also wrote a very simple greenhouse mod to produce wood.
It's not as pretty as Tree Farm, but far less laggy if you're going big.
To add to Koub's idea for Tree Farm, perhaps it would be possible to trade increased memory usage for increased performance. If each plot (where an individual tree would grow), added its next scheduled/timestamped action to the end of a queue, you would only ever have to check the head of the queue, process those items that are past due, and add another item to the back of the queue. That would avoid any iteration whatsoever. At worst, if each farm had its own queue, you'd only have to look once at each farm.
Re: Wood
The queue idea I've thought of. Unfortunately some things take much less time than others, so adding to the bottom of a queue wouldn't really work.
Take harvesting for example. Once the tree growth event is triggered on the tree to the max level, that tree can be immediately harvested. Even though there might be 48 other trees with tick delays. So adding to the bottom would delay the harvest. Then once harvested, a new seed could be planted right away (maybe, depending on collision).
At best you'd have to check the entire queue for any past-due events. Worse would be a resort method every time the queue is modified.
I'll look into it some more.
Take harvesting for example. Once the tree growth event is triggered on the tree to the max level, that tree can be immediately harvested. Even though there might be 48 other trees with tick delays. So adding to the bottom would delay the harvest. Then once harvested, a new seed could be planted right away (maybe, depending on collision).
At best you'd have to check the entire queue for any past-due events. Worse would be a resort method every time the queue is modified.
I'll look into it some more.
- Buggi -
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames
-
- Burner Inserter
- Posts: 15
- Joined: Sat Mar 21, 2015 10:23 pm
- Contact:
Re: Wood
Buggi: You can use a priority queue for this, which can find the next (i.e. lowest-time event for you). I don't know Lua, but it should be easy to find an implementation online (or in the Lua libraries), for example https://rosettacode.org/wiki/Priority_queue#Lua
Then your main loop can look something like:
This should be fast because you only need to look at the events that are actually ready.
Then your main loop can look something like:
Code: Select all
Q = PriorityQueue()
on_tick():
while not Q.empty():
(time, event) = Q.pop()
if time < now(): # in the past
# do event
# push new events at their appropriate times
else:
Q.insert((time, event)) # oops, this isn't ready yet
break