Post your mapgen questions here (modding or engine)

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

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

by burli » Post

Ok, let's make an example with biomes in Minetest. Each biome is represented by a 2d coordinate

How do I define the coordinates to get well balanced biomes? Try and error? Is there a (Linux) tool that visualise the diagram?

If I register a tree Minetest just gets the coordinate of the biome. If the mapgen wants to place a tree he sends the tree coordinate to the (built-in) voronoi algorithm and gets the biome as result back.

Is that correct so far?

User avatar
qwertymine3
Member
Posts: 202
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

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

by qwertymine3 » Post

burli wrote:Ok, let's make an example with biomes in Minetest. Each biome is represented by a 2d coordinate

How do I define the coordinates to get well balanced biomes? Try and error? Is there a (Linux) tool that visualise the diagram?
I'm not an expert on balancing biomes in this way, but Gael de Sailly used GeoGebra (web app and native app for linux), to create a voronoi diagram for his experimental 30 biomes mod.
Avatar by :devnko-ennekappao:

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

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

by burli » Post

qwertymine3 wrote:
burli wrote:Ok, let's make an example with biomes in Minetest. Each biome is represented by a 2d coordinate

How do I define the coordinates to get well balanced biomes? Try and error? Is there a (Linux) tool that visualise the diagram?
I'm not an expert on balancing biomes in this way, but Gael de Sailly used GeoGebra (web app and native app for linux), to create a voronoi diagram for his experimental 30 biomes mod.
I found GeoGebra, but I have no idea how to create Voronoi diargams in this program. I hope he reads here and can make a little tutorial. Because everything I found yet was not in english. I installed GeoGebra and I see that I can move these points, but I have no idea how to start from scratch

Edit: got it, but not as he does. Some help would still be nice

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

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

by burli » Post

v5 is currently my favorite mapgen. I tinker around with noise parameters and found a setting with much less floating islands and still fancy mountains. I prefere settings with higher lacunarity and lower persistence and I disabled eased, cause this causes these fancy blobs that I don't like

Image

here is the full map_meta.txt for reference. But I just changed mgv5_np_ground

Code: Select all

chunksize = 5
mg_biome_np_heat = {
	flags = defaults
	lacunarity = 2
	octaves = 3
	offset = 50
	persistence = 0.5
	scale = 50
	seed = 5349
	spread = (750,750,750)
}
mg_biome_np_heat_blend = {
	flags = defaults
	lacunarity = 2
	octaves = 2
	offset = 0
	persistence = 1
	scale = 1.5
	seed = 13
	spread = (8,8,8)
}
mg_biome_np_humidity = {
	flags = defaults
	lacunarity = 2
	octaves = 3
	offset = 50
	persistence = 0.5
	scale = 50
	seed = 842
	spread = (750,750,750)
}
mg_biome_np_humidity_blend = {
	flags = defaults
	lacunarity = 2
	octaves = 2
	offset = 0
	persistence = 1
	scale = 1.5
	seed = 90003
	spread = (8,8,8)
}
mg_flags = nocaves, nodungeons, light, decorations
mg_name = v5
mgv5_cave_width = 0.125
mgv5_np_cave1 = {
	flags = defaults
	lacunarity = 2
	octaves = 4
	offset = 0
	persistence = 0.5
	scale = 12
	seed = 52534
	spread = (50,50,50)
}
mgv5_np_cave2 = {
	flags = defaults
	lacunarity = 2
	octaves = 4
	offset = 0
	persistence = 0.5
	scale = 12
	seed = 10325
	spread = (50,50,50)
}
mgv5_np_factor = {
	flags = defaults
	lacunarity = 2
	octaves = 3
	offset = 0
	persistence = 0.45
	scale = 1
	seed = 920381
	spread = (250,250,250)
}
mgv5_np_filler_depth = {
	flags = defaults
	lacunarity = 2
	octaves = 4
	offset = 0
	persistence = 0.7
	scale = 1
	seed = 261
	spread = (150,150,150)
}
mgv5_np_ground = {
	flags = defaults
	lacunarity = 3
	octaves = 4
	offset = 15
	persistence = 0.25
	scale = 40
	seed = 983240
	spread = (80,80,80)
}
mgv5_np_height = {
	flags = defaults
	lacunarity = 2
	octaves = 4
	offset = 0
	persistence = 0.5
	scale = 10
	seed = 84174
	spread = (250,250,250)
}
mgv5_spflags = 
seed = 10451164194390179830
water_level = 1
[end_of_params]
Attachments
screenshot_20160822_153359.jpg
(287.16 KiB) Not downloaded yet

User avatar
azekill_DIABLO
Member
Posts: 7494
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

Image

nice! but i got some but with too big values.
Attachments
screenshot_20160822_181013.png
(864.55 KiB) Not downloaded yet

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

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

by burli » Post

It is impossible to remove all floating islands in v5. All you can do is reduce lacunarity and persistence to really low values, but then you have boring hills

Edit: and even that doesn't help. That's the nature of the v5 mg

User avatar
Sokomine
Member
Posts: 4017
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

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

by Sokomine » Post

burli wrote: Of course can I avoid trees, but it is just easier if you have a "village biome"
In a way that's what nores mg mapgen did: Add some noise and superimpose a village biome, or rather: a function that provides distinction between is-inside-village/is-not-inside-village. My mg_villages mod uses this mechanism provided by nore.
burli wrote: Needed 30 seconds to find an example in BrunoMine's mod. That can always happen if you place trees first
Such things can always happen. I go to considerable effort to remove anything tree-like inside my villages before the first house is placed. Paramat created the code for the terrain blending at the borders of each village. Any trees found there are located, removed, their positions remembered, and afterwards new saplings/trees are placed at the new hight. But even with that much effort in place, there will still be errors and oddities now and then.
duane wrote: Yes, it's going to take more CPU time, but if you're doing any modifications via voxelmanip, you've already spent most of that time.
That's right. Unless you screw up badly in your code. reading the voxelarea data and writing it back takes a significant amount of time compared to all the rest that's done inside the area.
duane wrote: If I were really clever, I'd write the basics (or steal them from valleys) with single node setting and overload the voxelmanip functions so that all other mods worked through my framework, so that data was only read and written once, and lighting and liquid calculations happened once at the end of the process. Cut the C mapgens out altogether!
All other mods working through the framework, so that the voxelmanip area data needs to be read and written only once? That is very tempting. It might speed some things up considerably. Having a chain of mods that get mapgen data passed on, which then do their work on it, and liquid and lighting update done just at the very end...that could be very helpful.
burli wrote: I is impossible to remove all floating islands in v5. All you can do is reduce lacunarity and persistence to really low values, but then you have boring hills

Edit: and even that doesn't help. That's the nature of the v5 mg
That's why I like other mapgens more. More realistic terrain, less floating mountains, better terrain to build on. My villages also aren't particulary happy if mountains get too high as I don't apply the generator to all mapchunks in height; mapchunks which will not get a village (too deep or too high) aren't touched at all in order to speed things up.
A list of my mods can be found here.

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

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

by burli » Post

Sokomine wrote:
duane wrote: If I were really clever, I'd write the basics (or steal them from valleys) with single node setting and overload the voxelmanip functions so that all other mods worked through my framework, so that data was only read and written once, and lighting and liquid calculations happened once at the end of the process. Cut the C mapgens out altogether!
All other mods working through the framework, so that the voxelmanip area data needs to be read and written only once? That is very tempting. It might speed some things up considerably. Having a chain of mods that get mapgen data passed on, which then do their work on it, and liquid and lighting update done just at the very end...that could be very helpful.
I had a similar idea. I opend an issue on github for a "mapgen API". Currently all mapgens are hard coded. My idea was, that all functions of a mapgen (terrain, biomes, caves, decoration...) are registered in a table and it should be possible to add or remove any part of the mapgen. The mapgen runs through the table and calls each function, no matter if C++ or Lua. But this would mean that each lua mod has to load the VoxelManip. This could only be eliminated if the mapgen is completely written in lua.

That's why I like other mapgens more. More realistic terrain, less floating mountains, better terrain to build on.
With my changes v5 isn't that bad. There are still floating islands, but much less than before. And there are also relative flat areas.

But to be honest there is no mapgen that really fits my expectations. I will use my modified v5 mapgen for my next experiments with biomes. Apart from the floating islands v5 has some nice landscapes

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

> How do I define the coordinates to get well balanced biomes? Try and error? Is there a (Linux) tool that visualise the diagram?

It's tough work i'm doing right now, i'm intending to use GeoGebra but currently i draw the points on graph paper and draw the equidistant lines by hand. For every pair of points draw the line that is halfway between, these lines define the edges of the voronoi 'cells'.
More info here viewtopic.php?f=47&t=11603

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


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

GeoGebra

Click 'move graphics view' button, click and drag axes and mouse wheel to zoom out until -20 to 120 is shown on both axes.
Options > point capturing [off].
Options > rounding [0 decimal places]. All point co-ordinates will snap to nearest integer.
Click 'new point' button.
Click on the graphics view to place a point, then click and drag point while watching co-ordinates.
Repeat for all biome points.
In the 'input' command line type "{A,B,C, ..}" then [enter] to combine points into a group, "list1" should appear on the left.
Type "Voronoi[list1]" [enter].
Cick and move points as desired.
To print the graphics view: File > export > graphics view as picture (png).
Unselect 'transparent' box, reset 'scale' as desired then [save].

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

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

by burli » Post

Thanks. Meanwhile I was able to make a diagram, but I had some extra steps to create a list.

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

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

by burli » Post

Maybe someone find this useful. This is the most simple Lua mapgen. Just generates stone and water

And maybe someone can replace the example in the get_perlin_map Wiki page. It does not work. I need a while until I found that get2dMap_flat doesn't want 3d coordinates

Code: Select all

minetest.set_mapgen_params({mgname="singlenode"})

minetest.register_on_generated(function(minp, maxp, seed)

	local c_stone = minetest.get_content_id("default:stone")
	local c_water = minetest.get_content_id("default:water_source")
	local c_air = minetest.get_content_id("air")
	local c_ignore = minetest.get_content_id("ignore")

	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local data = vm:get_data()
	local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
	local csize = vector.add(vector.subtract(maxp, minp), 1)

	local write = false

	local noise_1 = minetest.get_perlin_map({offset = 5, 
												  scale = 15, 
												  seed = 1234, 
												  spread = {x = 250, y = 250, z = 250}, 
												  octaves = 5, 
												  persist = 0.6, 
												  lacunarity = 2,
												  flags = "defaults"}, 
												  csize):get2dMap_flat({x=minp.x, y=minp.z})	
	local index2d = 0
	for z = minp.z, maxp.z do
	for y = minp.y, maxp.y do
	for x = minp.x, maxp.x do
			
		index2d = (z - minp.z) * csize.x + (x - minp.x) + 1	
		local ivm = a:index(x, y, z)

		if y < noise_1[index2d] then
			data[ivm] = c_stone
			write = true
		elseif y > noise_1[index2d] and y < 1 then
			data[ivm] = c_water
			write = true
		end
	end
	end
	end

	if write then
		vm:set_data(data)
		vm:set_lighting({day = 0, night = 0})
		vm:calc_lighting()
		vm:update_liquids()
		vm:write_to_map()
	end

end
Image
Attachments
screenshot_20160828_160846.jpg
(177.63 KiB) Not downloaded yet

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

You can speed that up by setting 'mg_flags = nolight' and removing 'vm:set_lighting({day = 0, night = 0})'
But you will need to 'write' in all mapchunks.
Also, the 'csize' used in 'get perlinmap' should have it's z component set to 1, otherwise you can end up using 80 times more data.
Perhaps i need to write another super-simple example mapgen.

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

This is an IRC chat with hmmmm that is useful information about 'noise flags':

///////////////////

<hmmmm> leave flags blank for noise just like you're used to, eased/non-eased is determined by the type of noise it's being used for
<hmmmm> 2d noise uses eased by default
<hmmmm> 3d noise uses non-eased by default
<hmmmm> this is needed for backwards compatibility
<hmmmm> if you want to do something a little different though... you need to specify the flags field
<hmmmm> 2d noise with the "eased" flag does nothing really because it's already eased by default
<paramat> 2d noise has always been eased then?
<hmmmm> yup
<hmmmm> if you specify "noeased" though, or just have the flags field present without "eased" present, it'll disable easing on 2d noise
<hmmmm> if you specify "eased" on 3d noise, it'll ease your 3d noise
<hmmmm> if you specify "noeased" on 3d noise or leave nothing at all, it'll be regular 3d noise
<hmmmm> let's say you want absolute noise but you don't want to specify eased or not eased
<hmmmm> you'd specify defaults instead
<hmmmm> flags = "defaults, absvalue" would make the noise eased or not eased based on if it's being used for 2d or 3d noise

///////////////////

'easing' is a 'smoothing' of noise, the lack of eased 3D noise in mgv7 is what creates the gridlike effect and spikyness, especially noticeable on a map overview.
Mgv5 3D noise is 'eased' so is smooth and blobby.

'absvalue' uses the absolute value of each octave of noise before combining them.
Combined with eased noise it tends to create convex forms, it looks 'bubbly' like a cumulus cloud.
Combined with uneased noise creates mountainlike forms almost like intersecting pyramids.

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

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

by burli » Post

Thanks for explaining. I know that my example is not perfect. It is just an experiment. And I have the problem that mountains are cut at y=47. Don't know why until now

User avatar
duane
Member
Posts: 1612
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

paramat wrote:Also, the 'csize' used in 'get perlinmap' should have it's z component set to 1, otherwise you can end up using 80 times more data.
Perhaps i need to write another super-simple example mapgen.
Set to one or set to nil?
Believe in people and you don't need to believe anything else.

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

1 according to hmmmm a while back, however i seem to remember the noise code is now more robust so nil is probably fine.

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

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

by burli » Post

How is the VoxelManip data array organized? Where is the start corner? In which axis does it move if I add 1? Does it include the overgrow area?

Edit: I think I got it. Index 0 of the array starts at minp - 16 (for x, y and z), aka emin. It grows in +X direction. Next row starts at emin.y + 1. Index for minp is 202513

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

Correct. The lua voxelmanip always also contains a mapblock-deep 'shell' around the mapchunk, whatever size the mapchunk is.
Along the x row, then through x rows stacked above progressing in the y direction, then through the x-y planes progressing in the z direction.

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

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

by burli » Post

Is it always necessary to load the the full shell? A lot of mods only need the actual chunk.

A chunk has 512000 nodes, with shell it is 1,4 million. Nearly three times

Wouldn't it speed up a lot of mods if they only had to deal with the current chunk size? Optional of course

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

The 'mapgen object voxelmanip' is actually the core mapgen's own voxel manipulator in the state immediately after core mapgen finishes, so there's no reading of the map involved and not necessarily any disadvantage in having the whole volume passed to the lua voxelmanip. Trimming off the shell might even slow things down. A smaller LVM might save on lua memory though.

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

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

by burli » Post

paramat wrote:Trimming off the shell might even slow things down.
The question is, how much and does it save time at light and liquid update
paramat wrote:A smaller LVM might save on lua memory though.
Maybe another reason to think about that

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

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

by burli » Post

Found a nice video that explains perlin noise with lacunarity and persistence

https://youtu.be/wbpMiKiSKm8

User avatar
BrandonReese
Member
Posts: 839
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese
Location: USA

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

by BrandonReese » Post

Mapgen V7 Parameters

I use mgv7 and I really like it, I have adjusted the noise params because I want large biomes and tall mountains. Despite having no real idea what the numbers mean I have somewhat achieved that but I wonder if anybody who knows what the numbers mean could help me tweak it. The biomes are pretty well large enough for me, and the mountains will get above 300 nodes tall although it's quite rare. But the mountains tend to be pretty narrow in either the x or z direction. So you may have a mountain 100 or 150 nodes wide in one direction and half that at the base in the other direction. I didn't know if anything could be done about that to make more natural feeling mountains.

Here are some screenshots http://imgur.com/a/82iMk

These are my current parameters.

Code: Select all

mgv7_np_terrain_base = 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
mgv7_np_terrain_alt = 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
mgv7_np_terrain_persist = 0.6, 0.12, (2000, 2000, 2000), 539, 3, 0.5, 2.0
mgv7_np_height_select = -12, 24, (500, 500, 500), 4213, 6, 0.69, 2.0
mgv7_np_filler_depth = 0, 1.2, (150, 150, 150), 261, 4, 0.7, 2.0
mgv7_np_mount_height = 675, 350, (3000, 2000, 3000), 72449, 3, 0.5, 2.0
mgv7_np_ridge_uwater = 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0
mgv7_np_mountain = -0.6, 1, (850, 1450, 850), 5333, 5, 0.68, 2.0
mgv7_np_ridge = 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0
mgv7_np_cave1 = 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0
mgv7_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest