Post your mapgen questions here (modding or engine)

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

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

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?
Attachments
screenshot_20181214_070326.png
(282 KiB) Not downloaded yet

R-One
Member
Posts: 156
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

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

by R-One » Post

Hello, I would like to know what is the maximum altitude of the lands generated by default by magen V7 ?

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

R-One the highest mountain i have found had a summit at y = 450.

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

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

by Skulls » Post

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.

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

> 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.

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

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

by Skulls » Post

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.

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

I agree the use of order should be documented, i'll put that on my TODO.

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

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.

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

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

by Skulls » Post

What would be the value if you wanted caves that were on average 10 blocks wide?

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

No idea, the value is abstract. Trial and error. I think the average width is close to 10 nodes already.

lilo
Member
Posts: 54
Joined: Sat May 27, 2017 14:45

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

by lilo » Post

Hi,

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

Greets

User avatar
Nathan.S
Member
Posts: 1003
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

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

by Nathan.S » Post

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.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

thediamondlego
New member
Posts: 1
Joined: Wed Mar 06, 2019 18:53
In-game: thediamondlego

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

by thediamondlego » Post

Is there a way to generate 1 node in every spot of the world(even replacing air)
vimitItM9ET2CwT2E2MPiHJMgOspdKs7

User avatar
Linuxdirk
Member
Posts: 2541
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

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?

ShadMOrdre
Member
Posts: 644
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

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
IMHO, it feels more natural at this scale.

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

User avatar
Linuxdirk
Member
Posts: 2541
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

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.

FaceDeer
Member
Posts: 464
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

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

by FaceDeer » Post

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.

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

> 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

User avatar
StarNinjas
Member
Posts: 324
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: aincrad

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

by StarNinjas » Post

Paramat is there a way to create highland pools (as in your mod) but that work well with mg7?

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

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

by Sokomine » Post

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
A list of my mods can be found here.

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

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

by Sokomine » Post

Screenshot of a reasonably well looking lake:
Image
Attachments
lake.jpg
(185.92 KiB) Not downloaded yet
A list of my mods can be found here.

User avatar
twoelk
Member
Posts: 1368
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

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

by twoelk » Post

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

ShadMOrdre
Member
Posts: 644
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

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


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

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

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

by Sokomine » Post

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.
A list of my mods can be found here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest