Marble Rock, Iowa 8km Development

Farming Simulator 22 editing discussion

Moderators: Lone Wolf, Snake Man

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-17 01:04:30

Hello Everyone, today I started another project based in Iowa. I don't think the terrain is 100% due to the new way dem files work with giants, but its close. This terrain is using the snakeman method of generating them so should be fun.


Image

Image

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-17 02:23:11

Heightmap looks rough, obviously I don't know all of iowa and there is some elevations, but for traditional iowa landscape that looks like you did not setup heightScale correctly. For example our garden city is so flat that you have to comb it through with a microscope to find elevations heh.

But anyways nice job getting source files done.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-17 03:02:31

Snake Man wrote:
2022-10-17 02:23:11
Heightmap looks rough, obviously I don't know all of iowa and there is some elevations, but for traditional iowa landscape that looks like you did not setup heightScale correctly. For example our garden city is so flat that you have to comb it through with a microscope to find elevations heh.

But anyways nice job getting source files done.
Yea, I just zoomed down to the street level its fairly flat some ditches. The fields appear to be slightly elevated. I'm not sure hot to fix that.

Image
Kind of what its showing here, which I am confused about as well since it doesn't look that bad, theres a river on the east side of it some ditches but. Roughly the area. 42°57'03.5"N 92°57'55.4"W

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-17 15:06:22

Go to farming-simulator.org -> FS19 -> map making tutorial -> heightScale.

That page along with heightmap explains how to use heightScale.

I assume you used the free demo or trial version of global mapper, how does it work for 8.1km terrain, do any of the trial limitations prevent you from using it yet?

Been using the full version since the beginning so don't even know what the limitations are, other than ArmA 3 terrains are way too big (50km and over) to be done with the demo / trial version.

BTW check out US NAIP for satellite imagery, ArcGIS zoom level 17 is my go to world wide imagery source, but for american terrains there is no substitute for US NAIP. You have to add this to global mapper manually, at least in my recent global mapper re-install had to add online source manually.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-17 17:21:30

So far the openstreetmaps.org one are giving me a tad bit of trouble with 403 errors trying to download the data. I've found an ok work around doing world street map and satalite imaging trying to find the best areas.

I've loaded the whole us dem first then zoomed in to my area in Iowa. This seemed to be a good work around to what it was.

Image

Things seem more level instead of that first one.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-17 20:24:15

I've loaded the whole us dem first
Downloaded from where?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-17 21:03:06

Snake Man wrote:
2022-10-17 20:24:15
I've loaded the whole us dem first
Downloaded from where?
Elevation Data (NED) I loaded that first then zoomed in, not sure if it does it the correct way but now the terrain appears to be more accurate. When I import to l3dt it turns the blue to pure white almost with some black streaks.

Still a learning process so I know I am going to get a few things wrong the first few times before I perfect it. I am a rather fast learner so. As for global mapper I got it off of a friend that got it for some train sim stuff and never used it so its the registered version. Using the L3dt that you posted on the forums atm as well.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-17 21:56:46

You have probably already read this PMC Farming Simulator Real World Data Terrain tutorial page which links to PMC Editing Wiki for ArmA 3 Real World Data Terrain tutorial. There are some differences when it comes to ArmA 3 and FS19 terrain source file creation (heightmap + satellite imagery), but overall the process is the same.

If you want to see a video of me creating FS19 real world data terrain from scratch, then watch ohio arcanum dev diary E01.

Please note that this is NOT a tutorial but just a dev diary of me editing stuff. Dev Diary PMC Ohio Arcanum 8km Terrain E01 2020-05-18 Farming Simulator 19.

In that video you see me doing 8.1km terrain source files, at least you can see how I did the heightmap file(s).
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-17 22:07:31

Snake Man wrote:
2022-10-17 21:56:46
You have probably already read this PMC Farming Simulator Real World Data Terrain tutorial page which links to PMC Editing Wiki for ArmA 3 Real World Data Terrain tutorial. There are some differences when it comes to ArmA 3 and FS19 terrain source file creation (heightmap + satellite imagery), but overall the process is the same.

If you want to see a video of me creating FS19 real world data terrain from scratch, then watch ohio arcanum dev diary E01.

Please note that this is NOT a tutorial but just a dev diary of me editing stuff. Dev Diary PMC Ohio Arcanum 8km Terrain E01 2020-05-18 Farming Simulator 19.

In that video you see me doing 8.1km terrain source files, at least you can see how I did the heightmap file(s).
Will do, my first terrain kinda looked like the one out of the ohio one. (I've been following that one) the very first one at least that I had to redo for what ever reason. That was at the PA location that I'm not sure I am going to do still since there is a quarry right in their backyard, but I feel like that is also very unique. For some reason I think just this location is giving trouble.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-18 20:47:26

Small update vlog, for the sake of my sanity going to take my time to paint the fields as it messes with my eyes.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-18 21:21:51

How did it go with the heightmap and heightscale, did you got that sorted out?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-18 21:40:41

Snake Man wrote:
2022-10-18 21:21:51
How did it go with the heightmap and heightscale, did you got that sorted out?
Yes Sir, I got three maps in the works I may just rename this to my dev adventures, instead of spamming this section. Things will just take longer since its only myself doing them at the moment.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-21 17:35:42

So I've been running into some issues with the new feature that giants put out. I've been trying to plant trees with the mesh paint tool. It worked for about one pass then just freezes now so may have to try the old spline way I guess unless I can figure out the problem.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-10-21 20:19:53

See Giants Editor v9.0.2 Mesh Paint Tool topic for further object placing information.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-22 19:52:25

Ah, I see. I was thinking maybe it was a weight file sized wrong or something. That makes more sense.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-10-25 03:31:09

Small update roads have been done via splineplacement.

Image

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-11-04 21:10:21

Started taking a break, since I am waiting for a friend to mark the fields for me since the red just doesn't agree with my eyes. I've done the roads and utility poles thus far.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2022-11-05 05:49:11

What kind of problems you are having while painting cultivator_density?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2022-11-07 04:33:56

Snake Man wrote:
2022-11-05 05:49:11
What kind of problems you are having while painting cultivator_density?
More or less all I see is red for a bit after lol

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-16 18:39:09

Image
Making some progress marking the fields. Side note I just noticed that there is a small waterfall on the west side of the town.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-17 04:22:00

Took a few breaks almost done though.
Image

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2023-02-17 15:49:33

Looks like its coming along nicely.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-19 18:37:23

Small update post.

I've dug out the river some as it doesn't seem like it has accurate data for that (Naturally). Image

There is a nice little drowning machine dam (Low Head Dam) That I am not sure how I want to hand that's right at the base of the town. I do want to nail this a little as it looks awesome.
Image

I am thinking about making it a really small drop and adding the waterfall features around it. I am not sure if the flood scripts have been converted from 19 yet but have good ideas if it has been.


I may need to smooth out some hills after a play test just to see if default farm equipment can handle it.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-20 15:53:08

Small update upscaled everything to be a 12km x 12km. I've done this so the spacing on the roads/fields are a little better as the roads would literally run into the fields, now they don't.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2023-02-20 16:00:25

Its not a real world data terrain if you down or up scale it. Might still be a nice terrain to play on, but have to be clear on the designations.

You could have left the fields with one or two pixels less, maybe that would have helped. Through the history there are other terrains that fields get drawn together, for example FS19 Nebraska Lands you cannot use courseplay normally as it merges several fields together as it "cant see" that the nearby field edges are just that, edges, instead of one single field. I've also seen this happen in FS22 terrain as well, so yeah its known issue.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-20 20:16:13

Snake Man wrote:
2023-02-20 16:00:25
Its not a real world data terrain if you down or up scale it. Might still be a nice terrain to play on, but have to be clear on the designations.

You could have left the fields with one or two pixels less, maybe that would have helped. Through the history there are other terrains that fields get drawn together, for example FS19 Nebraska Lands you cannot use courseplay normally as it merges several fields together as it "cant see" that the nearby field edges are just that, edges, instead of one single field. I've also seen this happen in FS22 terrain as well, so yeah its known issue.
True, I do have a backup of both, I may just make the larger one for myself since I like big maps for myself and my group, and make the public release the 4km.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-20 23:30:46

Not exactly sure if anybody ever found a fix for the flickering textures are maps above 4km or not but I guess I can look for one.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2023-02-21 00:04:31

Hmm if you mean vehicle in-cab monitors/screen panels, then yeah I haven't heard if there are any fix for that. Was that what you meant?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-21 17:00:44

Snake Man wrote:
2023-02-21 00:04:31
Hmm if you mean vehicle in-cab monitors/screen panels, then yeah I haven't heard if there are any fix for that. Was that what you meant?
Yes sir.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-26 17:32:24

Small update since I've done a lot of things.

The low head dam is not complete.

Image

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-27 20:58:27

Dev update:

I ended up changing the water to a much darker shade, changed the paint layer of the river. I also started painting the fields for field dimensions.

Image

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2023-02-28 02:33:10

Glad to see you got some field definitions done, good work, keep it up.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-02-28 18:08:48

Snake Man wrote:
2023-02-28 02:33:10
Glad to see you got some field definitions done, good work, keep it up.
Thanks, small update 92 fields in and almost half way there.

Image

ARG_Afb
1st Lt
Posts: 139
Joined: 2022-05-31 13:04:27
Gaming Interests: ArmA 3
Editing Interests: Terrains
Location: somewhere in Argentina

Re: Marble Rock, Iowa 8km Development

Post by ARG_Afb » 2023-03-03 12:46:43

hey your map is looking nice man!
AFB

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-03-04 00:09:19

ARG_Afb wrote:
2023-03-03 12:46:43
hey your map is looking nice man!
Thanks I splined more roads and plan on doing the trees for the last details took a break from painting for now.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-03-06 04:29:28

I've finished painting the fields. Now its time to fine tune this script.

Code: Select all

-- Author:KR-Softwares/kevink98
-- Name:FieldDimensions with bitmap
-- Description:You can draw the filed on a bitmap (*.grle). The script create automaticly fielddimensions.
-- Icon:
-- Hide: no

-- Set filename to a bitmap file (*.grle)
local filename = "FS22_MarbleRck/maps/mapUS/data/infoLayer_fieldDimensions.png"
--Set bits of bitmap (normaly 8 bits)
local bits = 8
--Set size of map (normaly 1024)
local size = 8192
--Set factor for bigger grle's
local factor = 6
--Set field factor (glreSize/mapSize) (f.e. standardmap: 4096 / 2048 = 2
local fieldFactor = 4

--HELPS

--szie:
--1x Map : 1024
--4x Map : 2048

-- factor:
-- use 1x Map and grle size 1024x1024 : 1
-- use 1x Map and grle size 2048x2048 : 2
-- use 4x Map and grle size 2048x2048 : 1
-- use 4x Map and grle size 4096x4096 : 2


-- NO CHANGES HERE --
local map = createBitVectorMap("FieldDefs")
local success = loadBitVectorMapFromFile(map, filename, bits)
if not success then
    print("Can't load file!")
    return
end
local localMapWidth, localMapHeight = getBitVectorMapSize(map)

local foundFields = {}
local sceneRoot = getChildAt(getRootNode(), 0)
local terrainNode = getChild(sceneRoot, "terrain")
for y = localMapHeight-1, 0, -1 do
    local lastValue = -1
    for x = 0, localMapWidth - 1 do
        local value = getBitVectorMapPoint(map, x, y, 0, bits)
        if value > 0 then
            if foundFields[value] == nil then
                foundFields[value] = {}
                foundFields[value].lines = {}
            end
            
            if foundFields[value].lines[y] == nil then
                foundFields[value].lines[y] = {}
            end
                            
            if lastValue == -1 then
                local newLine = {}
                newLine.y = y / factor
                newLine.start_x = x / factor
                newLine.end_x = -1
                table.insert(foundFields[value].lines[y], newLine)
                lastValue = value
            end
        elseif lastValue > -1 then
            local lastlineIndex = nil
            for k,line in pairs(foundFields[lastValue].lines[y]) do
                if line.end_x == -1 then
                    lastlineIndex = k
                    break
                end
            end
            
            if lastlineIndex ~= nil then    
                foundFields[lastValue].lines[y][lastlineIndex].end_x = (x / factor) - 1 
                lastValue = -1
            end       
        end
    end
end 

local node = getSelection(0)
if node == 0 or getUserAttribute(node, "onCreate") ~= "FieldUtil.onCreate" then
    print("Error: Please select FieldDefinition defintions root!")
    return
end

local function FormatNumber(idx)
    if idx < 10 then
        return string.format("00%s", idx)
    elseif idx < 100 then
        return string.format("0%s", idx)
    else
        return idx
    end
end

for i=0, getNumOfChildren(node)-1, 1 do
    local childField = getChildAt(node, 0)
    unlink(childField)
end

local function GetStartPosFromLine(line)
    local s_x = line.start_x*2 - size
    local s_z = line.y*2 - size
    local w = (line.end_x - line.start_x) * 2 + 2
    
    return s_x, s_z, w
end

local function GenerateFieldDimensions(x,y,z,w,h, cornerIdx)
    local c1 = createTransformGroup(string.format("corner%s_1", FormatNumber(cornerIdx)))
    local c2 = createTransformGroup(string.format("corner%s_2", FormatNumber(cornerIdx)))
    local c3 = createTransformGroup(string.format("corner%s_3", FormatNumber(cornerIdx)))
    link(c1, c2)
    link(c1, c3)

    setTranslation(c1, x, y,z)
    setTranslation(c2, 0,0,h)
    setTranslation(c3, w, 0,h)
    return c1
end

for v, data in pairs(foundFields) do
    local fieldTg = createTransformGroup(string.format("field%s", FormatNumber(v)))
    local fieldDimensions = createTransformGroup("fieldDimensions")
    local fieldMapIndicator = createTransformGroup("fieldMapIndicator")
    link(fieldTg, fieldDimensions)
    link(fieldTg, fieldMapIndicator)
    local cornerIdx = 1
    
    local s = size + 1
    local min_x = s
    local max_x = -s
    local min_y = s
    local max_y = -s

    local skippedLines = {}

    for y = 0, localMapHeight-1 do
        if data.lines[y] ~= nil then

            for yi = 1, (#data.lines[y]),1 do
            --for _,line in pairs(data.lines[y]) do

                local s_x, s_z, w = GetStartPosFromLine(data.lines[y][yi])

                if s_x < min_x then
                    min_x = s_x
                end
                if s_x + w > max_x then
                    max_x = s_x + w
                end
                if s_z < min_y then
                    min_y = s_z
                end
                if s_z > max_y then
                    max_y = s_z
                end

                if skippedLines[yi] == nil then
                    skippedLines[yi] = {}
                    skippedLines[yi].s_x = s_x
                    skippedLines[yi].s_z = s_z
                    skippedLines[yi].w = w
                    skippedLines[yi].height = 1 / fieldFactor        
                elseif skippedLines[yi].s_x == s_x and skippedLines[yi].w == w then                    
                    skippedLines[yi].height = skippedLines[yi].height + 1 / fieldFactor   
                else        
                    local y = getTerrainHeightAtWorldPos(terrainNode, skippedLines[yi].s_x, 0, skippedLines[yi].s_z)  
                    local c1 = GenerateFieldDimensions(skippedLines[yi].s_x, y, skippedLines[yi].s_z, skippedLines[yi].w, skippedLines[yi].height, cornerIdx)
                    link(fieldDimensions, c1)
                    cornerIdx = cornerIdx + 1

                    skippedLines[yi] = {}
                    skippedLines[yi].s_x = s_x
                    skippedLines[yi].s_z = s_z
                    skippedLines[yi].w = w
                    skippedLines[yi].height = 1 / fieldFactor  
                end
                
            end
        end
    end

    for yi,_ in pairs(skippedLines) do   
        local y = getTerrainHeightAtWorldPos(terrainNode, skippedLines[yi].s_x, 0, skippedLines[yi].s_z)  
        local c1 = GenerateFieldDimensions(skippedLines[yi].s_x, y, skippedLines[yi].s_z, skippedLines[yi].w, skippedLines[yi].height, cornerIdx)
        link(fieldDimensions, c1)
    end

    local ind_x = min_x + (max_x - min_x) / 2
    local ind_y = min_y + (max_y - min_y) / 2
    setTranslation(fieldMapIndicator, ind_x, getTerrainHeightAtWorldPos(terrainNode, ind_x, 0, ind_y), ind_y)
    
    setUserAttribute(fieldTg, "fieldAngle", "Integer", 90)
    setUserAttribute(fieldTg, "fieldDimensionIndex", "Integer", 0)
    setUserAttribute(fieldTg, "nameIndicatorIndex", "Integer", 1)
    link(node, fieldTg)
end

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: Marble Rock, Iowa 8km Development

Post by Snake Man » 2023-03-06 04:42:59

That script generates way too many corner pieces and should not be used. Just create single or simple shapes to get started and then once you develop the terrain further come back and add some details using more corner pieces.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-03-07 04:50:00

Ah. wasn't aware of that factor.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-03-11 18:01:01

Update, I've placed all of the objects on the map farm and sell point wise.

Image

I still got a lot of cleaning to do and also the farmlands as well as trees almost done.

M1keOG
Recruit
Posts: 50
Joined: 2022-09-11 02:29:56
Gaming Interests: Farming Simulator
Editing Interests: Terrains

Re: Marble Rock, Iowa 8km Development

Post by M1keOG » 2023-03-11 22:35:38

Small update all fields farmland are now marked, thanks to me painting them before the script finding outs.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests