[FS17]Tutorial - Increasing numer of field directions

Your forum for all discussions around Modding.
Stegei
GIANTS Software | CTO
Posts: 1787
Joined: Sat Jun 09, 2007 10:51 am

[FS17]Tutorial - Increasing numer of field directions

Post by Stegei »

This tutorial explains how to adjust your mod map to allow for a higher number of direction a field can be visualized with instead of the 45 degrees the game uses by default.


  1. Adjust the map i3d so that the density map can store the additional data:
    Change the line
    <DetailLayer name="terrainDetail" numDensityMapChannels="11" ...
    to
    <DetailLayer name="terrainDetail" numDensityMapChannels="12" ...
  2. Adjust the map i3d so that the additional data is also passed over to the renderer.
    Adjust the attribute on the same line as in the previous step
    combinedValuesChannels="0 3 0;5 2 0;3 2 1"
    to
    combinedValuesChannels="0 3 0;5 3 0;3 2 1"
  3. Adjust groundShader.xml:
    Change the line 207
    angle = ceil(angle*3-0.0001)/4*3.14159;
    to
    angle = ceil(angle*7-0.0001)/8*3.14159;
  4. Create a lua file to make some script adjustments (ModMap.lua):

    Code: Select all

    ModMap = {}
    local ModMap_mt = Class(ModMap, Mission00)
    
    function ModMap:new(baseDirectory, customMt)
        local mt = customMt
        if mt == nil then
            mt = ModMap_mt
        end
        local self = ModMap:superClass():new(baseDirectory, mt)
    
        -- Number of additional channels that are used compared to the original setting (2)
        local numAdditionalAngleChannels = 1;
    
        self.terrainDetailAngleNumChannels = self.terrainDetailAngleNumChannels + numAdditionalAngleChannels;
        self.terrainDetailAngleMaxValue = (2^self.terrainDetailAngleNumChannels) - 1;
    
        self.sprayLevelFirstChannel = self.sprayLevelFirstChannel + numAdditionalAngleChannels;
    
        self.ploughCounterFirstChannel = self.ploughCounterFirstChannel + numAdditionalAngleChannels;
    
        return self
    end
  5. Let the game know to use the ModMap.lua:
    Adjust the according map definition line in the modDesc.xml. E.g. the following line
    <map id="SampleModMap" className="Mission00" filename="$dataS/scripts/missions/mission00.lua" configFilename="maps/map01.xml" defaultVehiclesXMLFilename="defaultVehicles.xml">
    needs to be adjusted to
    <map id="SampleModMap" className="ModMap" filename="ModMap.lua" configFilename="maps/map01.xml" defaultVehiclesXMLFilename="defaultVehicles.xml">
  6. The cultivator_density.gdm of your map also need to be extended to 12 channels. Therefore, the easiest way is to convert the .gdm file to a .png so that the editor can automatically extend it to 12 channels. Note that, however, some informatione might be slightly wrong after extending it. For exaxmple fields that have been rotated by 90° degrees will only use 45° afterwards, since the store information is interpreted differently and the editor doesn't know how to convert that.

    -For this, download the GRLE Converter from gdn.giants-software.com and unzip it.
    -Drag&Drop the cultivator_density.gdm of your map onto the "convert.cmd".
    -Check that a file cultivator_density.png has been created at the same folder as the cultivator_density.gdm
    -Delete the cultivator_density.gdm
    -Open your map in the GIANTS Editor and make sure that it displays correctly.
    -Save the map.
    -Check that a new cultivator_density.gdm file has been created.
    -And finally, delete the cultivator_density.png again and just keep the new cultivator_density.gdm.

The used numbers in this tutorial will allow you to use 8 different direction for the fields, instead of the 4 used by default. If more directions are needed, the numbers for numDensityMapChannels, combinedValuesChannels, the shader and numAdditionalAngleChannels in the script need to be adjusted accordingly.
User avatar
Nordvarg
Posts: 101
Joined: Sun Sep 06, 2015 7:14 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Nordvarg »

Thanks, Stegei - Much appreciated. More tutorials like the ones you've already posted would be great :)
masseyharris
Posts: 259
Joined: Tue Nov 15, 2011 10:34 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by masseyharris »

Thanks Stegei, for the very useful information, does it have much affect on performance?
Simul8
Posts: 1
Joined: Fri Jan 20, 2017 2:35 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Simul8 »

Followed this step-by-by but for some reason when I load back into GE the TerrainDetail foliage layer isn't there anymore. Any ideas?
User avatar
Aranea
Posts: 289
Joined: Thu Oct 06, 2016 9:51 pm
Location: meine Höhle

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Aranea »

@Simul8 check the xml formatting around your TerrainDetail line in the .i3d
(open with an internet browser of your choice) to see if you accidently "crashed" it maybe
MfG
die Spinne :hi:
FS modder & scripter
quality modding and support since 2012
viewtopic.php?f=884&t=115656
collieclaas
Posts: 1
Joined: Thu Jan 26, 2017 9:09 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by collieclaas »

Thanks, I'm so close to getting this working but I have the same issue where partial toplayer is missing when viewed in editor. I have checked all the steps and they're correct.

when I load it up it say:

Error: Could not parse GISL program.
(598): ERROR: 'getHeightRayIntersection' : no matching overloaded function found

Error: Failed to compile shader 0DDF51C2-0002381C-00000000-07000890.

Any ideas whats going wrong. Thank you so much guys
masseyharris
Posts: 259
Joined: Tue Nov 15, 2011 10:34 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by masseyharris »

I've followed it to the letter and it seems to work fine. Sorry for those who are having problems but if your map was error free before you started adding this then hopefully it can only be a typo causing the problem.
Totenfarmer
Posts: 155
Joined: Tue Nov 06, 2012 9:13 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Totenfarmer »

I couldn't even get a png image of the gdm, dragged and dropped unto "convert", but nothing happened.
Did an experiment with "convertSample", then I got an image, but of course this is useless...

EDIT: Well, something did happen, the convert tool tells me the file I just dragged and dropped doesn't exist..beats me how it can't exist when I just dragged and dropped it..
masseyharris
Posts: 259
Joined: Tue Nov 15, 2011 10:34 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by masseyharris »

Totenfarmer wrote:
EDIT: Well, something did happen, the convert tool tells me the file I just dragged and dropped doesn't exist..beats me how it can't exist when I just dragged and dropped it..
Yes, that happened to me at first. Here's the solution.

Put the file you want to convert into the same folder as the convert tool.
Open the convert tool with notepad (make a backup of it first in case you make a mistake).

Now edit the line:
%~dp0\grleConverter.exe "%~1" -out "%~n1.png"

to read
grleConverter.exe "%~1" -out "%~n1.png"

(you're just removing the first 6 characters which seem to be making it look for the file in the wrong location for some reason).

and save it.

Now when you drag it onto your amended convert tool, it should convert it and place then newly created file in the same folder.
Totenfarmer
Posts: 155
Joined: Tue Nov 06, 2012 9:13 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Totenfarmer »

@MasseyHarris: I tried following your steps, but I still get the same error, any idea what else I could try ?

Hopefully Giants will find a way to fix this problem in the future, my modding is on halt...
masseyharris
Posts: 259
Joined: Tue Nov 15, 2011 10:34 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by masseyharris »

You must be doing something wrong.

If you try to run the convert program it gives the message you describe ('file doesn't exist').

If you drag and drop the gdm onto the original convert program it gives the error message
' is not recognized as an internal or external command, operable program or batch file'.

But if you edit the file as I described, make sure your gdm is in the same folder, and then drag it correctly onto the top of the amended convert program, it should work.

Hope you get it sorted out ok.
Totenfarmer
Posts: 155
Joined: Tue Nov 06, 2012 9:13 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Totenfarmer »

The thing is I am not doing it wrong, I'm doing exactly as described: This is what i have tried
1.1: create folder and extract grle converter zip
1.2: Move cultivator_density to that folder
1.3 Edit the convert helper script to "grleConverter.exe "%~1" -out "%~n1.png"
1.4: Drag and drop cultivator_density onto "convert"
The result is file does not exist.

I also tried to move the grle converter files into map01 and do same procedure and got the same result.
I then tried to copy cultivator_density to the grle converter zip itself, then extract all those files into a folder, edit "convert" and got the same result.
I also tried all those steps without editing "convert"..same result.

I have been modding and tweaking maps and mods since the 2011 game, so I'm not new to the game mechanics either (not saying you implied it) and I have never encountered anything like this (except from in SRS), there's always a way..but this tool just seems to be broken, it works for some and for some not, I find it very odd that Giants isn't replying in their thread either, is it maybe like it was with SRS..just throw it out there half-way broken then ignore the modders ?? I'm starting to feel pretty annoyed by this.
Not your fault though "MasseyHarris", you tried to help, and I do appriciate that :)
User avatar
böserlöwe
GIANTS Software | Support Engineer
Posts: 10816
Joined: Thu Oct 01, 2009 10:09 pm
Location: Kreis Schaumburg
Contact:

Re: [FS17]Tutorial - Increasing numer of field directions

Post by böserlöwe »

Sorry for my question.
you dont write that you load the last GRLE Konverter 7.0.1 from GDN Site from 30.11.2016 released

So please you have used this Version of Konverter?
Totenfarmer
Posts: 155
Joined: Tue Nov 06, 2012 9:13 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by Totenfarmer »

Yes I have, I downloaded it 2 days ago, and the download says "grleConverter_7.0.1_win32"
masseyharris
Posts: 259
Joined: Tue Nov 15, 2011 10:34 pm

Re: [FS17]Tutorial - Increasing numer of field directions

Post by masseyharris »

I'm sorry it's not working.
Just thinking out loud, have you tried converting a cultivator_density from another map, just as a test? It would help determine if the converter is working.
And how about your cultivator file itself? Maybe we can see a difference. Mine is 398k.
Does yours have fields painted with terrain density and with working buy trigger/map indicator/coordinates ? I've no idea if these things have to be there for the converter to work but they are just suggestions in case they help.
Post Reply