Author Topic: Shippey - a forestry test bed  (Read 176 times)

0 Members and 1 Guest are viewing this topic.

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 479
Shippey - a forestry test bed
« on: September 26, 2017, 04:56:16 PM »
Welcome to Shippey, a test bed for the Pine Set forestry chains. For the latest Pine Set release, I decided to try to make natural resources a bit harder to come by by changing a few numbers in the code, but the results were not as I had intended, certain resources remained powerful, while others seemed to almost vanish. So today I spent a lot of time testing the set, and recording all production numbers over the course of 14 game years. I found some interesting things, so thought I'd share them here for if modders or players are interested.

First, the scenario. Shippey (a fantastic random generated name) is a small town on a lake primarily concerned with maximising forest output so I can see what the perfect numbers are. For this, debug was used. So here are some stats...

  • Map = Medium, Valleys, Mild
  • Mods = Maritimes Pine Set, Better Stock Piles, Maritimes Storage, Debug Menu, Norsemen, and a collection of random game changes I made for myself that I have named 'Play Conditions'.
  • Debug options to start - All educated, No effects of hunger, warmth, health.
So I put the log limits up high, so the foresters are always working both cutting and planting so I can see log production too. There are three forest areas surrounding Shippey, Vanilla, Pine, and Maple. Each one has their respective gatherer building, a hunter, a trapper, and a herbalist. I want to know the full production of individual buildings and the forests as a whole. There is a lot of storage, and most citizens have a house, there is a church, a town hall, and most production buildings to keep chains running and not jam up the storage with primary forest products.

I have attached a few pics of Shippey taken around year 12 if you are interested.

So here is the issue. There are two numbers in the code that I played around with and the assumptions I made about them
  • "float _spawnChance" - found in the natural resource template file - I assumed this is the chance that this resource will be spawned by a tree rather than another resource. I also assumed that the higher the number (seemingly from 0.0 to 1.0) the more chance of this resource spawning. All vanilla gatherer items have a spawn chance of 0.4, so for those I wanted rarer I lowered it, and for those more common I raised it.
  • "float _minSpawnAge" - found in the natural resource tree template file where you list the natural resources that will spawn from the set of trees. This number ranges from 1.1 in vanilla herbs, to 0.1 for all wild foods. I assumed that the higher the number, the older a tree needs to be to spawn a resource. I also assumed that this number is in years (there is nothing saying anything otherwise). So, for resources I wanted from mature forests (fur) I put this number as 3.

Here is a link to a spread sheet with all of the information and outputs if anyone is interested.

It seems my assumptions were wrong, for the most part, as the resources with a lower spawn chance and a more mature forest just never showed up. Now, the spawn chance worked how I expected it to. Resources with a lower chance generally had lower instances of being collected from the forest. Resources with a higher chance were collected more often. However, there was quite a discrepancy between resources with identical numbers, so we'll just say this is random game mechanics at work. I was also really surprised and the inter-year variation in resource harvesting of a building, it is really high.

While spawn chance worked as expected, min spawn age is a lot more complicated and I really don't understand it, mainly because I have now no idea what that number represents (hello, banished modding). I assumed it was in years. If you look in the tree file, you see the following that defines the growth of trees...
Code: [Select]
// maximum growth before death, -1 for ever living
float _maxGrowth = 5.0;

// growth +- some amount
float _maxGrowthTolerance = 1.0;

// length of growth period to maturity
float _growthInMonths = 36;
Now interestingly growth to maturity is specified in months, where as the others are not. Again an assumption, that the maxGrowth and maxGrowthTolerance numbers are in years. So, a tree lives for 5 years +/- 1 year. That means that a mature stand of trees should accommodate a resource with a minSpawnAge of 3 rather easily. However, looking at the spreadsheet numbers, we see this...
  • Fur - minSpawnAge=3 - years after planting a forest that this resource appeared = 11
  • Pelt - minSpawnAge=1.5 - years after planting a forest that this resource appeared = 6
  • Pine Resin - minSpawnAge=1.5 - years after planting a forest that this resource appeared = 6
  • Maple Sap - minSpawnAge=1.0 - years after planting a forest that this resource appeared = 4
  • Herbs - minSpawnAge=1.1 - years after planting a forest that this resource appeared = 4
So, the minSpawnAge is certainly not in years. But then, neither can be the tree growth number, as here we have trees that are 11 years old producing resources. But why specify the tree maturity in months? These numbers don't make sense without knowing what they actually represent, but without the input from the dev anymore, I doubt we will ever know.

So, basically, my testing revealed that I have no idea what the numbers for tree growth and spawn age mean, and was too harsh with them when trying to make the set a bit more complicated. Furthermore, there is an interaction between spawn chance and min spawn age that makes resources needing mature forests and a low chance disproportionately harder to find, as they are outgrown by those with a higher spawn chance. This makes sense, but I think the effect is stronger than either of the two numbers individually.

So what next? Well, I will make all of the spawn chances 0.4, and bring the minSpawnAge down a bit so that the mature items need about 4 to 6 years to produce, then have the same chance of spawning as other items. Hopefully this will balance out the forests a little bit more.

I also have come to the conclusion that the trapper chain needs to be taken out of the forest and perhaps put in its own layer, so it is independent of forests and global on the map. I don't really know how this works though, so that will need some research.

Another conclusion is that the gatherers are far too powerful, but also the specialized resources for why I made three different forests are too weak. So I need to split things up and re-organised a bit more. Perhaps have a dedicated apple forester with associated production buildings, a designated maple one, etc.

Another interesting thing is just how much of a difference the effects of hunger, warmth, and health have on production numbers. See the graph in the fourth picture? Those last two years are when I turned on the effect of hunger, warmth, and health. Suddenly food production stopped (thankfully balanced rather nicely!) as citizens started eating but also stopped producing so much due to spending more time walking around the map looking for food, warmth, and health.

Offline brads3

  • Banished Expert
  • *****
  • Posts: 1442
Re: Shippey - a forestry test bed
« Reply #1 on: September 26, 2017, 06:12:26 PM »
remind me to read this tomorrow. i am too tired to think tonight.

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 479
Re: Shippey - a forestry test bed
« Reply #2 on: September 26, 2017, 07:15:04 PM »
@brads3 just some random musings more than anything mate :)



Test 2 - we move to a town called Emhouseview. A much less interesting random name than Shippey! For test 2, I made some changes to the mod. The conditions are the same as Shippey above, I've attached a picture of when just about to start activating the forests (also, pics of the map and seed because it is a pretty neat map! I'll try to get the ones for the original Shippey too because that was also a neat map). Firstly, I made all of the create chance values 0.4, inline with vanilla values. I then used the mysterious minSpawnAge values to define a resource to young, middle, or mature forest. In this case, young is 0.2, middle is 1 to 1.1, and mature is 1.5.

The results...
  • minSpawnAge = 0.2 (most vanilla items), first appears year 2-3 of a new forest.
  • minSpawnAge = 1.0 (pine resin, maple sap, apples, pelts), first appears year 5.
  • minSpawnAge = 1.1 (herb), first appears year 5
  • minSpawnAge = 1.5 (fur), first appears year 6

So, shortening the minSpawnAge has made a good adjustment to the spawn rates, and also making all resources have a spawn chance of 0.4 means they are a lot more balanced together. There are still bit discrepancies between years, but for the most part resources produce at a similar level. This has balanced the forest much closer to how I would like it, although I still think changes are needed in terms of moving trappers out of the forest, and moving around some of the spawns so that you get more of a concentrated resource rather than few of a range.

Also, some observations - the dev made two things very hard to get. Wood => Firewood, and herbs.

Firstly, wood to firewood. The amount of wood that trees produce is very low, and so producing firewood alongside building is a challenge. I think that the trees could be a little more generous here, especially as we have expanded our wood usages a lot with lumber etc. I also think that alternative house fuel sources are a very good addition, and while they should not be too easy (for example, when using reeds or grass, it should be much more costly to make than firewood) I think it would add good diversity to early game if you could choose to produce costly reed bundles for fuel and save the wood for building.

Secondly herbs. Some people will tell you health has little impact on the game, I disagree. Herbs, being the main way to increase health of your bannies, are very hard to come by in a non-modded game. After a while, without herbs, your bannies will waste a lot of time looking for a herbalist and wandering around town, especially if you have a herbalist but are short on herbs. To get herbs, you need a herbalist, your labourers etc. will not produce herbs if you tell them to clear them, only herbalists will. But, herbs also don't grow until quite mature forests appear (it takes 5 years of forest growth above to get the first couple of herb bundles) and after then production is really quite variable year on year, and never very high. This means that you either need to concentrate on getting at least one mature forest going (at the expense of the above mentioned wood and firewood) or pick a very good spot to place your first herbalist. Either way, I am quite surprised but also now appreciate how hard the dev made it to get good health and heat in early game.

Offline brads3

  • Banished Expert
  • *****
  • Posts: 1442
Re: Shippey - a forestry test bed
« Reply #3 on: September 27, 2017, 03:08:05 AM »
before i read through this,i will say aat i have not had a issue with outputs.to me it seemed to be a good balance. i would rather the apples higher,but that is more a personal preference than the mod being wrong.as for the trappers working and then not,the times they did that seemed related to trees. if i placed it in a meadow,the trapper would chase beavers out of the area.so that too isn't wrong as much as it was realistic. in a fodder meadow being worked,the animals would be chased out and yield less furs or pelts.the delay that you used did work.i can't remember the exact time frames,but furs and apples did take time to appear on the map.this is why i tried to help the others figure out what was going wrong.i'm not convinced it is in the pine mod itself.everyone seemsx to have different mods that affect it.
       the issues i did find when i started using the mod were completely different. i cleared my registy and reloaded my mods a few at a time trying to find the issue. never found any mod conflict and could not make the issue happen again.took me a bout a week to redo my game and i have played over 2months since. what i had happen was workers would stop work and work as laborers constantly.like they went on strike.the gatherer and trapper were bad for this.instead of finding the food that was there,they quit and went clearing land.even with herbs and food to collect ,they would not work their areas.the outputs at the time,would go up and down from year to year.it was strange.to add clues: i did clear the registry wehn i did the upgrade to 1.07. i had tried the new nat div mod with the pine mod.then took the nat div back to the older version since the new 1 slows down my game too far.rather that had conflicted with the pine mod somehow i don't know.
          my CC duck blinds have had troubles. they produce very low.they also have caught fish and no feathers.and if i remember right i have had fishermen catch ducks.moved severl mods to find the issue and thought it was the sherbrooke storage mod. the ducks must be canadian and migrating.the low outputs have came back.so far i have not seen the duckhunter catch fish or i just haven't noticed it. it wasn't every year.kinda happened whenever he felt likt it. with what mods i moved in the order,i think it has to do with 1 of KID's mods.moving KID's mods below CC and leaving your other mods above CC,the problem still exisited.so it wasn't just 1 mod causing the issue.it was more than 1. the game shouldn't read that way. since the 1.07 upgrade there seems to be times the game  takes info from 2 or more mods adds it together and gets mixed up.does make finding errors harder. there are hair-pulling issues nowdays,.

Offline brads3

  • Banished Expert
  • *****
  • Posts: 1442
Re: Shippey - a forestry test bed
« Reply #4 on: September 27, 2017, 03:42:56 AM »
you sound frustrated and lost. i would highly recommend keeping the last pine mod version and not lose the files from it. going forward keep the change file folder separate. you have been away for a while sometimes our brains see things different than it might next month.we confuse ourselves after putting notes down so long.
     the trapper is interesting. i do think it could be fixed to find rabbits and foxes in meadows. BARTENDER did crack the codes to allow plants to grow in different areas. and reeds don't grow everywhere either so it is possable.i do like the idea of using a trapper in fodder fields. players give me hell for it and tell me i shouldn't do it but i have. it worked before with the prior version but just chased the beavers away from the meadow.
     i don't like the idea of a full apple forester and a full maple forester. that is more like an orchard.it works but normally you will find forests mixed.

Offline Tom Sawyer

  • Modders
  • Architect
  • *****
  • Posts: 817
Re: Shippey - a forestry test bed
« Reply #5 on: September 27, 2017, 04:09:55 AM »
I did some research in "Banished ecology" and use it in the North mod. So I can help out with that if not already known:

_spawnChance defines the density of a resource in its resource patch. 1 means maximum.

_growthInMonths means simply the time in month a resource needs to be matured.

_maxGrowth defines the maximum age of a natural resource multiplied by _growthInMonths and + up to _maxGrowthTolerance.

_minSpawnAge defines the time when spawning another resource will start multiplied by _growthInMonths.

_maxSpawnAge of course defines the time when spawning another resource will end in the same way.

Taking vanilla trees it means that a tree needs 3.3 years to be matured (_growthInMonths = 40). The tree will live 16.6 years (_maxGrowth = 5) up to 19.9 years (_maxGrowthTolerance = 1). Herbs will start to grow under this tree after 3.6 years (_minSpawnAge = 1.1) and all wild foods will start to grow already after 0.3 years (_minSpawnAge = 0.1).

I use these values to spawn scaled more mushrooms, deadwood and fur animals in old grown forests and to let intensive forestry decrease these resources. It is not that complex but we can create some cool ecological connections. I hope it helps you to not being frustrated by modding this... :)

Offline brads3

  • Banished Expert
  • *****
  • Posts: 1442
Re: Shippey - a forestry test bed
« Reply #6 on: September 27, 2017, 04:29:19 AM »
      i thought you did set the trees to higher outputs for logs before? i actually do have the more wood mod,but thought the pine overpowered it since you  already did an increase.the bannies will use thatch but they prefer firewood.the reeds need to be bundled and the trade value is 3 instead of 4,not sure how or if that impacts how well they heat houses.it does take several foresters now to run a town.in early game clearing land and expanding does help give enough trees.
        i do use the forever tree mod. could this mod be helping me not show those production dropoffs? if so then the problem others are having is the trees aren't maturing and are being cut to fast for the resin and other items to appear.their trees are to young. there was a discussion at CC ,i think dealing with the nat div mod,where maps were looking bare after so many years.this due to the trees ding and falling into the ground.the map i am on now is over 115 years and i have good forests everywhere.since you modders never "invented" squirrels to replant trees i let mine grow like california redwoods.keeps them looking realistic. but in reality animals and the wind replants trees so it is fair.it does make me wonder if that is wherre the problem is.if trees are cut and not allowed to mature then those other items never can show up.


    i went through some notes and found a test you can use to compare numbers with. it is at the bottom of the 1st page TEST#4.this was just before i redid my registry and overhauled my game.. ran the game about 20 years testing the pine mod.
http://worldofbanished.com/index.php?topic=1798.0

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 479
Re: Shippey - a forestry test bed
« Reply #7 on: September 27, 2017, 05:20:01 AM »
@Tom Sawyer thanks for the hints with the numbers, it is the multiplying of the min/maxSpawnAge by _growthInMonths that I missed as I assumed these were simply years. Seems like a bit of a round a bout way of doing it but if that is how it works under the hood then no matter, it is good to know! Your numbers fit in with what I found in my tests, so I can use these going forward. I wasn't overly frustrated, just the numbers had that extra calculation that I didn't realize so it made the changes too severe. I think 11 years to get a couple of furs is a bit excessive, but not too much. The ecological considerations is what I was trying to implement, just it came out too harsh. So you need a mature stand to get higher value outputs, and if you need to log excessively then you drive away these resources. I think that adds a nice level of complexity to the forests.

@brads3 you are right, it is very dependent on play style and individual games, especially if you don't get mature tree stands. So the forever tree mod will help to stabilize the forestry outputs as it will be easier to get a dense, mature forest. Oh and the more wood, I am sure that was in there, but looking through the files it now isn't. So either I removed it accidentally, or it got lost somewhere along the way. All forests are outputting logs at the same rate as vanilla in the latest edition.

I am keeping the version, but will probably make some adjustments to the numbers because I think it is too hard at the moment, and too variable also, especially if you don't use mods such as forever tree when it is much harder to get a good mature forest stand. The reason I want to changing these numbers was because fur production from the forests was really high, especially considering the high value that 1 fur has. So previously, just by having a forest you could satisfy all trade needs very early in the game due to fur output. It made it much too easy so I want fur to be relatively rare. Anyway, any future updates to the mod set will be separate, and I'll leave version 1xxx as a legacy mod for people to use with any future versions being 2xxx.

As for the apple and maple foresters, they will still be mixed i.e. not just apple trees, and they will still produce other products. But, it means that the main production of apples can be high without making individual buildings too powerful. If I made it so that the maple forest currently can produce enough apples and maple sap to complete both apple and maple chains (apple cider, maple syrup etc.) then just one gatherer will be producing near 2000 units of food (which some of them currently are...) and that is way too much for just 1 worker. So it needs to be modified regardless.

With the meadows producing furs etc., currently that isn't possible as the natural diversity meadows are separate and I don't have access to that code. So any that you find in there are probably from near by forests, but will not be spawned by the meadows themselves. It will require a collaboration with @Bartender to mix the natdiv and some trapping in a way that complements each other. Another reason for wanting to put trapping on another layer is that I would like to have the beaver and others spawn in specific areas, so along river banks etc.

Offline brads3

  • Banished Expert
  • *****
  • Posts: 1442
Re: Shippey - a forestry test bed
« Reply #8 on: September 27, 2017, 05:35:38 AM »
there was a blog to develop another reed mod that might have info on how to make things appear near rivers.i think BT left clues on how he changed the files to allow things to produce in the forest or appear just in grass areas. was hoping you can find info and not need the entire nat div mod to get the traper to work that way.the upgraded nat div mod went back to be modified since it had major lag issues.i rolled back to the original version.