Multifruit GEO

Your forum for all discussions around Modding.
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Multifruit GEO

Post by jmelvin »

I'm trying to build a GEO that accounts for a lot of the multifruits that are added by multiple map creators. Letting them default to use the settings for barley which can be planted in early spring or in autumn doesn't make sense especially if one looks at realistic seed germination temperatures. I have looked at a lot of GEOs including the seasons default and am seeing things that don't make sense when I also look at the growth manager lua.

I am looking for help from people who are familiar with the seasons mod. I will say upfront that I consider myself a novice at farming simulator especially considering the changes implemented by the seasons mod. I do have a bit of experience with reading certain computer languages but not what I see in lua files. I recognize if/then/else statements and function calls and I think I have a general idea of the workings of the luas I see in the seasons mod.

I have several questions and would appreciate any help I can get.

1) I see that certain crops can be set to wither using setRange="3-MAX" setTo="WITHERED" I want most of the fruits to wither the second season change after they reach the harvestable state (st 6) and figure this is the way to do that. I see that I can leave a 7-growth state fruit at the final growth state on a seasons change by not specifying a change for that fruit for st 6 for the new season. If I understand the growth manager correctly it looks like I could also set things so st 6 increments by one for the season change and have the crop stay at st6. Is there a reason to have the entry to increment by 1 vs. not specifying a change for st6?

2) I found a US Department of Agriculture document on the web titled "Field Crops Usual Planting and Harvest Dates" that has a lot of information about what field crops are the normal crops for the various states and has tables showing normal planting and harvest dates for different areas. Most crops seem to have a planting widow of 60 days or less and the same for a normal harvest window although a few crops have a harvest window up to 80 days. I know these windows don't cover drought situations and drought in-game as IRL slows down growth. I probably need my crops.xml to allow an extra seasons transition growth to handle a minor drought situation. Does that make sense?

3) I see that fruits that get planted in the fall use the setRange="3-MAX" setTo="WITHERED" for the early winter/mid winter transition because those fruits should not have reached st3 before winter sets in. Those same crops use setRange="1-MAX" setTo="CUT" for the mid winter/late winter transition so they visually die back to growth stage 1. I see that many of the GEOs and even the seasons default uses incrementByOneRange="1-2" for the late winter/early spring transition. I understand letting st1 advance to st2. Is there a reason for letting st2 increment since I don't think there is a way for any of these fruits to have reached st2 before early spring?

4) I've seen a couple crops.xml files use an entry of incrementByTwoRange="1-3" . I thought the only way to get the state to increment by two is to use the incrementByRange="min-max" incrementBy="2" couplet to get the state incremented by 2. I didn't see an incrementByTwo option in the seasons lua's or did I miss something?

5) I want to make sure that my GEO has the fruits not skip important growth states by skipping over them (e,g., canola should not skip the yellow flowering state; poppy should not skip the flowering state; clover seems to have a bud stage, a blue flower state, and a red flower state). I can see that these states are shown in a given fruit's diffuse.dds file associated with its foliage. I think that dds file contains multiple png's and which png gets used for each growth state is controlled by the fruit's xml file. It seems that most developers of seasons ready maps use the same png for growth states 4-6 with possibly different heights. It seems to me that I will need to change some entries in the fruit xml files for a map if I want to have that fruit show as flowering in st 4 or 5 as opposed to having the look of something ready to harvest. Or, I could have fruits like canola and poppy reach state 3 (flowering state) and then hold off any state change until the transition where I want them to advance to state 6. Does that make sense or am I overthinking this?

6) I know that hops can be planted as a crop here in the US in either the fall or the spring. From what I have seen in looking at the internet, hops is very fast growing and this is shown by the hops.xml, hops_diffuse.dds, and hops LOD dds files I have seen. Hops has a height of 1 for st1, 2 for st2, 3 for st3, and 6 for st4-6 in the xml file I am looking at. Can someone tell what those numbers mean? I'm guessing this measurement is in meters and if that is the case I should make sure that my crops.xml doesn't let hops reach st2 before the winter die back. Letting hops reach 2m before any snowfall would seem to be a bit much.

7) I see in the SeasonsGrowthManager.lua that the function that handles growth gets called before the one that handles germination. I know that a crop can germinate based on a day change as opposed to a season change. When I was really trying to track things, I saw fruits germinate on the first day of a new season and stay at st1 until the 2nd season transition and then change state if allowed for that transition. I've also seen fruits that didn't germinate when I expected them to because I had planted on a day where the ground temperature was below germination threshhold but I expected the ground temp to go up enough the next day to allow for germination. I have since read that ground temperature change happens only once per day and that is at 1AM if the previous day was warm enough for a change. I haven't figured out how to determine when the different events such as germination, ground temperature change, fruit state change, etc. are set to occur in looking through the seasons lua's. I did a test game where I, as the farmer, stood in my fields to see when germination occurred (00:15) and when a seasons state change occurred (00:30). I am guessing that the times I noted are when the game engine got around to updating the view for the portion of the map where I was standing. I read somewhere that what you see could be delayed by 15 minutes or more from when the actual event occurred. Is that true? Did the events actually happen at the times noted or did the germination and state change actually occur at midnight and the delay until the visual change was a matter of my position on the map? Since germination is a daily function and state change is a seasons change function that could explain the different times I observed. Or, is there time based schedule in the seasons lua's that I haven't found yet? I am asking these questions to figure out what ranges I need to use in my crops.xml to properly handle fruits that get planted on the last day of a season. That could be rather tricky where I want a given fruit to advance 2 states at the mid spring, late spring, early summer, mid summer transitions to get the crop to reach st 6 when I want it to. I may need to use the setRange="min-max" setTo="needed state" couplet to get the effect I want at a given transition. I haven't seen setRange used in that way but it looks like that should work.

8) It looks to me like SeasonsGrowthFruitTypes.lua can handle the situation without causing a log warning or error where a crops.xml has entries for a fruit but that fruit isn't set up for a given map. Is that true? If so can put entries im my crops.xml for fruits that don't seem to be "commonly" used by map makers, fruits such as sudangrass, sorghum, poppy, hemp, peanuts, cotton, rice, lettuce, blackbean, etc.. It would probably make sense to have entries for a lot of different fruits so I wouldn't have to change my crops.xml for newer maps that come along that use these fruits whereas most of the maps I have seen use a limited number of multifruits. Personally, I like a GEO that allows for the growing of many more fruittypes than what is "normal" for a given geographical area. Developers have spent a lot of time putting together what it takes for a given fruit to look somewhat realistic throughout a given year and there is such a variety of farm equipment available. So what if I end up allowing crop combinationss for a map that wouldn't be seen in any given geographic area such as peanuts, rice, cotton, and winter wheat.

9) It looks like I have to be careful how I define the "fruitTypes" section of the crops.xml so any fruits I want to set up for autumn planting have appropriate frost tolerance. I could also tweak things so certain crops are more drought tolerant. If I do that I might not need to allow the extra seasons growth transition for possible drought conditions as mention in item 2 above. Any thoughts.

10) I've looked at several GEOs, including some realeased by Realismus, and the seasons mod itself. It looks like have the weather.xml set so there is a very good possibility of entering spring in a dry if not drought condition. I haven't played most of these GEOs. I'm just looking at the rain probability and rainfall settings, especially those for the winter months that would seem to control the amount of snow one would get during the really cold periods. I also see a lot of comments/complaints in various forums about seeing drought damage a lot more often than one would expect. Has anyone seen a GEO (weather.xml) that doesn't tend to have things to dry that one ends up with a lot of drought? The Southern Michigan GEO looks like it should have less possibility of drought conditions going into spring planting season but seems to have lower seasonal temperatures than I want to use. I'm making that comment just looking at the numbers without ever having played that GEO.

11) This isn't related to the crops.xml but is related to the seasons mod. I see that seasons uses selected entries from the fruittypes.xml and others from the crops.xml. I am thinking about crops that are set to regrow. Seasons does use the startSprayState entry from the fruittypes.xml. It doesn't make sense to me for regrowing crops to need 3 states of fertilization for each "cutting". Has anyone tried to use a startSprayState="2" so only one fertilization is needed for the later "cuttings"? Maybe there is a game code limit so "1" is the only allowable option.

note 1: I see that seasons uses the settings for barley as a default whose growth pattern isn't specified in a crops.xml for a given map or a GEO that someone wants to use. The bad news is that the seasons default has barley as a fruit that can be planted in spring or autumn. That doesn't make sense for most of the fruits someone might add to a map. I'm planning to make barley a spring-planted crop since it has a low germination ground temp. That way, my crops.xml would fit better for a map that uses a new fruit I haven't shown in my crops.xml.

Again, thanks for any help I might get.
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Multifruit GEO

Post by theSeb »

1. Not sure if I understood the question. Harvestable is 7 for most fruits, hence why you can see GrowthManager is trying to get fruits to 7

Maybe you are asking why I didn't just set the fruit to WITHERED instead of incrementing it to 8 (which happens to be withered)

Code: Select all

<crop name="WHATEVER" setRange="1-4" setTo="CUT" incrementByOneRange="7"/>
The reason for that is because I don't allow the same command on one crop line in each period. So you cannot call set twice. It's a limitation to make the underlying code simpler and because it's never stopped me from doing a growth pattern that I wanted I am happy with it.

2. Sure, there is always an amount of "gamefication" that we had to include in the mod

3. Whatever has survived I want it to increase to show "things coming to life" at the beginning of spring. You will note that this only happens for stuff I expect to somehow survive during winter (winter crops)

setRange="1-MAX" setTo="CUT" is only used in the FIRST_LOAD_TRANSITION. Not in winter. FIRST_LOAD_TRANSITION is how you want the map look when the player loads Seasons on the map for the very first time

4. incrementByTwoRange is a function that was available to GEO makers in FS17. I guess some people didn't get the memo that's it no longer available in Seasons 19. It will be ignored and have no effect

5. It's really up to you how much you fast forward or keep fruits at a certain state for longer. There is a tradeoff though between giving the player indication that something is happening and that growth is not stuck, the amount of time available to grow before winter / wet autumn and pretty visuals on the map.

6. No idea. I don't know about this mod

7.
I see in the SeasonsGrowthManager.lua that the function that handles growth gets called before the one that handles germination
No, it does not. You might be looking at this and thinking that this is the order of how things work

Code: Select all

self.densityMapScanner:registerCallback("Growth", self.dms_handleGrowth, self, self.dms_finishGrowth, false)
self.densityMapScanner:registerCallback("Germination", self.dms_handleGermination, self, self.dms_finishGermination, false)
To to put it simply this is just registering for events and telling the game what functions should be called when the event is fired

Germination is called every day. Growth is called at the end of each period. When a day changes that happens to also be an end of a period, germination is still called before growth

8. It should work. I remember that I made it so that the map directs Seasons about what fruits are available and not the other way around. I check what fruits are in the map and then this is checked against crops.xml. If the crop does not exist, I copy barley as a template for this new fruit to prevent issues.

9. You will have to experiment with this yourself.

10. Damaging crops is fun. I don't think there is too much damage on the stock weather and crops in Seasons.

The reason for barley is because most maps add cereals like rye. It's easier. Anybody adding more complex fruits in their maps should create a GEO for it.
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

First of all, thank you for the informative reply to my questions.

1.
Not sure if I understood the question. Harvestable is 7 for most fruits, hence why you can see GrowthManager is trying to get fruits to 7.


I can see that my understanding of the GrowthManager was way off. I thought st6 was the max harvesting state. I was looking at the following entries for a given fruit shown via the rmPrintFruitTypesData command:
[minHarvestingGrowthState] => 6
[witheringNumGrowthStates] => 8
[numGrowthStates] => 7
[cutState] => 8
[originalMinHarvestingGrowthState] => 4
[youngPlantMaxState] => 4
[maxHarvestingGrowthState] => 6

I was also looking at the states defined in the fruit’s xml file (read as bits 5 6 7 8):
1 0 0 0 – invisible (I thought this is for planted in seasons equivalent to state 0)
0 1 0 0 - green small (I thought this is growth state 1)
1 1 0 0 - green middle (I thought this is growth state 2)
0 0 1 0 - green big (I thought this is growth state 3)
1 0 1 0 - harvest ready (I thought this is growth state 4 – non-seasons min harvest state)
0 1 1 0 - harvest ready (I thought this is growth state 5 – a non-seasons harvest state)
1 1 1 0 - harvest ready (I thought this is growth state 6 – seasons and non-seasons maxHarvest state)
0 0 0 1 – dead (I thought this is the withering state)
1 0 0 1 - harvested (cut)

I have been counting states 0-6 as the 7 growth states. Either that or not having planted as a growth state and counting withered as the 7th growth state. I have been trying to equate the growth states used by seasons with the hex values shown in the fruit’s xml and needed to subtract 1 to account for my st0.

If I understand your statement correctly, I need my GEO to take fruits to st7 to be harvestable. I haven’t got the coding of my GEO to the point of actually loading into a game to see the planting/harvesting screen. I was thinking the maxHarvestingGrowthState = 6 meant it would be harvestable at st6.

3)
setRange="1-MAX" setTo="CUT" is only used in the FIRST_LOAD_TRANSITION. Not in winter. FIRST_LOAD_TRANSITION is how you want the map look when the player loads Seasons on the map for the very first time.
I figured that was the meaning of FIRST_LOAD_TRANSITION. I’m not good at code reading and was under the mistaken impression that the statements still got used for the mid-winter to late-winter season transition. I’ve never really looked at the visual appearance of the fruits following the late winter/early spring seasons transition for the 2nd and subsequent years of a game as opposed to the look when you first start. I need to pay more attention to things.

I've spent a lot of time trying to figure out how winter crops managed to get out of the cut state that I thought the entries in the mid-winter to late-winter transition would have put them at. I see now that the entries for the earlier transitions have those crops at st2 instead of cut.

7)
Germination is called every day. Growth is called at the end of each period. When a day changes that happens to also be an end of a period, germination is still called before growth.
Thank you for clarifying that. That means I don’t have to make allowances for planting on the last day of a seasons in my GEO as long as I watch soil temp and moisture conditions.

10)
The reason for barley is because most maps add cereals like rye. It's easier. Anybody adding more complex fruits in their maps should create a GEO for it.
That is why I am trying to build a multifruit GEO that can be used for those maps set up for multifruits but don't have an associated crops.xml file.

Looking at the entries in the default crops.xml and the resulting planting/harvesting schedule makes a lot more sense to me now. Thank you again for your informative response.
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Multifruit GEO

Post by theSeb »

No problem. Just going back to 1 it’s a quirky thing from the game code and not something from Seasons. Basically something like barley in the vanilla game is harvestable from 5 to 7. But if you print out the fruit data without seasons enabled you will see that’s it’s minimum harvest state is 4 and maximum is 6. Seasons sets the minimum to be maximum so that we have more growth states without the complexity of actually adding our own completely new states.

I am simplifying a lot, but in basic terms the in game cereal harvester code checks if current growth is > then minimum harvestable state but < withered. So in vanilla that is > 4. In Seasons it’s > 6. Or, in other words, 5 and 7 respectively. They could have set it to 5 and 7 and checked for >= but I don’t know why the game works that way. Only one of the original creators, like Stegei, could probably tell us. It probably made sense for some other checks elsewhere and made it easier for them.
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

but in basic terms the in game cereal harvester code checks if current growth is > then minimum harvestable state but < withered
Thank you for the explanation. That has confused me since I first saw the game in FS17. I saw that there seemed to be 4 "green" or growing states and 3 "yellow" or harvesting states. Then, when I saw the mniHarvestingGrowthState stated as 4 and maxHarvestingGrowthState as 6, the only thing that seemed to make sense was to use a number system using 0-3 for growing and 4-6 for harvestable. My error. As far as game-play, it was just a matter of waiting until the crop reached one of the yellow stages and not worrying about the stage number. It has only been when I started to build my GEO that I had to really look at and understand the stage numbers.

This does bring up a new question, though. Does the game code do the same thing relative to minForageGrowthState being show as 3 for most fruits? I've never tried using a forage harvester on a fruit that early but am guessing that I would have to wait until the fruit reached the state >3 (i.e., st4).
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Multifruit GEO

Post by theSeb »

minForage state uses the same rule, so minimum is 4 when it's set to 3. Also maximum is withered. One thing I forgot to mention above is that 1 is not planted. I think some people may have that impression. 1 is germinated or the first stage of growth. You have no control over incrementing planted. It happens within Seasons by the handle germination job. You can of course control it by setting the germination temperature and mucking about with weather
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

Let me correct the information I posted above (based on what theSeb has stated here):

Growth State for most fruits as shown in the fruit’s xml file (read as bits 5 6 7 8)
1 0 0 0 – invisible (germinated – growth state 1))
0 1 0 0 - green small (growth state 2)
1 1 0 0 - green middle (growth state 3)
0 0 1 0 - green big (growth state 4)
1 0 1 0 - harvest ready (state 5 - non-seasons first harvestable state)
0 1 1 0 - harvest ready (growth state 6 – a non-seasons harvestable state)
1 1 1 0 - harvest ready (growth state 7 – seasons only harvestable state - non-seasons maximum harvestable state)
0 0 0 1 – dead (state 8 - withered state)
1 0 0 1 - harvested (state 9)

minForageGrowthState (set to 3 for most fruits – means fruit can be foraged at states 4-8) (corrected from 4-7 to 4-8)
SeasonsGrowth.MAX_STATE = 99
SeasonsGrowth.CUT = 200
SeasonsGrowth.WITHERED = 300
SeasonsGrowth.PLANTED_STATE = 11
SeasonsGrowth.GERMINATION_FAILED_STATE = 12
[maturePlantDamageState] => 8 (state 8 – withered – for patchy crop failure due to drought or frost damage)
[youngPlantDamageState] => 9 (state 9 – harvested - for patchy crop failure due to drought or frost damage)

Theory (usage within a crops.xml in a Seasons GEO):
Range “1-MAX” won’t affect fruits that are CUT or WITHERED
Range “1-CUT” won’t affect fruits that are WITHERED
Last edited by jmelvin on Wed Sep 16, 2020 8:15 pm, edited 1 time in total.
User avatar
theSeb
Posts: 1517
Joined: Tue Mar 07, 2017 8:16 pm

Re: Multifruit GEO

Post by theSeb »

foraging can be actually be done 4-8
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

foraging can be actually be done 4-8
Thank you for the correction. I edited my post above to reflect the correct information.
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

I have been preparing my Multifruit GEO and thought I had things set up like I want. I loaded my GEO with the seasons mod and nothing else and get the following errors when I start a new game.

Error: D:/Documents/My Games/FarmingSimulator2019/mods/FS19_RM_Multifruit/data/crops.xml. name.
Error: D:/Documents/My Games/FarmingSimulator2019/mods/FS19_RM_Multifruit/data/crops.xml. name.
Seasons Error: SeasonsGrowthData:loadDefaultFruitsData: XML loading failed crops.growth.defaultCrops not found
Seasons Error: SeasonsGrowthData:loadGrowthData: XML loading failed transitionsKeycrops.growth.growthTransitions not found

Also, when I open the seasons menu I see that the planting/harvesting schedule shows the seasons default values. I see that the last 2 errors were generated by SeasonsGrowthData.lua while trying to build the fruit data while looking at the defaultCrops and growthTransitions portions of my GEO. I haven't figured out yet what generated the first two errors but I think it may be the loadXML function.

I have looked at the defaultCrops entries and haven't spotted anything that looks obvious. Overwrite is set to true and all of the regular crops are shown along with 19 new crops.
<growth overwrite="true"> <!--Leave as false, if you are only appending new fruits. If set to true, you must make sure to define the growth for all fruits -->
<defaultCrops>
<defaultCrop name="BARLEY" />
<defaultCrop name="OAT" />
<defaultCrop name="WHEAT"/>
<defaultCrop name="CANOLA"/>
<defaultCrop name="MAIZE"/>
<defaultCrop name="SOYBEAN"/>
<defaultCrop name="SUNFLOWER"/>
<defaultCrop name="POTATO"/>
<defaultCrop name="SUGARBEET"/>
<defaultCrop name="POPLAR"/>
<defaultCrop name="GRASS"/>
<defaultCrop name="OILSEEDRADISH" />
<defaultCrop name="WEED" />
<defaultCrop name="DRYGRASS" />
<defaultCrop name="SUGARCANE" />
<defaultCrop name="COTTON"/>
<defaultCrop name="LETTUCE"/>
<defaultCrop name="CARROT"/>
<defaultCrop name="ONION"/>
<defaultCrop name="RYE"/>
<defaultCrop name="HOPS"/>
<defaultCrop name="POPPY"/>
<defaultCrop name="SPELT"/>
<defaultCrop name="SORGHUM"/>
<defaultCrop name="SUDANGRASS"/>
<defaultCrop name="PEANUT"/>
<defaultCrop name="RICE"/>
<defaultCrop name="MILLET"/>
<defaultCrop name="HEMP"/>
<defaultCrop name="BLACKBEAN"/>
<defaultCrop name="TOBACCO"/>
<defaultCrop name="ALFALFA"/>
<defaultCrop name="CLOVER"/>
<defaultCrop name="CABBAGE"/>
<defaultCrop name="REDCABBAGE"/>
</defaultCrops>
I think that whatever is causing the first two errors prevented the loading of the data from my GEO and that is why it the lua doesn't actually see the entries from my crops.xml.

Has anyone seen this type of error while working on a GEO?
jmelvin
Posts: 24
Joined: Tue Jun 16, 2020 3:27 am

Re: Multifruit GEO

Post by jmelvin »

I decided to take one more look at my entire crops.xml and found my errors. I had missed closing off a couple of entries.

<growth germinateTemp="12"
germinatesoilMoisture="5"
youngPlantMaxState="4"
maxFertiliseState="4" I missed closing this off with />

Also, I had used incrementByOneRange twice for one of the transitions for one of the fruits.

I no longer get the log errors when I start my game and can see the planting/harvesting screen. Now its a matter of finding and fixing a lot of transitions errors in my crops.xml
Post Reply