How can I find (nearly) flat regions in the map?

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

How can I find (nearly) flat regions in the map?

by burli » Fri Jan 27, 2017 11:37

Really flat regions are rare, but there are areas with really low hills. I need an algorithm to find these areas.

I can parse the heightmap of a chunk and calculate the average height and store the maximum and minimum height. Better would be if I do this for each mapblock. But both methods have advantages and disadvantages

Maybe I can create some kind of slope map. But I'm not sure how I can do this
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: How can I find (nearly) flat regions in the map?

by paramat » Fri Jan 27, 2017 13:35

Do you want to know a distant location before it has been generated? That would be difficult and intensive in mgv6 and mgv7 but in mgv5 there is a large-scale noise that controls vertical scale, you would just search for an area where that is small.
Or if just detecting during mapgen then analysing the range of the heightmap is a good idea.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I find (nearly) flat regions in the map?

by burli » Fri Jan 27, 2017 15:18

paramat wrote:Do you want to know a distant location before it has been generated?

That would be fine, but no. I just want to make a lua mod that places schematics in the map and I want to find good places
 

User avatar
duane
Member
 
Posts: 776
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r

Re: How can I find (nearly) flat regions in the map?

by duane » Sat Jan 28, 2017 12:08

burli wrote:
paramat wrote:Do you want to know a distant location before it has been generated?

That would be fine, but no. I just want to make a lua mod that places schematics in the map and I want to find good places


The easiest way to find something is to put it there yourself. It's pretty easy to flatten an area unobtrusively.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I find (nearly) flat regions in the map?

by burli » Sat Jan 28, 2017 13:01

duane wrote:The easiest way to find something is to put it there yourself. It's pretty easy to flatten an area unobtrusively.


You are right, but I don't want to run this "blind". First I want to find relative flat regions.

Where can I find your code? In your old funcaves mod?
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: How can I find (nearly) flat regions in the map?

by hajo » Sat Jan 28, 2017 16:25

burli wrote:Really flat regions are rare, but there are areas with really low hills.
I need an algorithm to find these areas.

I found mapgen v7 can generate very 'square-wavy' terrain,
e.g. a plateau (high-up, at y>80), steep cliff down to a lake at y=1,
followed by another steep cliff up to the next high plateau.

You could use worldedit to pave a 'ceiling' over that lake,
and have a single large plateau, with a 'cave' below.

maximum and minimum height.

Wouldn't find such an area directly.

I recommand to fly around, to see the landscape...
Maybe there is a mod with some flying vehicle, and a programmable autopilot ?

Also, you could make new land over water.
Best for farming - each block is in range of water,
no need for irrigation/trenches, wells etc.
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I find (nearly) flat regions in the map?

by burli » Sat Jan 28, 2017 17:35

hajo wrote:
burli wrote:Really flat regions are rare, but there are areas with really low hills.
I need an algorithm to find these areas.

I found mapgen v7 can generate very 'square-wavy' terrain,
e.g. a plateau (high-up, at y>80), steep cliff down to a lake at y=1,
followed by another steep cliff up to the next high plateau.

You could use worldedit to pave a 'ceiling' over that lake,
and have a single large plateau, with a 'cave' below.

maximum and minimum height.

Wouldn't find such an area directly.

I recommand to fly around, to see the landscape...
Maybe there is a mod with some flying vehicle, and a programmable autopilot ?

Also, you could make new land over water.
Best for farming - each block is in range of water,
no need for irrigation/trenches, wells etc.


I always notice that I have a very different picture of Minetest. I don't want to build a map. I want to make a mod that can place structures automatically. And I don't want to modify the map (as less as possible). I want to use the map as is
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: How can I find (nearly) flat regions in the map?

by hajo » Sat Jan 28, 2017 18:38

burli wrote:Really flat regions are rare, but there are areas with really low hills.
I need an algorithm to find these areas.
hajo wrote:You could use worldedit to pave a 'ceiling' over that lake, ..
Also, you could make new land over water.

I want to make a mod that can place structures automatically. .. I want to use the map as is

One problem with that algorithm is that the mapgenerator works 'on demand'.
So you cannot check areas the player hasn't visited yet.
That's why I said "fly/look around".
But maybe there is a way to force the mapgenerator to build
a reasonable large area in advance, say within 400x20x400 blocks ?

How about a database (or wiki-page for starters) with maps and a list of suitable areas ?
Map as in "v6, seed 123", and area as in "flat, desert, size 40x60, at 100,5,200" ?
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I find (nearly) flat regions in the map?

by burli » Sat Jan 28, 2017 19:00

hajo wrote:One problem with that algorithm is that the mapgenerator works 'on demand'.
So you cannot check areas the player hasn't visited yet.


I know that. But the map is generated chunk by chunk. And after a chunk is generated I can place something in it

I know that this algorithm has limits, but that's ok for me
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: How can I find (nearly) flat regions in the map?

by paramat » Sun Jan 29, 2017 00:02

I would use the heightmap within 'on generate' and break it into 16x16 blocks and analyse the range of heights in each block, if it's small enough (=< 1 or 2) flatten the surface of the block down to the lowest height.
 

User avatar
duane
Member
 
Posts: 776
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r

Re: How can I find (nearly) flat regions in the map?

by duane » Sun Jan 29, 2017 00:39

burli wrote:You are right, but I don't want to run this "blind". First I want to find relative flat regions.

Where can I find your code? In your old funcaves mod?


https://github.com/duane-r/fun_caves/bl ... t.lua#L103


I think you're doing it the hard way, but this definitely should work (except that the heightmap is frequently incorrect in valleys mapgen):

I would use the heightmap within 'on generate' and break it into 16x16 blocks and analyse the range of heights in each block, if it's small enough (=< 1 or 2) flatten the surface of the block down to the lowest height.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I find (nearly) flat regions in the map?

by burli » Sun Jan 29, 2017 08:29

duane wrote:I think you're doing it the hard way, but this definitely should work (except that the heightmap is frequently incorrect in valleys mapgen):


Maybe the easy way ends in some strange results

Image

@paramat that's what I want to do, but I think the average height would be better. And it should look natural. I don't wanna have square blocks or straight cuts in my map
Attachments
screenshot_20170129_090859.jpg
screenshot_20170129_090859.jpg (332.71 KiB) Viewed 4330 times
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: How can I find (nearly) flat regions in the map?

by Sokomine » Fri Mar 31, 2017 23:31

burli wrote:I always notice that I have a very different picture of Minetest. I don't want to build a map. I want to make a mod that can place structures automatically. And I don't want to modify the map (as less as possible). I want to use the map as is

*Suggestive mode on* The map has always been the way to which you changed it (nice and flat for your structures). Really! *Suggestive mode off*

The map is usually far too small-scale. Worst of all, mapgens are diffrent and create diffrent terrain. Even if you find a way to locate relatively flat areas in one mapgen, the next mapgen will not work at all.
A list of my mods can be found here.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron