Real world terrain (mapgen idea)

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Real world terrain (mapgen idea)

by rubenwardy » Mon Jun 22, 2015 08:29

You don't touch the settings, you just have to request an insecure environment. It means that your mod and your mod only can access insecure functions like require(). The alternative is having an external program download it, but that's more complicated for the end user than requesting an environment. Then again, they'd need to use luarocks to get luasockets...

Note that the method I use is synchronous, I haven't found out how to make it asynchronous yet. cURL may solve this.
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Wed Jun 24, 2015 05:18

rubenwardy wrote:You don't touch the settings, you just have to request an insecure environment. It means that your mod and your mod only can access insecure functions like require(). The alternative is having an external program download it, but that's more complicated for the end user than requesting an environment. Then again, they'd need to use luarocks to get luasockets....


that's what I meant. just considering minimizing the barriers to entry. but if it needs to be done one way or another then all my concerns are moot.

I will read your code as soon as I finish this: http://www.gantless.com/programs/macklem.pdf
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Real world terrain (mapgen idea)

by stu » Wed Jun 24, 2015 18:22

bobomb wrote:i have posted this mod as a work in progress: https://forum.minetest.net/viewtopic.php?f=9&t=12666

I really like what you've done with this, it's an idea I've been toying with myself for quite some time.
What I would really love to do someday is make a custom version that would generate maps on the fly from google (or wherever) and not be limited by size in any direction, only changes to the landscape would ever be saved. Of course this would require a complete rework of the engine and database so may be best done from scratch rather than trying to modify minetest.
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Fri Jun 26, 2015 16:01

i always thought that it was only changes to the landscape that were saved but that obviously is not the case because you can change mapgens and all that has been generated up to that point stays the same as it was. That makes the most sense to me now.
anyway, i have been messing around with treating the landscape as a complex number plane and generating the mandelbrot set, here are some early results:

Image
Image
Image

and here is a simple addition of two sine waves:

Image

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function get_pixel2(x,z)
   -- code from https://processing.org/examples/mandelbrot.html
   local maxiterations = 100
   -- Now we test, as we iterate z = z^2 + cm does z tend towards infinity?
    local a = x/500
    local b = z/500
    local n = 0
    while n < maxiterations do
      local aa = a * a
      local bb = b * b
      local twoab = 2.0 * a * b
      a = aa - bb + x/500
      b = twoab + z/500
      -- Infinty in our finite world is simple, let's just consider it 16
      if aa + bb > 16.0 then
        break  -- Bail
      end
      n = n+1
    end

    -- We color each pixel based on how long it takes to get to infinity
    -- If we never got there, let's pick the color black
    if n == maxiterations then
      return -1
    else
      -- Gosh, we could make fancy colors here if we wanted
     return n
    end
   
   
end
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Fri Jun 26, 2015 19:11

might be a way to get elevation data from a URL request: http://open.mapquestapi.com/elevation/

calculating Aspect using a 3x3 moving window: http://resources.arcgis.com/en/help/main/10.1/index.html#/How_Aspect_works/009z000000vp000000/

calculating Slope using a 3x3 moving window: http://resources.arcgis.com/en/help/main/10.1/index.html#/How_Slope_works/009z000000vz000000/

might be useful for a calculation for vegetation...
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Fri Jun 26, 2015 20:25

proof of concept for land-cover tiffs.
Here is a greyscale overlay for the same dimensions as the elevation graphic, which indicates water.
Image

result:

Image

obviously no effort has been made to fit the river to the actual terrain, but with different grey-ranges this could be used to handle roads and vegetation cover as well... if indexed color is too complicated, then simply different ranges of grey will be used. maybe I can find a lua image lib that will handle 16-bit grey for elevations, as well as maybe PNG layers for things like ores, roads/rivers.
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Sat Jun 27, 2015 01:58

proof of concept:
different grey-range encoding for roads:

Image
Image
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Mon Jul 27, 2015 18:11

bobomb wrote:Then I have no idea where the mapgen sets the final surface height.


This is still an issue for post-mapgen stuff. not really for this mod but is there an easy way to get the surface height? i found this https://github.com/minetest/minetest/pull/640 Otherwise does anyone know of a nice lua get_surface function?
 

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

Re: Real world terrain (mapgen idea)

by Sokomine » Thu Jul 30, 2015 01:44

bobomb wrote:Otherwise does anyone know of a nice lua get_surface function?

Some mapgens provide a useful heightmap in register_on_generated; but that's about it.
A list of my mods can be found here.
 

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

Re: Real world terrain (mapgen idea)

by paramat » Thu Jul 30, 2015 01:59

bobomb wrote:is there an easy way to get the surface height?

Before the corresponding mapchunk generates? immediately after the corresponding mapchunk generates? or anytime after the corresponding mapchunk generates?
Also remember there will be multiple surface heights if floating islands or overhangs are present, as in mgv5 and mgv7.
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Thu Jul 30, 2015 04:47

paramat wrote:
bobomb wrote:is there an easy way to get the surface height?

Before the corresponding mapchunk generates? immediately after the corresponding mapchunk generates? or anytime after the corresponding mapchunk generates?
Also remember there will be multiple surface heights if floating islands or overhangs are present, as in mgv5 and mgv7.


yes i have to account for caves and overhangs. i am talking long after the map has generated. I am using a function as per: https://forum.minetest.net/viewtopic.php?f=47&t=4668&start=2050#p185714

at time of map generating you can get the heightmap, is that correct? if so, is there a way to do a "delete blocks" but not actually delete blocks, but just rerun the mapgen to the point where I can get this heightmap? not writing to the map at all?

this is for a surface analysis mod I am working on https://forum.minetest.net/viewtopic.php?f=9&t=12928 which I might try to use to handle biomes, water bodies, etc in this realterrain mod.
 

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

Re: Real world terrain (mapgen idea)

by paramat » Thu Jul 30, 2015 21:13

Re-running mapgen just to get the heightmap is not recommended.
Yes use a column search for walkable, but use a 'non mapgen object' lua voxelmanip instead of 'get node' for speed. The voxelmanip could be a tall single column or cover a certain area to create a heghtmap.
 

Ryster
New member
 
Posts: 4
Joined: Thu Sep 10, 2015 18:08

Re: Real world terrain (mapgen idea)

by Ryster » Thu Sep 10, 2015 18:52

Hello,

subscribing/following/poking this thread with great interest!

@bobomb and @paramat .. really good stuff, and it's exactly why I am here.. for the generation of real-world landscape. I understand most people see this as a game, and are interested in mines, caves ores etc, but it can be so much more than that! I am here purely as a researcher, wanting to be able to replicate and edit the real-world for use as a visual aid in the cognitive understanding of the landscape around us. People cant collaborate in real time using google-earth, and it's honestly not as accurate up-close as a voxel-based terrain is, especially in remote regions.

There are excellent 3D rendering engines on the market, some proprietary and some open source, but vector-based world generators are complex and require a lot of technical knowledge. While I possess such knowledge, a vast majority of researchers in social and earth-sciences do not. Enabling them to be able to use a relatively easier system, based on a voxel mapgen world, will help within the methodologies of research and add another dimension to comprehensive understanding.

Scale, of course, is a central theme in landscapes. As mentioned before there is a plethora of freely available land use/ land cover (LU/LC) and elevation data, often at 30m resolution. This may be redundant, but for elevation, the most common format, and one that most others can be converted to is a 16bit GeoTIFF. As we are not really interested in the Geo part, lets say TIFF. For LU/LC that can be 8bit anything, GIF, PNG, BMP etc...

It's a very simple process to resample the resolution up to 1m... presenting us with a raster data set based on a 1:1 scale. From there, we can further resample by powers of 10 to deci, centi and milimeter scale (divide x,y by 10 and multiple z by 10 etc). This would be useful for recreating small spaces in the real world, in macroscopic scale... all within the spatial limits of Minetest.

I can do this in Minecraft with relative ease using the World Painter program, but that pesky 256 limit is quite bothersome. My personal study area has a delta z of 600 meters, so I'm forced to a 1:3 ratio, or a 3m square voxel. It's decent but I really want a 1:1 and/or 100:1 capability

I see you all have already accomplished this to some degree and I'm going to being playing around with it. I wish I had time to help code but my studies take up all my free time at the moment. :) I'm also more interested in the proof of concept and beta functionality, less about robustness and optimization. if it takes 2 days to generate on my octo-core system because you are using a brute force method to prove it works, I'm ok with that.

:)
thanks again for all your work on this subject!
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Real world terrain (mapgen idea)

by bobomb » Mon Oct 19, 2015 22:38

this mod has its own thread now: viewtopic.php?f=9&t=12666
 

User avatar
afflatus
Member
 
Posts: 302
Joined: Tue Apr 01, 2014 19:47
GitHub: 0-afflatus
IRC: afflatus
In-game: afflatus

Re:

by afflatus » Tue Feb 16, 2016 02:13

prestidigitator wrote:Minetest's coordinates span from like -32k to +32k in each dimension I believe, which if you consider a scale of 1m per node would only give you a 64km square area to play with.


I'm glad someone else is as dyslexic with maths as I am. I always work strictly to a voxel being a cubic metre, because my brain can't manage scaling. I'd convinced myself that the total playing surface was about 100 square miles. Of course, that's rubbish. I just worked it out as 1600 square miles (4096 km2). Could someone who doesn't suffer from dyscalculia confirm the real value?
Grailtest is sleeping ...
 

User avatar
Gael de Sailly
Member
 
Posts: 475
Joined: Sun Jan 26, 2014 17:01
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly

Re: Real world terrain (mapgen idea)

by Gael de Sailly » Wed Feb 17, 2016 10:26

That's right. 64² = 4096.
In fact, the maximal distance is not 32 km but 31, so the length of the world is 62 km. 62² = 3844 km² = 1484 square miles.
Very busy this year too, so do not expect me to be very active on the forum or in game. But I'm not about to drop Minetest forever :)
 

User avatar
Samson1
Member
 
Posts: 92
Joined: Wed Apr 01, 2015 19:41
IRC: Samson1
In-game: Samson1

Re: Real world terrain (mapgen idea)

by Samson1 » Wed Feb 24, 2016 12:15

I think the hole map-gen idea for Minetest is rubbish, the worlds are to flat or to hilly, there are no mountains or lakes or underground streams or rivers or...


all the rain mods have never been finished or they are so full of bugs they don't work. There's no snow, no rain.


Minecraft's rain works properly, Minecraft's Redstone is programmed correctly and works a treat. measecons make the hole game lag like anything, so do the weather mods.

It's great to see people actually making Minetest a better place then Minecraft for once...

My argument is, how on earth can anything in MT be better then MC when most of the developers don't know what there talking about when it comes to knowing how Minecraft works in-game when they have never played it.
MT name: Samson1

MC name: MoJo4000
 

User avatar
Gael de Sailly
Member
 
Posts: 475
Joined: Sun Jan 26, 2014 17:01
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly

Re: Real world terrain (mapgen idea)

by Gael de Sailly » Wed Feb 24, 2016 12:36

Samson1 wrote:I think the hole map-gen idea for Minetest is rubbish, the worlds are to flat or to hilly, there are no mountains or lakes or underground streams or rivers or...

That's the reason why mapgen is one of the main concerns of MT. And if you only know mapgen v6, try the others. v6 works well but is not beautiful (for me).
+ Offtopic
Very busy this year too, so do not expect me to be very active on the forum or in game. But I'm not about to drop Minetest forever :)
 

Previous

Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 39 guests

cron