DeckerMMIV / FS13_SoilManagement

A mod for Farming Simulator 2013 that adds additional abilities of field and soil management
7 stars 8 forks source link

URF-seeder support #16

Open DeckerMMIV opened 10 years ago

DeckerMMIV commented 10 years ago

Commit @13885d720bb99b29a765509546eb188f0fcb6d22 contains "some" support for URF-seeders.

The requirement is that the URF-seeder script must send an augmented fill-type to SprayerAreaEvent.

The augment is to add +128 to the fill-type value, as then a different SoilMod spray-sub-function (of the 3 fertilizer-types) will be used, which does not check for crop's first-growth-state.

Example, where using hardcoded fill-type "fertilizer":

SprayerAreaEvent.runLocally(sprayingAreasSend, Fillable.FILLTYPE_FERTILIZER + 128);
g_server:broadcastEvent(SprayerAreaEvent:new(sprayingAreasSend, Fillable.FILLTYPE_FERTILIZER + 128));
webalizer-gt commented 10 years ago

Thank you! Will test tomorrow. Does it matter which fertilizer type i load = different types for different fruits like normal in soilmod?

DeckerMMIV commented 10 years ago

Yes it matters. - If a crop 'likes' FILLTYPE_FERTILIZER3, then you will not get any synthetic fertilizer boost at harvest, if URF-seeder was spraying a different fertilizer type, and there were no other synthetic fertilizer sprayed during the crop's later grow phases.

So yes, "different [synthetic fertilizer] types for different fruits like normal in SoilMod".

webalizer-gt commented 10 years ago

Ok. The good news is: it works. But I should have done more testing with soilmod. I've assumed that there are also several levels of synthetic fertilizing like the organic one have. IRL you would never achieve 100% fertilization with under root fertilization. It´s only a initial nutrition, let´s say 25%. In this case, the function for URF-seeders would be just as unrealistic as in the vanilla game. I guess there is no (simple) possibility to control the percentage of synthetic fertilizer?

DeckerMMIV commented 10 years ago

Unfortunately no. The synthetic fertilizer (and herbicide) has only one level; it can be 'set' or 'not-set', at any given point in the foliage-layer. I am currently using all available 16 bits (channels) of a foliage-multi-layer, so it will be difficult to add "levels" to synthetic fertilizer:

    layer-name      num-of-channels     possible-valueset
    =====================================================
    fmc_manure                2               0-3 (manure density)
    fmc_slurry                1               0-1
    fmc_lime                  1               0-1
    fmc_weed                  3               0-7 (1-3=withered, 4-7=alive)
    fmc_fertilizerOrganic     2               0-3 (level)
    fmc_fertilizerSynthetic   2               0-3 (1=typeA, 2=typeB, 3=typeC)
    fmc_herbicide             2               0-3 (1=typeA, 2=typeB, 3=typeC)
    fmc_soil_pH               3               0-7 (calculated into pH range)
webalizer-gt commented 10 years ago

I let my brain work and came to two possible solutions. Fist option: Remove one type of fmc_fertilizerSynthetic and fmc_herbicide. Then change fmc_fertilizerOrganic to ONE combined layer for total fertilization, like the pH layer. In my opinion this seems realistic, since one IRL can hardly detect the difference between organic and synthetic fertilizers when applied to ground. You can measure NPK values in the soil but not from what kind of fertilizer they come from. You could control the intensity of fertilization with different fertilizers and/or litersPerSecond applied? Would remain free a channel, if I counted correctly.

Second option / question: Is there a limit for multi-layers? You could for example separate visible and invisible layers to two multilayers.

In the end it is your mod and it is solely up to you whether you want to make such extensive changes for the "stupid" URF-Seeder ;-) I would be delighted if you consider my first proposal, because in my opinion it would be a principle clearer solution for the SoilMod and not only a possibility to integrate URF.

Regards Tom

DeckerMMIV commented 10 years ago

1) It is not possible for me to control the intensity as such. - The problem lies in how the setDensity../addDensity... functions work towards the foliage-layers and how often they are called for the same area (e.g. cuttingArea or likewise.)

Example: Using addDensity... to add +1 at the foliage-layer for an 'area' a sprayer-tool defines. At the next frame-update the sprayer may have moved just a little bit, and the new 'area' will most likely overlap the previous one, so calling addDensity... will now add +1 to some of the previous area-parts (making it +2). This will quickly "add up", so the foliage-layer's values (bits/channels) reach the maximum value - which is probably not always what you want.

That is why I use a one-bit (one channel) for the slurry and lime layers, so the vehicles/tools can spread as much as they want at the same 'area' - it will never reach a value higher than '1'. Then later, during either cultivator/plough or growth-cycle, I can control how much (intensity) to add to the "levels" in a different foliage-layer.

2) I do not know what the limit is, if there is one, regarding the number of foliage-multi-layers. I have noticed, that the usual way map-authors add layers, is by adding a containing only one - maybe it is because most map-authors do not know the technical details regarding additional foliage-sub-layers.

Also there would be a resource situation to consider, as "just adding more" will eventually cause other problems for players.

But yes, adding more "information storage" (i.e. more layers) would give additional possibilities.

webalizer-gt commented 10 years ago

Sure. Forget about the intensity. But a leveled system as used with organic and pH should be possible?

DeckerMMIV commented 10 years ago

I think it could, but I have no good ideas for how to actually make it, with the limitations of the foliage-layers. - It will not be implemented in this current major version of SoilMod.

Even if there was to be a "leveled system", what effect - or "rule set" - should it provide? The easy thing right now, is to have it only affect the "yield during harvest", but could there be even more possibilities?

The base game does not have any notion of "quality of crops", but I imagine there could be some other "fill-types" or meta-data for them, that would add something like:

Unfortunately such a thing would require an almost total-conversion of the base scripts, which is too big a job to do.

webalizer-gt commented 10 years ago

Other than my problems with choppedStraw the urfSeeder is working good now. Added the additional fertilizer types with their hud. If mp/server tests go well it´s ready to be released when the SoilMod with the needed functionality goes official.