Post your mapgen questions here (modding or engine)

ShadMOrdre
Member
Posts: 665
Joined: Mon Dec 29, 2014 08:07
GitHub: ShadMOrdre
In-game: shadmordre
Location: USA

Re: Post your mapgen questions here (modding or engine)

by ShadMOrdre » Post

T6C,

Other than manipulating the various mapgen parameters, hoping for something similar to your desired output, the only real answer is a Lua mapgen.

Carpathian and Valleys both exist as a lua mapgen, but are much slower. If you search for the grunds mod, it contains code that will, with modifications, allow you to generate mg_v7 terrain, without ridges, mountains, caves, or floatlands.

I've worked towards making "continental" sized landmasses, with realistic mountains, true oceans, and other assorted geologic wonders. I've been using voronoi cells and a basic 2D noise to accomplish most of this. A 3D noise for generating a 2D heightmap, while preserving the 3D overhangs, to make more appealing terrain, but again, lua mapgens are slower. If you're willing to be patient, however, they are far more rich in what can be accomplished.

Shad

Image
Attachments
screenshot_20200828_012451.jpg
(224.24 KiB) Not downloaded yet
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.

User avatar
T6C
Member
Posts: 33
Joined: Thu May 07, 2020 17:11
In-game: T6C

Re: Post your mapgen questions here (modding or engine)

by T6C » Post

@Shad

Hey, that looks promising! And it sounds like something I've been looking for. With my application development experience, I'd offer to help, but I have zero experience in Lua (I hadn't even heard of it until I started playing Minetest and read about it on this forum).

When you say, "Lua mapgens are slower," and, "if you are willing to be patient," are you talking about at world creation time or at chunk generation time? That is, does it take longer to create the world, and then gameplay is fine, or does it cause long pauses/freezes when generating new chunks in-game? AFAIK, world chunks are generated procedurally and on-demand, so it would cause long delays while exploring in-game.

What documentation did you use to learn Lua? You've gotten me interested, and now I want to play around with the code to see what I can come up with. Who knows? Maybe I'll even create a new mapgen to share here. A quick Google search revealed the official Lua site, but if you know of other helpful resources, that'd be good, too.

Also, had to lol at your 1 FPS in the screenshot. I'm running a rather large carpathian world (around 6000x4000, mapfile about 900 MB) with a whole slew of mods on a 3 y/o Chromebook, and I've never seen frame rates that low. What tortures are you doing to your poor computer?! LOL

Edit: I just found this wiki to help me learn Lua and how to use the Minetest API. Still, any other good sources are always helpful. :)

ShadMOrdre
Member
Posts: 665
Joined: Mon Dec 29, 2014 08:07
GitHub: ShadMOrdre
In-game: shadmordre
Location: USA

Re: Post your mapgen questions here (modding or engine)

by ShadMOrdre » Post

TC6,

Lua mapgens run slower because they are loaded via the lua api, so the engine needs time to process the code, and other reasons.

As for learning Lua, in your minetest folder there should be a 'doc' folder. In that folder is lua_api.txt. This is the definitive source for the version of MT for which the file is shipped. So if you're coding for MT v5.2, use the lua_api.txt file from that version. If you're coding for MT v5.1, use the lua_api.txt file from that installation.

As for learning Lua in general, I gotta say it's at least as easy as learning Basic, and perhaps easier. I too am an App developer / systems analyst. Most of my coding experience is in writing db apps, so SQL and VB or something similar. I've been coding in Lua now for about 4 years.

A great way to learn, is simply to look at mods, read the code. The MTG game is essentially a collection of mods, so you can look in the game folder and peek at the mods contained therein.

Hope this answers your questions.

Shad

PS, if you are interested, my own mapgen project is posted here on github.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.

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

Re: Post your mapgen questions here (modding or engine)

by Sokomine » Post

T6C wrote: It's also the only mapgen—flat excluded, of course—that has not at least once spawned floating landmasses (too unrealistic; ruins the immersion for me).
I feel similar and don't like those floating islands either. I still prefer v6 mapgen because that creates very small-scale terrain which is IMHO best suited for building something in it, especially on servers and when that impressive mountain over there isn't even visible because it hasn't been sent to the client or drawn yet.
T6C wrote: When you say, "Lua mapgens are slower," and, "if you are willing to be patient," are you talking about at world creation time or at chunk generation time?
It doesn't make much sense to distinguish between world creation time and chunk generation time. After all the world consists (mostly) of mapchunks. If your mapgen is slow, you can "outrun" it - with fly and fast you will run into invisible walls where the map has not been generated yet (at least in older versions of MT). New mapblocks are created when a player explores new regions. On servers with expensive mapgens or slow hardware, players exploring new terrain may cause noticable lag for the other players.

A lua mapgen needs to read/import the data from the current mapchunk (usually 16*5 plus 16*2 shell in each dimension - 112x112x112 nodes per mapblock), work on it (which may be a bit slower than in C++) and write the mapchunk back. That all costs.
T6C wrote: Also, had to lol at your 1 FPS in the screenshot. I'm running a rather large carpathian world (around 6000x4000, mapfile about 900 MB) with a whole slew of mods on a 3 y/o Chromebook, and I've never seen frame rates that low. What tortures are you doing to your poor computer?! LOL
That's far (=unlimited) view. If you explore a lot of your world and then go to far view, your FPS will drop considerably, even with excellent hardware.
A list of my mods can be found here.

User avatar
TumeniNodes
Member
Posts: 2860
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your mapgen questions here (modding or engine)

by TumeniNodes » Post

"No Mountains" typically gives me a floating island free map... using V7
Of course river gen cuts into the terrain, leaving small floating fragments here and there but not at the same annoying scale as using mountains does.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am

User avatar
Linuxdirk
Member
Posts: 2588
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your mapgen questions here (modding or engine)

by Linuxdirk » Post

Just a quick question: Why is my schematic placed one node too low?

Nevermind, just found it. Add place_offset_y = 1 to your minetest.register_decoration call to have it placed on your configured place_on node and not in it.

ShadMOrdre
Member
Posts: 665
Joined: Mon Dec 29, 2014 08:07
GitHub: ShadMOrdre
In-game: shadmordre
Location: USA

Re: Post your mapgen questions here (modding or engine)

by ShadMOrdre » Post

Would anyone be interested in a standalone, mg_v7 lua based mapgen?

I recently came across code that provides the 2D heightmap, without mountains, ridges, floatlands, or caves.

I have already played with this code in my Voronoi mapgen, and was surprised at how well it performed with my mod heavy custom "game" setup. I've had it working with lib_materials and lib_ecology biomes with a somewhat reasonable mapgen time of around 5 seconds per mapchunk. Once the area around a player has fully loaded, moving around at normal speed with a view distance of about 80 to 100 meters still produces some lag, but when I lower view distance to the minimum 20 meters, the terrain practically appears in the fogged distance, without noticeable lag, even when hosting the world as a server on my desktop, with a client running on both the desktop, and a connected laptop.

Additional mapgen code in both my lib_towns mod, and my fork of Geomoria, do not slow the mapgen, but adding mesecons, pipeworks, and any collection of mobs significantly add to mapgen generation times. It's a tradeoff I'm willing to accept in my local environment, but have been working to address these issues for potential server deployment.

My current work has been to make the Voronoi part of the mapgen to be less lag inducing, as well as to provide the most realistic mountains and valleys for river placement. Both have met with success in my local setup, but would require additional work to make compatible with other Minetest games like MTG or MCL2. My current local "game" configuration includes around 100-150MB of content. Textures, sounds, models, and schematics by far the bulk, but makes distribution difficult.

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.

User avatar
paramat
Developer
Posts: 3679
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your mapgen questions here (modding or engine)

by paramat » Post

T6C,

> In the wiki, it says that carpathian maps feature "vast plains," and, "complex, realistic mountain ranges."
No vast plains.
No "ranges" of mountains.
Is my problem that I'm just very, very unlucky with my seeds?

No, heh, the wiki description is partly wrong and does not match how you would describe the mapgen.
And seeds do not work that way. Different seeds result in the same features and general mapgen character, just shaped and distributed differently.

> Biomes are very small and are strangely placed. For example, no progression from hot to cold biomes. Snow can be right next to a jungle or between two desert biomes. See maps below.

Biomes and biome distribution are determined by the game used. The engine only provides a bare stone terrain and a heat and humidity variation across a world.
Are you using the Ethereal game? The maps look like that game.
Minetest Game has a well designed biome distribution, although you may still find the biomes too small. Many people have been conditioned by Minecraft's tiny biomes and find MTG biomes too big.

> Can I add or tweak any settings in the minetest.conf file to accomplish this? The wiki mentions settings only for v6 and v7.

The wiki is not official or up to date, it has a lot of missing, incorrect or out of date information. Always also look at lua_api.txt and trust that if there is a difference, that is the official and up to date source of information.

You can increase the scale of the heat and humidity noises to make biomes larger. You can also customise the mapgen noises to customise the mapgen features. Read through this entire thread as it contains a lot of related information.

But, a realistic mapgen as you describe does not exist yet, although i am writing and experimenting with new core mapgens that are larger scaled and more realistic.

> When you say, "Lua mapgens are slower," and, "if you are willing to be patient," are you talking about at world creation time or at chunk generation time? That is, does it take longer to create the world, and then gameplay is fine, or does it cause long pauses/freezes when generating new chunks in-game?

At mapchunk generation time. The issue is that a lua mapgen runs in Lua, so any large process freezes all other Lua processes. A complex Lua mapgen can take approx 1s to generate a mapchunk.
Not a problem in singleplayer because the exploring player triggers mapgen, because they are exploring they are usually not doing other activities that may be disrupted by Lua lag.
But in multiplayer, the Lua lag can disrupt other players who are doing other activities.

ShadMOrdre,

> Would anyone be interested in a standalone, mg_v7 lua based mapgen?
I recently came across code that provides the 2D heightmap

Not possible, as V7 uses variable-persistence noise for basic terrain, this way of generating noise is not exposed to Lua (yet).

User avatar
Linuxdirk
Member
Posts: 2588
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your mapgen questions here (modding or engine)

by Linuxdirk » Post

paramat wrote:
Tue Sep 15, 2020 20:01
The engine only provides a bare stone terrain and a heat and humidity variation across a world.
What are those anyways? Like an actual temperature? So can I say: “here is my ice biome registration, please place it where the temperature is -10 degrees”, or just a unitless value?

ShadMOrdre
Member
Posts: 665
Joined: Mon Dec 29, 2014 08:07
GitHub: ShadMOrdre
In-game: shadmordre
Location: USA

Re: Post your mapgen questions here (modding or engine)

by ShadMOrdre » Post

paramat,

Courtesy of Pyrollo, have you seen this, from the grunds mod. I took part of this code to create the following function, which provides mg_v7 terrain, without mountains, ridges, caves or floatlands.

Code: Select all

	local function get_v7_height(z,x)

		local hselect = minetest.get_perlin(np_v7_height):get_2d({x=x,y=z})
		local hselect = rangelim(hselect, 0, 1)

		local persist = minetest.get_perlin(np_v7_persist):get_2d({x=x,y=z})

		np_v7_base.persistence = persist;
		local height_base = minetest.get_perlin(np_v7_base):get_2d({x=x,y=z})
	
		np_v7_alt.persistence = persist;
		local height_alt = minetest.get_perlin(np_v7_alt):get_2d({x=x,y=z})
	
		if (height_alt > height_base) then
			return floor(height_alt)
		end
	
		return floor((height_base * hselect) + (height_alt * (1 - hselect)))
	end
This code creates the terrain below. The v7 map seed is in the pic, for comparison. If the seed number is too much, I simply entered the word Terraria as the seed, which consistently provides the numbered seed in the image. Also note, this shows my 'mod "heavy" soup' custom game, which adds to the mapgen time also shown in the image.

Image


Shad
Attachments
screenshot_20200916_130003.jpg
(287.29 KiB) Not downloaded yet
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest