Author Topic: Help understanding parts of naturalresource.rsc  (Read 322 times)

0 Members and 2 Guests are viewing this topic.

Offline Karlieb

  • Laborer
  • **
  • Posts: 49
  • Kedryn on Blackliquid forums
Help understanding parts of naturalresource.rsc
« on: May 22, 2017, 10:41:46 AM »
I understand a lot of the files, but I have posted the parts I don't understand (and can't figure out by delving or googling) as a quote below. Thanks for any help; I know Luke didn't really give out a lot of information. My questions are in bold.

Quote
// maximum growth before death, -1 for ever living
float _maxGrowth = 5.0;

It can grow for the duration of 5.0 what?

// re-seeding.
int _seedChance = 12;

12 out of 100? And if so 12 out of 100 every how often?

float _growthForSeeding = 0.9;
Is it 0.9 of 5.0? or is it 0.9 of whatever 5.0 is measuring?

// max neighbors when reseeding
int _maxNeighbors = 1;
int _maxNeighborsSelf = 0;

Is this direct neighbors (1 tile over) or within seed range or... ?

float _minScale = 0.2f;
I don't even.

float _minSpawnAge = 1.5;
float _maxSpawnAge = 100.0;

Is this the age of the object when it can spawn these or is it the age of the object spawned? Is that in percentage?

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Help understanding parts of naturalresource.rsc
« Reply #1 on: May 22, 2017, 12:14:39 PM »
What about int _seedChance, the more is the number, the less is the chance of seeding. It is 60 for onions; I've set about 140 for beehives to keep them from filling the forest. 12 must be very often.
« Last Edit: May 22, 2017, 12:18:13 PM by tanypredator »

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Help understanding parts of naturalresource.rsc
« Reply #2 on: May 22, 2017, 12:24:23 PM »
float _maxGrowth = 5.0 - I think, months.

float _growthForSeeding - no idea.

int _maxNeighbors = 1;
int _maxNeighborsSelf = 0; - I've always thought, that it is about direct neighbors, but now I'm not sure.

float _minScale = 0.2f; - don't know, but there is similiar code for raw materials: float _carryScale = 0.33; which regulates the size of model when carried by bannies.

float _minSpawnAge = 1.5;
float _maxSpawnAge = 100.0; - I hadn't played with trees, but by analogy with natural resources I suppose, that it is months. And I think it is the age of the object when it can spawn.

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6511
Re: Help understanding parts of naturalresource.rsc
« Reply #3 on: May 22, 2017, 12:33:00 PM »
ok . here what i understood from it :)

Quote
// maximum growth before death, -1 for ever living
float _maxGrowth = 5.0;
It can grow for the duration of 5.0 what?

-1 mean it will always live, never fall down itself,
5.0 means  5.0 years. at the end of that 5th year it  can start to die
depending of the random of the _maxGrowthTolerance.
The time it takes to get it s full mesh full height is float _growthInMonths = 40; that number is usually lesser that the 5.0 years so it can be full height for some time. before it start to chance to die

Quote
// re-seeding.
int _seedChance = 12;
12 out of 100? And if so 12 out of 100 every how often?

yup it is 12% of chance to make spawn another copy of it. thats per item (if it is trees... it is per tree. we can have dozens of thousands of tree per map
it is per year. ? per season ? per month? i think it is per _seedTimeMonths= if that line is also stated , if not: i am not sure.


Quote
float _growthForSeeding = 0.9;
Is it 0.9 of 5.0? or is it 0.9 of whatever 5.0 is measuring?

this is 0.9 (90%) its max growth. if was stated 5.0 year, it is 90% of 5 year so at 4.5 years and + it will start to chance to seed

Quote
// max neighbors when reseeding
int _maxNeighbors = 1;
int _maxNeighborsSelf = 0;
Is this direct neighbors (1 tile over) or within seed range or... ?

this one is kinda hard to understand
neightbors = range , self = is 1 tile around it
which is supposely mean but we know it doesnt seems like that way. i prefer to figure out : self = 0 to not spawn in the tile all around cause it is the prefered place for the other spawn (onion, shrooms, berries...) and neibors = 1 , never spawn closer of 1 tile of neibors trees (so they keep their 1 tile all around for their fruits)
but need another opinion of someone else for that ^^


Quote
float _minScale = 0.2f;
I don't even.

thats the % of the size of the mesh it appears at first (and grow). if you do a tree of 4 tiles high, it is 0.2f of its max height. (20% of 4 tiles so like half of a tile height) so it s spawn like a mini mini tree that barely you can see.


Quote
float _minSpawnAge = 1.5;
float _maxSpawnAge = 100.0;
Is this the age of the object when it can spawn these or is it the age of the object spawned? Is that in percentage?

thats for the other objects like onion shroom and berry...


100= 100% till the tree is dead ... for sure ^^

1,5 or 0,1 is year or months of the tree that its started to spawned. if you would think 0,1 is 0,1% of 5 years ....thats very short. i saw onion spawns after a month or 2 that the tree has spawned.

the % chance to spawn for an onion or shroom... is written it their own files.
« Last Edit: May 22, 2017, 12:42:26 PM by RedKetchup »
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline Bartender

  • Coding Magician
  • Modders
  • Trader
  • *****
  • Posts: 140
Re: Help understanding parts of naturalresource.rsc
« Reply #4 on: May 22, 2017, 12:46:52 PM »
What about int _seedChance, the more is the number, the less is the chance of seeding. It is 60 for onions; I've set about 140 for beehives to keep them from filling the forest. 12 must be very often.
It took me a long time to figure out what was happening there, but it's not quite like you describe. The rule is; the higher the number, the faster the resource respawns. However, this number also influences the initial spawning negatively! This is why you would indeed observe that setting it higher will make it spawn less upon loading the map, but it will still make the resource regrow faster ;).

As for your questions @Karlieb , here's a reference I wrote for myself, based on my research. I intend to make a tutorial out of it at some point, together with other parts of the template, but it might be a while before I find the time to do that ;).

Quote
GrowthDescription growth

The GrowthDescription of a natural resource file dictates how the resource grows, dies, and reseeds. Some of these variables also affect initial spawning.
N.B.  some behaviours are different for 'parent resources' (trees in vanilla) and 'child resources' (resources that are spawned by the trees).

float _maxGrowth [-1 - ?]
Dictates how long the resource will live on average. This value is linked to the float _growthInMonths, most likely the actual average lifespan is calculated by multiplying the two variables. Setting it to -1 makes the resource live forever (except if bool _temperatureDependent is set, see below)

float _maxGrowthTolerance [0.0 - ?]
A measure for the variance of the lifespan. Normally set to 1.0.

float _growthInMonths [0.1 - ?]
How long it takes for the resource to grow to its full size.

bool _temperatureDependent [true | false]
If this is set to true, the resource will die if the temperature gets outside the range set by float _growthTemp and float _growthTempRange. Note: It seems that this behaviour only works if float _maxGrowth is set to -1.

float _growthTemp, float _growthTempRange
These two variables are used to define a temperature range within which the resource can live, if bool _temperatureDependent is set to true. float _growthTemp sets the mean of the range, and float _growthTempRange the number of degrees above and below that mean. The numbers are in degrees Fahrenheit.

bool _autoSeed  [true | false]
Decides wether the resource can reseed by themselves or not. Typically set to true for parent and to false for child resources.

int _seedChance [0 - ?]
The chance that a resource may reseed, higher numbers mean more frequent reseeding. For parent resources it influences the autoseeding, for child resources the spawning by the parent. For the child resources it also influences initial spawning behaviour; a higher int _seedChance will result in a lower number of initial spawns.

int _seedDistance [1 - ?]
AutoSeed: the maximum number of tiles a new seedling may spawn from the existing resource.
Child resource: the maximum number of tiles the resource may spawn from its parent resource.
Note: moving over the tiles diagonally also seems to count as one.

int _seedTimeMonths [1 - ?]
How long it takes for a seed to grow into a resource after reseeding. It seems that this is a sensitive period, where other resources with shorter seedtimes may ‘steal’ the spot, but I haven’t done any extensive research on this.

float _growthForSeeding [0.0 – 1.0]
the minimum age the resource needs to have attained before it can start seeding, as a proportion of float _growthInMonths.

int _maxNeighbors [0 - ?]
The maximum amount of direct neighbours of other types a resource may have. Diagonally touching tiles also count as direct neighbours.

int _maxNeighborsSelf [0 - ?]
The maximum amount if direct neighbours a resource may have of its own kind. Note that especially for parent resources, setting this to 1 or higher greatly influences the initial spawning behaviour. Furthermore, if your resource is spawned in large groups, it may severely impair your citizens pathing abilities.

float _minScale = [0.0? – ?]
the minimum scale that your resource starts its life at, proportional to the scale of your mesh. I haven’t done much resource into the numbers for this one, but it does not seem to be a 0-1 range.

Offline Karlieb

  • Laborer
  • **
  • Posts: 49
  • Kedryn on Blackliquid forums
Re: Help understanding parts of naturalresource.rsc
« Reply #5 on: May 22, 2017, 01:34:21 PM »
@Bartender @tanypredator @RedKetchup

Wow, thanks, guys!

I was wondering if float _maxGrowth was based off of float _growthInMonths as things would die really fast if I set the second one to 0.1.

So many things there that I had 'figured out' but actually hadn't!

And thanks for your reference notes on your hard-fought research, Bartender; I'm be saving those in a doc for sure!

Offline Bartender

  • Coding Magician
  • Modders
  • Trader
  • *****
  • Posts: 140
Re: Help understanding parts of naturalresource.rsc
« Reply #6 on: May 22, 2017, 02:30:24 PM »
You're welcome :)!

So many things there that I had 'figured out' but actually hadn't!

This happens to me all the time, we modders just keep learning every day ;).

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 398
Re: Help understanding parts of naturalresource.rsc
« Reply #7 on: May 22, 2017, 02:44:53 PM »
You're welcome :)!

So many things there that I had 'figured out' but actually hadn't!

This happens to me all the time, we modders just keep learning every day ;).

Well, actually, most of us modders learn every month, maybe a week if we're lucky.

It seems to be only Bartender who learns every day.

Offline tanypredator

  • Modders
  • Trader
  • *****
  • Posts: 282
Re: Help understanding parts of naturalresource.rsc
« Reply #8 on: May 22, 2017, 09:54:55 PM »
"The rule is; the higher the number, the faster the resource respawns. However, this number also influences the initial spawning negatively!" - that is really surprising! All my tests were wrong... I wonder, how did you discovered that?

Offline Bartender

  • Coding Magician
  • Modders
  • Trader
  • *****
  • Posts: 140
Re: Help understanding parts of naturalresource.rsc
« Reply #9 on: May 23, 2017, 10:30:21 AM »
You're welcome :)!

So many things there that I had 'figured out' but actually hadn't!

This happens to me all the time, we modders just keep learning every day ;).

Well, actually, most of us modders learn every month, maybe a week if we're lucky.

It seems to be only Bartender who learns every day.
Only because there's so many kind people here to learn from ;).

"The rule is; the higher the number, the faster the resource respawns. However, this number also influences the initial spawning negatively!" - that is really surprising! All my tests were wrong... I wonder, how did you discovered that?

I made a little mod that removes all resources and only spawns differently coloured cubes on the map. I use that to test all kinds of different settings for the variables, so I can observe their effects easily ;).

Offline brads3

  • Architect
  • *****
  • Posts: 901
Re: Help understanding parts of naturalresource.rsc
« Reply #10 on: May 23, 2017, 02:18:44 PM »
BT that is interesting information. so everything so far spawns all kinds of different ways since the modders have different ideas how the variables change things.i would take it the number to change spawn rates has a limit range. is it 1-5?? not to make you work,but if you do have  a chart it would be useful.
 which code # does what and how much it affects by raising or lowering it.  the more you teach us the more cazy ideas we will come up with though.

Offline Karlieb

  • Laborer
  • **
  • Posts: 49
  • Kedryn on Blackliquid forums
Re: Help understanding parts of naturalresource.rsc
« Reply #11 on: May 23, 2017, 05:04:57 PM »
int _seedTimeMonths [1 - ?]
How long it takes for a seed to grow into a resource after reseeding. It seems that this is a sensitive period, where other resources with shorter seedtimes may ‘steal’ the spot, but I haven’t done any extensive research on this.

This seems to be true. Since most trees have 3 month seed time, setting some grass to 4 month seed time keeps my forests from being overrun in a kudzu-like manner.  Now it penetrates about 2 tiles deep into a forested area, spawns some flax and dies off. Yay, no more invasive species! Well, except for the trees, but I'm used to that. Maybe I'll play around with 3.1-3.9 months to see how that goes.

Offline Bartender

  • Coding Magician
  • Modders
  • Trader
  • *****
  • Posts: 140
Re: Help understanding parts of naturalresource.rsc
« Reply #12 on: May 24, 2017, 04:24:00 AM »
This is my experience as well. Personally I've solved it by setting the same value for both the trees and the grasses, so that they keep each other in balance.

BT that is interesting information. so everything so far spawns all kinds of different ways since the modders have different ideas how the variables change things.i would take it the number to change spawn rates has a limit range. is it 1-5?? not to make you work,but if you do have  a chart it would be useful.
 which code # does what and how much it affects by raising or lowering it.  the more you teach us the more cazy ideas we will come up with though.
The main controller of initial spawnrate is located in another part of the code, and has a practical range of 0.01 to 0.99 (theoretically you could make it 0.999999999999999 or whatever, but that won't have any significant effect anyway).

The controller for reseeding is int _seedChance, which can easily go into several hundreds, but I don't know if there's a limit. I also have no idea how this number relates to the amount of reseeding per object per time unit in the game.

Offline Karlieb

  • Laborer
  • **
  • Posts: 49
  • Kedryn on Blackliquid forums
Re: Help understanding parts of naturalresource.rsc
« Reply #13 on: June 02, 2017, 10:14:45 PM »
I think I finally got the balance I want (and finally made my own grass and flowers). Between year 1 and year 40 (top two thumbnails) the forest didn't advance much. Now I just need to make my grass models look less dumb, adjust my flowers (third thumbnail) and change the flowers to drop 'wild grains' when harvested and I'll be happy. :)

Well, not quite; now I'll wish for wildfires to restore the grassland/forest balance. And for the forest to weaken when the undergrowth drops are overharvested. And for the seeds of plants to be able to survive temperatures the parents can't. I tried having the grass spawn the flowers and then the flowers spawn the grass for a proper lifecycle, but when I clicked on 'build.bat', the results were hilarious (and obvious if I'd only thought for a moment).

Maybe I should just wish for Ecosystem Simulator 2017 instead. :P

http://i.imgur.com/qAdn34E.png
Help understanding parts of naturalresource.rsc
http://i.imgur.com/Z9Wijd7.png
Help understanding parts of naturalresource.rsc


http://i.imgur.com/3NpV2VU.png
Help understanding parts of naturalresource.rsc

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6511
Re: Help understanding parts of naturalresource.rsc
« Reply #14 on: June 02, 2017, 11:46:25 PM »
on this screenshots your grass and flowers doesnt look "dumb" at all !
it looks good
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.