Post your mapgen questions here (modding or engine)

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
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
screenshot_20200828_012451.jpg (224.24 KiB) Viewed 4802 times

User avatar
T6C
Member
Posts: 119
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: 1118
Joined: Mon Dec 29, 2014 08:07
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.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: 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: 2941
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.
A Wonderful World

User avatar
Linuxdirk
Member
Posts: 3216
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: 1118
Joined: Mon Dec 29, 2014 08:07
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

User avatar
paramat
Developer
Posts: 3700
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: 3216
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: 1118
Joined: Mon Dec 29, 2014 08:07
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
screenshot_20200916_130003.jpg (287.29 KiB) Viewed 4802 times

User avatar
Grigor
Member
Posts: 49
Joined: Sun Dec 01, 2019 05:55

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

by Grigor » Post

Hi all. Simple enough question - how to make map features (caverns in v7, in particular) fewer and further between?
I get the idea that X and Z spread might make the caverns larger and flatter, but actually increasing the distance between occurrences of caverns? Maybe so you find one within every 1000 squares instead of every 100?

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

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

by MisterE » Post

I need help-- I am trying to get vein-type ores for all the default ores

I tried using the suggested noise values for all of them, but that put rare veins with all the ores in the same vein.

Then I tried changing the values a little (mostly just the offset) but then it didnt spawn the ores at all. So now Im kind stuck. COuld someone who understands what they are doing give some code, or at least provide a way for me to generate code that works?

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

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

by Skamiz Kazzarch » Post

You have to use a different 'seed' value for each ore type.

carlos_rupp
New member
Posts: 7
Joined: Wed Sep 25, 2013 16:14

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

by carlos_rupp » Post

I put schematics in the game in the mapgen but i can't edit (add or remove nodes) when play. Anyone know why?

User avatar
paramat
Developer
Posts: 3700
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

ShadMOrdre,

Ah ok, it is 'possible' by using point-polled perlin noise instead of bulk-calculated perlin noise, but then you end up with much lower performance. Using point-polled perlin noise in Lua mapgen is unthinkable in my opinion, as Lua mapgen already has big performance and server lag problems even with the most efficient implementation.

Grigor,

Increasing the 'spreads' will make caverns larger but also spaced further apart, everything is scaled up.
For fewer caverns spaced further apart, increase the 'spreads' but also increase 'mgv7_cavern_threshold' a little to make them rarer, try 0.8, 0.9 ...

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

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

by Sokomine » Post

I wonder if it might be possible to supply a larger heightmap that covers more than the current mapchunk. Sometimes it's too small for planning...
A list of my mods can be found here.

User avatar
duane
Member
Posts: 1715
Joined: Wed Aug 19, 2015 19:11
GitHub: duane-r
Location: Oklahoma City
Contact:

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

by duane » Post

Sokomine wrote:
Tue Sep 29, 2020 00:52
I wonder if it might be possible to supply a larger heightmap that covers more than the current mapchunk. Sometimes it's too small for planning...
You do realize that in order to provide a heightmap twice the current dimensions (only 50% more in each direction), you'd have to do four times the processing, and height takes up a lot of the chunk generation time in most mapgens. Also, although the chunks should always be generated independently, that's not actually possible all the time. Some mapgens (some of mine, for example) use data from already generated, adjacent chunks to make the terrain blend better, which means the heightmap can't be determined ahead of time.
Believe in people and you don't need to believe anything else.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

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

by Sokomine » Post

duane wrote: You do realize that in order to provide a heightmap twice the current dimensions (only 50% more in each direction), you'd have to do four times the processing, and height takes up a lot of the chunk generation time in most mapgens.
Ah, well, hopes destroyed. But at least I could ask :-)
duane wrote: Some mapgens (some of mine, for example) use data from already generated, adjacent chunks to make the terrain blend better, which means the heightmap can't be determined ahead of time.
That's also pretty intresting and might be helpful. If the heightmap could be stored somewhere, that'd help a lot. But I'm afraid that might be too much data.
A list of my mods can be found here.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

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

by ElCeejo » Post

I'm sure similar questions have been asked before but I'm too lazy to click through all these pages. What are some ways to speed a register_on_generated() function? Currently what my code does is find a position that isn't near a chunk border, then call another function that creates a sphere of sorts.


local pos1 = {x = pos.x - 34, y = pos.y - 34, z = pos.z - 34}
local pos2 = {x = pos.x + 34, y = pos.y + 34, z = pos.z + 34}
local vm = minetest.get_mapgen_object("voxelmanip")
local emin, emax = vm:read_from_map(pos1, pos2)
local a = VoxelArea:new{
MinEdge = emin,
MaxEdge = emax
}


after looking through pos1, pos2 then I check every positions distance to the central point, if it's between lower than 28 it gets set to air to make a sphere. If it's higher than 28 but lower than 32 then it sets it to a stone from the mod I'm making to form sort a crust around the sphere and randomly disperses ores.

then of course after that is done I set the data and write to the map. This process is faster than just using set_nodes in a for loop but still takes a toll mapgen and makes chunks generate very slow. I'm pretty new to this mapgen stuff so I'm sure there's stuff I'm doing wrong so I'm mainly looking for corrections or tips on how to speed this up.

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

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

by Skamiz Kazzarch » Post

For one, make sure to follow the advice in this thread: viewtopic.php?f=18&t=16043
For the other, since you don't care how far a position is from the center, only if it is more or less than another value, you don't need to use the square root for the comparation (since that is an expensive operation). Just compare 28^2 < x_distance^2 + y_distance^2 + z_distance^2 < 32^2.

User avatar
paramat
Developer
Posts: 3700
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

Linuxdirk wrote:
Tue Sep 15, 2020 21:29
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?
The heat and humidity noise values are in abstract units, central value (noise offset) 50, typical variation (noise scale) 50. So most variation is 0 to 100, but the most extreme values possible are (with default noise parameters) -37.5 and 137.5. The more extreme values occur more rarely.

Some have commented how MT humidity is very approx similar to 'relative humidty', and how MT heat is very approx similar to that stupid imperial unit 'fahrenheit'.
But, it is best to not think of them like this as such comparisons are extremely approximate, and MT humidity can exceed the 0 to 100 range. Also of course, everyone outside the USA should avoid thinking in fahrenheit.

User avatar
Linuxdirk
Member
Posts: 3216
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:
Mon Oct 05, 2020 18:37
The heat and humidity noise values are in abstract units, central value (noise offset) 50, typical variation (noise scale) 50. So most variation is 0 to 100, but the most extreme values possible are (with default noise parameters) -37.5 and 137.5. The more extreme values occur more rarely.
Thanks for the clarification. I already digged into this a little. Not easy, man, not easy … :)

User avatar
AiTechEye
Member
Posts: 1000
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: Sweden

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

by AiTechEye » Post

im trying to add a biome with deep oceans, atleast -50, can i do that through register_biome or only register_on_generated?

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

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

by T6C » Post

I had a wild and crazy idea the other day when it came to mapgens and the amount of processing time a custom Lua generator would require. What if one were to create a custom, predetermined map? The mapgen would require no compute cycles at all, since the map is already generated. For example, say I downloaded all the GIS data for topography, terrain, etc. for Central Asia, and somehow (I have no idea how; this is a hypothetical) translated that into a map.sqlite file. Instead of needing to generate new chunks as the player explores, Minetest would simply need to read the chunk data from the sqlite file.

Is this possible, or am I completely misunderstanding how the mapgens and chunk creation work?

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

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

by joe7575 » Post

This is a question of the world size.
If you tried to generate the whole world (62000 x 62000 x 62000 nodes), you would get a file that is 433 Tbytes in size.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests