Page 22 of 34

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

Posted: Thu Dec 13, 2018 06:58
by paramat
ShadMOrdre,
There is no lua version of V7 or V5.
If you search my mods you will find a few lua mapgens that are quite good code examples.
I didn't know there was a lua version of Carpathian, best ask the mapgen creator 'demon_boy' in this thread viewtopic.php?f=9&t=17174

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

Posted: Fri Dec 14, 2018 08:35
by paramat
Image

Vadtec.
Currently experimenting. Imagine this is an entire MT world.
However, it's possible this will require MT 5.0.0-dev or later since it requires the new 'mgv7_mount_zero_level' parameter, without that it won't look as good as this.
What version of MT is this for, 0.4.16 / 0.4.17.1 or 5.0.0-dev?

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

Posted: Fri Dec 14, 2018 15:21
by R-One
Hello, I would like to know what is the maximum altitude of the lands generated by default by magen V7 ?

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

Posted: Sun Dec 16, 2018 06:03
by paramat
R-One the highest mountain i have found had a summit at y = 450.

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

Posted: Mon Jan 28, 2019 17:16
by Skulls
Is it possible to generate ores within ores?

For example, I could have an ore blob of "super hard stone" and within that I would want a chance of a scatter ore of diamond blocks.

This is basically my attempt at making the underground less uniform "stone".

Edit: it might work if I register the "inner ore" after the "outer ore". Maybe. Looks like the code loops through ores and checks per potential ore node placement if this is an okay block. So it might work something like this

"Outer" is a regular ore and can be found in default stone
"Inner" is an ore that can be found in "outer"
Outer ore generated as blob, code modifies vm->m_data
Inner ore generated, code checks vm->m_data for "outer", places it

So assuming that the ores are generated in order of them being registered it should work, but quite hacky.

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

Posted: Wed Jan 30, 2019 00:39
by paramat
> So assuming that the ores are generated in order of them being registered

They are.
So your method will work and is not hacky at all, it couldn't be any less hacky. It's intuitive.

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

Posted: Wed Jan 30, 2019 04:07
by Skulls
paramat wrote:So your method will work and is not hacky at all, it couldn't be any less hacky. It's intuitive.
Adding ores is very intuitive, depending on an unstated, implicit processing ordering is hacky. There is a ghost dependcy between ores. I'm still gunna do it though.

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

Posted: Wed Jan 30, 2019 19:15
by paramat
I agree the use of order should be documented, i'll put that on my TODO.

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

Posted: Thu Jan 31, 2019 23:52
by paramat
There have been some requests for how to disable the 'caves'/'cracks'/'tunnels' that intersect the surface in non-mgv6 mapgens.
For mgv7 add this to the minetest.conf file, or find the parameter in advanced settings:

Code: Select all

mgv7_cave_width = 1000
Yes larger values mean narrower caves.
All non-mgv6 mapgens have this parameter.

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

Posted: Fri Feb 01, 2019 00:05
by Skulls
What would be the value if you wanted caves that were on average 10 blocks wide?

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

Posted: Fri Feb 01, 2019 03:40
by paramat
No idea, the value is abstract. Trial and error. I think the average width is close to 10 nodes already.

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

Posted: Sun Feb 10, 2019 13:37
by lilo
Hi,

i want to use valleys as mapgenerator. How can i disable dungeons on this generator?

Greets

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

Posted: Sun Feb 10, 2019 20:36
by Nathan.S
lilo wrote:Hi,

i want to use valleys as mapgenerator. How can i disable dungeons on this generator?

Greets
You can set nodungeons in the mapgen flags. There are probably several ways to do that, but if you create a world and then browse to the save location you should be able to open the map_meta.txt file and find the mg_flags line and change dungeons to nodungeons, and this will prevent any more dungeons from being generated.

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

Posted: Thu Mar 07, 2019 09:39
by thediamondlego
Is there a way to generate 1 node in every spot of the world(even replacing air)

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

Posted: Thu Mar 07, 2019 10:21
by Linuxdirk
I wonder how to get the most out of mgv7. Floatlands? All decrations? Slightly more emphasized terrain, larger and deeper/longer caves, dungeons, valleys, rivers, etc. I know the documentation, but what are playtested values to create some really awesome terrain?

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

Posted: Thu Mar 07, 2019 15:14
by ShadMOrdre
LinuxDirk,

Such a loaded question... ;) I guess it really depends on what kind of play you are wanting.

I like to play with the settings in mgv7 way too much. It really distracts me from actually playing MT.

Here is a sample map_meta.txt file for a mgv7 world. I disable mountains, floatlands, caves, dungeons, and ridges. I then multiply mgv7_np_terrain_alt and mgv7_np_terrain_base scale and spread values by 4. I also alter the persistence and octave values for both. I modify the mgv7_np_terrain_persist spread, octave, and persistence values and reduce mgv7_np_height_select offset to -0.25 and scale to 1, and alter octave and persistence.

Previously, I've also modified mgv7_np_terrain_base seed to be the same as mgv7_np_terrain_alt, which I think actually blends base terrain with mountains. I've seen mountain peeks upwards of 400 meters with these settings, and this can be further increased by increasing mgv7_np_height_select octave.
Spoiler

Code: Select all

mgv7_np_cave2 = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 12
	spread = (67,67,67)
	seed = 10325
	octaves = 3
	persistence = 0.5
}
mgv7_np_cave1 = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 12
	spread = (61,61,61)
	seed = 52534
	octaves = 3
	persistence = 0.5
}
mgv7_np_cavern = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1
	spread = (384,128,384)
	seed = 723
	octaves = 5
	persistence = 0.63
}
mgv7_cave_width = 0.09
mg_biome_np_heat = {
	flags = defaults
	lacunarity = 2
	offset = 50
	scale = 50
	spread = (1000,1000,1000)
	seed = 5349
	octaves = 3
	persistence = 0.5
}
mgv7_lava_depth = -256
mgv7_np_mount_height = {
	flags = defaults
	lacunarity = 2
	offset = 256
	scale = 112
	spread = (1000,1000,1000)
	seed = 72449
	octaves = 3
	persistence = 0.6
}
mg_biome_np_humidity_blend = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1.5
	spread = (8,8,8)
	seed = 90003
	octaves = 2
	persistence = 1
}
mgv7_np_ridge = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1
	spread = (100,100,100)
	seed = 6467
	octaves = 4
	persistence = 0.75
}
mgv7_large_cave_depth = -33
mg_biome_np_humidity = {
	flags = defaults
	lacunarity = 2
	offset = 50
	scale = 50
	spread = (1000,1000,1000)
	seed = 842
	octaves = 3
	persistence = 0.5
}
mg_biome_np_heat_blend = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1.5
	spread = (8,8,8)
	seed = 13
	octaves = 2
	persistence = 1
}
mgv7_floatland_level = 1280
mgv7_np_terrain_base = {
	flags = defaults
	lacunarity = 2
	offset = -4
	scale = 400
	spread = (2400,2400,2400)
	seed = 82341
	octaves = 8
	persistence = 0.3
}
mgv7_np_float_base_height = {
	flags = defaults
	lacunarity = 2
	offset = 48
	scale = 24
	spread = (300,300,300)
	seed = 907
	octaves = 4
	persistence = 0.7
}
seed = 16096304901732432682
water_level = 1
mapgen_limit = 31000
mg_name = v7
mgv7_cavern_threshold = 0.7
mgv7_dungeon_ymin = -31000
chunksize = 5
mg_flags = nocaves, nodungeons, light, decorations, biomes
mgv7_np_height_select = {
	flags = defaults
	lacunarity = 2
	offset = -0.25
	scale = 1
	spread = (500,500,500)
	seed = 4213
	octaves = 4
	persistence = 0.4
}
mgv7_np_mountain = {
	flags = defaults
	lacunarity = 2
	offset = -0.6
	scale = 1
	spread = (250,350,250)
	seed = 5333
	octaves = 5
	persistence = 0.63
}
mgv7_shadow_limit = 1024
mgv7_float_mount_height = 128
mgv7_float_mount_exponent = 0.75
mgv7_np_terrain_persist = {
	flags = defaults
	lacunarity = 2
	offset = 0.6
	scale = 0.1
	spread = (1200,1200,1200)
	seed = 539
	octaves = 2
	persistence = 0.3
}
mgv7_cavern_limit = -256
mgv7_cavern_taper = 256
mgv7_dungeon_ymax = 31000
mgv7_float_mount_density = 0.6
mgv7_np_terrain_alt = {
	flags = defaults
	lacunarity = 2
	offset = -4
	scale = 100
	spread = (2400,2400,2400)
	seed = 5934
	octaves = 6
	persistence = 0.6
}
mgv7_spflags = nomountains, noridges, nofloatlands, nocaverns
mgv7_np_filler_depth = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1.2
	spread = (150,150,150)
	seed = 261
	octaves = 3
	persistence = 0.7
}
mgv7_mount_zero_level = 0
mgv7_np_ridge_uwater = {
	flags = defaults
	lacunarity = 2
	offset = 0
	scale = 1
	spread = (1000,1000,1000)
	seed = 85039
	octaves = 5
	persistence = 0.6
}
mgv7_np_floatland_base = {
	flags = defaults
	lacunarity = 2
	offset = -0.6
	scale = 1.5
	spread = (600,600,600)
	seed = 114
	octaves = 5
	persistence = 0.6
}
[end_of_params]
IMHO, it feels more natural at this scale.

Shad

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

Posted: Fri Mar 08, 2019 07:07
by Linuxdirk
ShadMOrdre wrote:I guess it really depends on what kind of play you are wanting.
Something that is fun to explore over and under ground. Large and fascinating mountains with overhangs, floating islands high up in the sky. But still "playable" and not just a voxel terrain wallpaper generator like carpathian. I want long and deep caves (hundreds and hundreds of nodes) with giant halls where the ceiling is not loaded when standing on ground, rivers and crevices, deep large oceans, complex dungeons, etc.

Just something that is awesome at first look but is still playable at second look.

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

Posted: Fri Mar 08, 2019 16:10
by FaceDeer
Linuxdirk wrote:I want long and deep caves (hundreds and hundreds of nodes) with giant halls where the ceiling is not loaded when standing on ground
If I may take this opportunity to toot my own horn slightly with a mod recommendation, I wrote dfcaverns to provide this sort of thing. Tried to add lots of variety and interesting places to discover underground.

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

Posted: Sun Mar 10, 2019 08:54
by paramat
> Is there a way to generate 1 node in every spot of the world(even replacing air)

Yes, use the 'singlenode' mapgen with a mod that sets the singlenode mapgen alias to your desired node, see https://github.com/minetest/minetest/bl ... i.txt#L353

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

Posted: Sun Mar 10, 2019 22:31
by StarNinjas
Paramat is there a way to create highland pools (as in your mod) but that work well with mg7?

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

Posted: Mon Mar 11, 2019 12:33
by Sokomine
StarNinjas wrote: Paramat is there a way to create highland pools (as in your mod) but that work well with mg7?
I love those highlandpools as well and experimented some time ago with them. All it takes is a mapgen with support for the heightmap (mg7 ought to work) and a node to fill your lakes with.

The detection of the extensions of the lake is not always perfect. That doesn't matter too much as a bit of floating water may sometimes even look good.

Not all potential holes can be detected and filled. A lake will not cross over a mapchunk border as the lake detection is based on the hightmap - which is only available for the mapchunk.

Currently, every hole there is, no matter how tiny or deep or in which biome, is filled. This does not always give the results you might wish for. Lake after lake in the desert may not be what you expect. Neither may be lakes in cold areas where all ought to have frozen over.

Trees and plants are not actively removed. No plants are placed.

All this taken together, you can see this as an experiment and try it out in a new world. Might even be fun to use default:lava_source as a lake material (easier to see them that way). But for any real usage, there'd have to be more decoration and thought added.

See here: https://github.com/Sokomine/lakes.git

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

Posted: Mon Mar 11, 2019 12:37
by Sokomine
Screenshot of a reasonably well looking lake:
Image

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

Posted: Mon Mar 11, 2019 14:39
by twoelk
Sokomine wrote: ...
Lake after lake in the desert may not be what you expect.
...
and yet they exist like for example in the southern Rub al Khali near the borders of Oman and Saudi Arabia.
picone, pictwo

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

Posted: Mon Mar 11, 2019 16:59
by ShadMOrdre
I've had some luck putting lakes in mgv7 using the bergsee mod from the OCD game.

I added to this mod, and can successfully put not just lakes of water, but lava, quicksand, and others. After checking for holes in the current chunk, the code tests for the type of ground node, and paces the appropriate "liquid".

Here's the code for it, a self contained init.lua file. I call my version, lib_lakes. I have not posted this in the forums or github. My version depends on my lib_materials mod, but you can use any ground type node, based on the game you are playing.

The license is GPLv3, as per Bas080

Code: Select all

--[[
	1. We choose a random position in the same way plants are placed. That's the root for our lake.
	2. From there we go lx in the x direction and lz in the z direction. That gives us a rectangle.
	3. We check the sides of the rectangle for air and itterate down until the rectangle is closed.
	4. Now we repeat this itteration, but search for the opposite, not for solid nodes but for air.
	5. As soon as we found the lower limit, we check if the bottom is sealed. Now we have some jar.
	6. Now as we made sure no water can escape we can replace all air inside the volume with water.
--]]

lib_lakes = {}

local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_water = minetest.get_content_id("default:water_source")
local c_ice = minetest.get_content_id("default:ice")
local c_murky = minetest.get_content_id("lib_materials:murky_river_water_source")
local c_muddy = minetest.get_content_id("lib_materials:muddy_river_water_source")
local c_dirty = minetest.get_content_id("lib_materials:dirty_water_source")
local c_quick_source = minetest.get_content_id("lib_materials:quicksand_source")
local c_quick = minetest.get_content_id("lib_materials:quicksand")
local c_fluid_id

--
-- Find position
--

minetest.register_on_generated(function(minp, maxp, seed)
	if maxp.y <= 1024 and minp.y >= -32 then
		local perlin1 = minetest.get_perlin(318, 3, 0.6, 100)
		-- Lua Voxel Machine
		local vm = minetest.get_voxel_manip()
		local vm_minp, vm_maxp = vm:read_from_map({x=minp.x, y=minp.y, z=minp.z-16}, {x=maxp.x+16, y=maxp.y+16, z=maxp.z+16})
		local a = VoxelArea:new{MinEdge=vm_minp, MaxEdge=vm_maxp}
		local data = vm:get_data()
		-- Assume X and Z lengths are equal
		local divlen = 32
		local divs = (maxp.x-minp.x)/divlen+1;
		for divx=0,divs-1 do
		for divz=0,divs-1 do
			local x0 = minp.x + math.floor((divx+0)*divlen)
			local z0 = minp.z + math.floor((divz+0)*divlen)
			local x1 = minp.x + math.floor((divx+1)*divlen)
			local z1 = minp.z + math.floor((divz+1)*divlen)
			-- Determine amount from perlin noise
			local amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 10)
			-- Find random positions based on this random
			local pr = PseudoRandom(seed+486)
			for i=0,amount do
				local x = pr:next(x0, x1)
				local z = pr:next(z0, z1)
				local ground_y = nil
				-- Prevent from starting underground
				local nn = minetest.get_node({x=x,y=maxp.y,z=z}).name
				if nn ~= "air" and nn ~= "ignore" then
					return
				end
				-- Find groundlevel
				for y=maxp.y,minp.y,-1 do
					local nn = minetest.get_node({x=x,y=y,z=z}).name
					if nn ~= "air" and nn~= "ignore" then
						local is_leaves = minetest.registered_nodes[nn].groups.leaves
						if is_leaves == nil or is_leaves == 0 then
							ground_y = y
							break
						end
					end
				end
				if ground_y and ground_y >= 2 then
					local p = {x=x,y=ground_y,z=z}
					local ground_name = minetest.get_node(p)
					local node_name = minetest.get_node(p).name
					if ground_name == "default:water_source" then return end
					local lx = pr:next(10,30)
					local lz = pr:next(10,30)
					if string.match(node_name, "lib_materials:sand") then
						c_fluid_id = c_quick_source
					end
					if string.match(node_name, "lib_materials:dirt_sandy") then
						c_fluid_id = c_quick
					end
					if string.match(node_name, "rainforest") then
						c_fluid_id = c_murky
					end
					if string.match(node_name, "with_brown") then
						c_fluid_id = c_muddy
					end
					if string.match(node_name, "with_dry") then
						c_fluid_id = c_muddy
					end
					if string.match(node_name, "with_grass") then
						c_fluid_id = c_dirty
					end
					if string.match(node_name, "coniferous") then
						c_fluid_id = c_dirty
					end
					if string.match(node_name, "with_snow") then
						c_fluid_id = c_ice
					end
					if ground_y >= 120 then
						c_fluid_id = c_ice
					end
					-- if c_water == "" then
					
					-- else
						-- c_water = minetest.get_content_id("default:river_water_source")
					-- end
					lib_lakes.fill(data, a, p, lx, lz)
					--c_fluid_id = ""
				end
				
			end
		end
		end
		-- Write to map
		vm:set_data(data)
		vm:write_to_map(data)
		vm:update_map()
	end
end)

--
-- Make lake
--

-- TODO: combine functions into one
local function check_x(data, a, x, y, z, lx, lz)
	for xi = 0, lx do
		local vi = a:index(x+xi, y, z)
		if data[vi] == c_air or data[vi] == c_ignore then
			return true
		end
		local vii = a:index(x+xi, y, z+lz)
		if data[vii] == c_air or data[vii] == c_ignore then
			return true
		end
	end
end

local function check_z(data, a, x, y, z, lx, lz)
	for zi = 0, lz do
		local vi = a:index(x, y, z+zi)
		if data[vi] == c_air or data[vi] == c_ignore then
			return true
		end
		local vii = a:index(x+lx, y, z+zi)
		if data[vii] == c_air or data[vii] == c_ignore then
			return true
		end
	end
end

local function leak(data, a, j, lx, lz)
	for xi = 0, lx do
	for zi = 0, lz do
		local vi = a:index(xi, -j, zi)
		if data[vi] == c_air or data[vi] == c_ignore then
			return true
		end
	end
	end
end

function lib_lakes.fill(data, a, pos, lx, lz)
	local x, y, z = pos.x, pos.y, pos.z
	local water_a = VoxelArea:new{MinEdge={x=0, y=-32, z=0}, MaxEdge={x=lx, y=0, z=lz}}
	local water_buffer = {}
	-- Find upper start
	local i = 0
	while i <= 16 do
		if check_x(data, a, x, y-i, z, lx, lz) or check_z(data, a, x, y-i, z, lx, lz) then
			i = i + 1
		else
			break
		end
	end
	if i >= 16 then return end
	-- Itterate downwards
	local j = i
	while j <= (i+16) do
		if check_x(data, a, x, y-j, z, lx, lz) or check_z(data, a, x, y-j, z, lx, lz) then
			j = j - 1
			break
		else
			j = j + 1
		end
	end
	if j >= i+16 then return end
--	print ('[lib_lakes] i = '.. i ..'')
--	print ('[lib_lakes] j = '.. j ..'')
	-- Check bottom
	if leak(data, a, j, lx, lz) then return end
	-- Add volume to buffer
	for xi = 0, lx do
	for yi = -i, -j, -1 do
	for zi = 0, lz do
		water_buffer[water_a:index(xi, yi, zi)] = true
	end
	end
	end
	-- Add the water
	for xi = water_a.MinEdge.x, water_a.MaxEdge.x do
	for yi = water_a.MinEdge.y, water_a.MaxEdge.y do
	for zi = water_a.MinEdge.z, water_a.MaxEdge.z do
		if a:contains(x+xi, y+yi, z+zi) then
			local vi = a:index(x+xi, y+yi, z+zi)
			if data[vi] == c_air or data[vi] == c_ignore then
				if water_buffer[water_a:index(xi, yi, zi)] then
					data[vi] = c_fluid_id
--					print ('[lib_lakes] Wasser auf (' .. x+xi .. ',' .. y+yi .. ',' .. z+zi .. ')')
				end
			end
		end
	end
	end
	end
end



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

Posted: Mon Mar 11, 2019 19:30
by Sokomine
ShadMOrdre wrote: I added to this mod, and can successfully put not just lakes of water, but lava, quicksand, and others. After checking for holes in the current chunk, the code tests for the type of ground node, and paces the appropriate "liquid".
My code can be extended to place other liquids as well - even based on surface and volume of the potential lake.

Your algorithm works diffrently. Mine doesn't even use VoxelManip. The heightmap is read (which is very fast), analyzed for potential lakes (still pretty fast) - and the fill node placed at the lakes' surface via set_node(..) (faster for small amounts of nodes). For lager lakes, VoxelManip would be better.

Currently, each detected hole is turned into a lake. For a real mod, it ought to be much better to just create some lakes and ignore other holes.

Might be intresting to see what performs better.