Community Forum

Enumerating Terrain Density

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created07.06.2010 14:58

Mark Farrington (chorleyboy) 07.06.2010 15:05

I'd like to make a mod that tinkers with the map foliage based on the terrain type. For example, I'd like to find all the areas of the map that are either stubble or cultivated group. I'm guessing there is no specific collection for this already within the game? Dynamically enumerating the entire map is obviously not possible due to speed/resource issues.

If this is so then maybe I could write an external app that map builders can use that reads in an image similar in structure to "wheat_weight.png" file and builds an XML map of cordinates that I can access via LUA. However, the problem here is how do I translate the pixel based co-ordinates into Giants world co-ordinates in the map? A bit complicated I know but does anyway know if this is possible?


Stefan Geiger - GIANTS Software 08.06.2010 09:10
The density map is stretched over the whole terrain. So you need to know the size of the terrain, the resolution of the density map and the origin of the terrain (normally 0,0,0).

Using this you can calculate wordPos = densityPixelPos / densityResolution * terrainSize - terrainSize * 0.5 + terrainOrigin

However you can create an in-game tool, which can be activated by pressing a key. And you can write the data to a file. This is probably easier.

Note: Log in to post. Create a new account here.