Post your Screenshots of Terrain!

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Post your Screenshots of Terrain!

by firefox » Post

Skamiz Kazzarch wrote:
Fri Aug 13, 2021 14:55
Image
Image
Image
looks like a map from a SNES game turned 3d. amazing :D
✨🏳️‍🌈♣️✨

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

Thank you.
Trying my hand at non-organic mapgens. It's going... not all that well. Thinking about using runtime generated schematics.
Image
Image
Attachments
fortress_005.png
fortress_005.png (910.88 KiB) Viewed 16386 times
fortress_004.png
fortress_004.png (872.02 KiB) Viewed 16386 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

Image
Attachments
fortress_006.png
fortress_006.png (925.61 KiB) Viewed 16386 times

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: Post your Screenshots of Terrain!

by ShadMOrdre » Post

I don't think you'll get results like this with schematics, although, having never tested the idea, it would be nice to know.

These structures are attractive. Perhaps less as a building, and more like a platform, on which to then place a schem building.

Consider these villages,
Image
with better landscaped terrain, to more realistically portray the buildup of settled areas. Also, it might make it very easy to then determine city walls.

Can you reduce the code that actually generates the structures into a function that can be called by other lua mapgens?


PS. Still wondering if you'd share your code for the voronoi like mapgen you previously posted, and now, also this code?
Attachments
screenshot_20210623_141239.png
screenshot_20210623_141239.png (981.09 KiB) Viewed 16386 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

The previous screenshot actually already uses schematics. They are generated at startup, because I am designing this from ground up so that the sizes of the pieces are configurable. Otherwise I could just build a bunch of schematics by hand and worry only about placing them, which would, admittedly, save me some effort on the mapgen front.
Image

I don't think it would be prohibitively difficult to generate only section of this on demand and even have an idea of how to go about it. Generating a castle on a hilltop would sure look impressive. But I still expect to do some mayor rewriting of how the generation works, so it's not something I want to invest time in yet.

The Minetest community has soured me on sharing code 'just because', so it would make me very happy if you could show off something you made of/with it. (Even if it's just different node palletes or changing the noise params.(Though I wouldn't be opposed if you figure out something more interesting to do with it. (Flood the world, make the floor lava, turn the orderly structures into ruins, etc... (Basically: I want cool pics as payment.))))

The files are ripped from my general mapgen-dev mod, but I believe all you need to get them working is to drop them in any mod, dofile the 'procedural_fortress.lua' and address a few things I marked with 'TODO'.
Attachments
procedural_fortress.zip
(2.93 KiB) Downloaded 136 times
fortress_007.png
fortress_007.png (449.01 KiB) Viewed 16386 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

Fourth iteration. Sections can be sized arbitrarily, instead of having to be divisors for 80.
Image

edit:
Diagonals now can go over several height levels and look clean at the bottom.
Image

edit:
Finally getting to some new content instead of constant rewriting.
Image
The tunnels are a bit overenthusiastic in placement right now, which works with the cramped parameters I have currently set, but will need to be curtailed in more spread out conditions to prevent them from being placed in places where you can just as easily go around.
Attachments
fortress_010.png
fortress_010.png (557.21 KiB) Viewed 16386 times
fortress_009.png
fortress_009.png (829.6 KiB) Viewed 16386 times
fortress_008.png
fortress_008.png (247 KiB) Viewed 16386 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_001.png
cae_001.png (860.36 KiB) Viewed 16300 times
cae_002.png
cae_002.png (855.91 KiB) Viewed 16300 times
cae_003.png
cae_003.png (936.82 KiB) Viewed 16300 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_004.png
cae_004.png (800.35 KiB) Viewed 16299 times
cae_005.png
cae_005.png (932.54 KiB) Viewed 16299 times
cae_006.png
cae_006.png (917.45 KiB) Viewed 16299 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_007.png
cae_007.png (916.27 KiB) Viewed 16268 times
cae_008.png
cae_008.png (939.83 KiB) Viewed 16268 times
cae_009.png
cae_009.png (825.57 KiB) Viewed 16268 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_010.png
cae_010.png (361.09 KiB) Viewed 16247 times
cae_011.png
cae_011.png (945.42 KiB) Viewed 16247 times
cae_012.png
cae_012.png (808.7 KiB) Viewed 16247 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_013.png
cae_013.png (542.48 KiB) Viewed 16224 times
Alright, since I don't feel aggravated about licenses and copyright right now, you get to have the code this time.
You will need this mod: viewtopic.php?f=9&t=27883

Code: Select all

--[[
Copyright (c) 2022 Skamiz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
local c_air = minetest.CONTENT_AIR
local c_dirt = minetest.get_content_id("cicrev:silt")
local c_grass = minetest.get_content_id("cicrev:silt_with_fungus")
local c_stone = minetest.get_content_id("df_stones:rhyolite")
local c_intrude = minetest.get_content_id("cicrev:clay")

minetest.set_mapgen_setting("water_level", "0", true)


local depth = 25
local surface_limit = 0.2
local botom_limit = 0.15


local function lerp(a, b, ratio)
	return (a * (1 - ratio)) + (b * ratio)
end



--noise parameters
np_2d_base = {
    offset = 0,
    scale = 5,
    spread = {x = 80, y = 80, z = 80},
    seed = 0,
    octaves = 3,
    persist = 0.5,
    lacunarity = 3,
	-- flags = "noeased",
}
np_2d_crag = {
    offset = 0,
    scale = 1,
    spread = {x = 40, y = 40, z = 40},
    seed = 1,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
	flags = "absvalue",
}
np_3d_intrude = {
    offset = 0,
    scale = 1,
    spread = {x = 30, y = 30, z = 30},
    seed = 0,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
    flags = "absvalue",
}

local side_lenght = 80
local chunk_size = {x = 80, y = 80, z = 80}
local chunk_area = VoxelArea:new{MinEdge={x = 1, y = 1, z = 1}, MaxEdge=chunk_size}

local nobj_2d_b = noise_handler.get_noise_object(np_2d_base, chunk_size)
local nobj_2d_c = noise_handler.get_noise_object(np_2d_crag, chunk_size)
local nobj_3d_i = noise_handler.get_noise_object(np_3d_intrude, chunk_size)

local data = {}

minetest.register_on_generated(function(minp, maxp, blockseed)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
	local flat_area = VoxelArea:new({MinEdge=emin, MaxEdge={x = emax.x, y = emin.y, z = emax.z}})
	vm:get_data(data)

    local nvals_2d_b = nobj_2d_b:get_2d_map_flat(minp)
    local nvals_2d_c = nobj_2d_c:get_2d_map_flat(minp)
    local nvals_3d_i = nobj_3d_i:get_3d_map_flat(minp)


    math.randomseed(blockseed)

	local ni = 0
	for z = minp.z, maxp.z do
		for y = minp.y, maxp.y do
			for x = minp.x, maxp.x do
				local vi = area:index(x, y, z)

                local nv_2d_b = nvals_2d_b[(z-minp.z) * 80 + (x-minp.x) + 1]
                local nv_2d_c = nvals_2d_c[(z-minp.z) * 80 + (x-minp.x) + 1]
                local nv_3d_i = nvals_3d_i[(z - minp.z) * 80 * 80 + (y - minp.y) * 80 + (x - minp.x) + 1]

				ni = ni + 1

				if nv_2d_b > y then
					data[vi] = c_grass
				end

				if nv_2d_b - 1 > y then
					data[vi] = c_stone
				end

                if nv_2d_c < math.max(surface_limit, botom_limit) then
                    if nv_2d_b - depth < y and nv_2d_b > y then
                        local limit = lerp(surface_limit, botom_limit, (nv_2d_b - y)/depth)
                        if nv_2d_c < limit then
                            data[vi] = c_air
                        end
                    end
                    if nv_2d_b - depth > y and nv_2d_b - depth < y + 1  and nv_2d_c < botom_limit then
                        data[vi] = c_dirt
                        if nv_2d_c < botom_limit - 0.05 then
                            data[vi] = c_grass
                        end
                    end
                end

				-- intrusion
                if nv_3d_i < 0.02 then
                    if nv_2d_b + 1 > y then
                        local limit = lerp(surface_limit, botom_limit, (nv_2d_b - y)/depth)
                        if nv_2d_c > limit - 0.02 or nv_2d_b + 1.5 - depth > y then
                            if data[vi] == c_air then
                                data[vi] = c_intrude
                            end
                        end
    				end
				end

			end
		end
	end

	vm:set_data(data)
	minetest.generate_decorations(vm)
	minetest.generate_ores(vm)
	vm:update_liquids()
	vm:set_lighting({day = 0, night = 0})
	vm:calc_lighting()
	vm:write_to_map()
end)


-- SKY
minetest.register_on_joinplayer(
    function(player)
        player:set_sky({
            type = "regular",
            -- base_color = "#a45037",
            clouds = true,
            sky_color = {
                day_sky = "#d53a39",
                day_horizon = "#b3594d",
                dawn_sky = "#c8776c",
                dawn_horizon = "#fbaf8e",
                night_sky = "#232943",
                night_horizon = "#323c51",
            },
            player:set_clouds({
                density = 0.6,
                color = "#722b30",
                ambient = "#1c080a",
            })
        })
    end
)

-- DECORATIONS
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = 0,
    y_max = 50,
	fill_ratio = 0.0001,
	schematic = "schematics/tree_dry_3.mts",
	flags = "place_center_x, place_center_z",
	rotation = "random",
	place_offset_y = 1,
})
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = -10,
    y_max = 50,
	fill_ratio = 0.001,
	schematic = "schematics/tree_dry_2.mts",
	flags = "place_center_x, place_center_z",
	place_offset_y = 1,
})
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
	fill_ratio = 0.0005,
	schematic = "schematics/tree_dry_1.mts",
	flags = "place_center_x, place_center_z",
	rotation = "random",
	place_offset_y = 1,
})

minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
    y_min = -80,
    y_max = 80,
	fill_ratio = 0.001,
	schematic = "schematics/boulder.mts",
	flags = "place_center_x, place_center_z, place_center_y",
	place_offset_y = 1,
	rotation = "random",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 80,
    -- param2 = 32,
    -- param2_max = 34,
	fill_ratio = 0.003,
	decoration = {"cicrev:log_stripped_chestnut"},
    height = 3,
    height_max = 8,
	-- flags = "place_center_x, place_center_z",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
    param2 = 0,
    param2_max = 3,
	fill_ratio = 0.1,
	decoration = {"df_stones:rhyolite_rock"},
	-- flags = "place_center_x, place_center_z",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
    param2 = 0,
    param2_max = 45,
	fill_ratio = 0.7,
	decoration = {"cicrev:tall_grass_dry_1", "cicrev:tall_grass_dry_2", "cicrev:tall_grass_dry_3"},
	-- flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -10,
    y_max = 80,
    sidelen = 4,
    param2 = 32,
    param2_max = 35,
	fill_ratio = 0.6,
	decoration = {"cicrev:sawgrass_dry"},
    noise_params = {
        offset = -0.25,
        scale = 0.8,
        spread = {x = 16, y = 16, z = 16},
        seed = 354,
        octaves = 1,
        persistence = 0.7,
        lacunarity = 2.0,
        -- flags = "absvalue"
    },
	-- flags = "place_center_x, place_center_z",
})
You will also need to replace node names and schematics, but other than you shouldn't need anything else. In case of issues or confusion feel free to ask questions.

And if you do do something with this I would love to see the results.
Last edited by Skamiz Kazzarch on Thu Mar 17, 2022 05:19, edited 2 times in total.

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_014.png
cae_014.png (738.55 KiB) Viewed 16210 times
cae_015.png
cae_015.png (826.05 KiB) Viewed 16210 times
cae_016.png
cae_016.png (404.55 KiB) Viewed 16210 times

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

Re: Post your Screenshots of Terrain!

by MisterE » Post

thank you for sharing this! unfortunately this isn't useful to anyone without a licence. Could you give a license for this code please?

also, are *you* making something with this? this could make an interesting entry in a post for the minetest blog.

User avatar
v-rob
Developer
Posts: 969
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your Screenshots of Terrain!

by v-rob » Post

Man, that terrain is really something! I just love looking at the screenshots of the mapgen stuff you make. These wastelands, chasms, dead trees, and giant rings combined with the red sky with wine-colored clouds look especially incredible. You make such a variety of stuff, and I just love the detail in some of them.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

MisterE wrote:
Wed Mar 16, 2022 21:25
thank you for sharing this! unfortunately this isn't useful to anyone without a licence.
Thanks for the reminder. I intended to do so before posting but then forgot
MisterE wrote:
Wed Mar 16, 2022 21:25
also, are *you* making something with this? this could make an interesting entry in a post for the minetest blog.
Wdym? I literally created it and still intend to try a few more things with it, while posting pics for others to enjoy.
As for the Minetest blog. I noticed a while ago that that's something that exists, but had no further interaction with it and don't feel motivated to change that. If someone else wants to include my mapgen experiments though, there they are welcome to it.
v-rob wrote:
Wed Mar 16, 2022 21:47
~snip~
Thank you. Thank you.
I myself always love to see how projects develop over time, so in turn, when I make something interesting too look at I try to share it around in hopes that others also enjoy it.

I think that mapgen is generally one of Minetests weaker points, and while there are some very neat projects around, which do a lot for realistic mapgen, there is very little in terms of unrealistic, but still interesting for game-play mapgens. So that's my niche I suppose. Be the change you want to see in the world! (The Minetest community is too small for someone else to do it.)

OSS:
cae_017.png
cae_017.png (243.75 KiB) Viewed 16166 times

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

Re: Post your Screenshots of Terrain!

by MisterE » Post

I just meant, is it part of a larger project, or is this it for now?

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

I still want to add some large scale terrain features, but no, this is not part of a larger project. I was just in the mood for doing some mapgen stuff and by now I have enough assets, code, and knowledge that I can prototype new stuff pretty fast.

Also, I have been playing the whole time without fog, which might have been a mistake.
no fog:
cae_018.png
cae_018.png (503.24 KiB) Viewed 16160 times
default fog:
cae_019.png
cae_019.png (514.04 KiB) Viewed 16160 times
maximum fog:
cae_020.png
cae_020.png (514.1 KiB) Viewed 16160 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_021.png
cae_021.png (958.09 KiB) Viewed 16129 times
cae_022.png
cae_022.png (768.19 KiB) Viewed 16129 times
cae_023.png
cae_023.png (608.24 KiB) Viewed 16129 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

cae_024.png
cae_024.png (758.47 KiB) Viewed 16127 times
And with that I think I am done with this mapgen, at least for now.

Here is the final code:

Code: Select all

--[[
Copyright (c) 2022 Skamiz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]

local c_air = minetest.CONTENT_AIR
local c_dirt = minetest.get_content_id("cicrev:silt")
local c_grass = minetest.get_content_id("cicrev:silt_with_fungus")
local c_stone = minetest.get_content_id("df_stones:rhyolite")
local c_intrude = minetest.get_content_id("cicrev:clay")
local c_ring = minetest.get_content_id("df_stones:obsidian")
local c_ring_i = minetest.get_content_id("cicrev:corite") -- TODO: replace this with a glowing material

minetest.set_mapgen_setting("water_level", "0", true)

-- TODO: move rings to their own file

local depth = 25
local surface_limit = 0.1
local botom_limit = 0.15


local function lerp(a, b, ratio)
	return (a * (1 - ratio)) + (b * ratio)
end



--noise parameters
-- base terrain height
np_2d_base = {
    offset = 0,
    scale = 7,
    spread = {x = 80, y = 80, z = 80},
    seed = 0,
    octaves = 3,
    persist = 0.5,
    lacunarity = 3,
	-- flags = "noeased",
}
-- mountains
np_2d_alt = {
    offset = 0-50,
    scale = 100,
    spread = {x = 200, y = 200, z = 200},
    seed = 5,
    octaves = 1,
    persist = 0.1,
    lacunarity = 50,
	flags = "absvalue",
}
-- distribution of the canyons
np_2d_crag = {
    offset = 0,
    scale = 1,
    spread = {x = 40, y = 40, z = 40},
    seed = 1,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
	flags = "absvalue",
}
-- distribution of the web
np_3d_intrude = {
    offset = 0,
    scale = 1,
    spread = {x = 30, y = 30, z = 30},
    seed = 0,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
    flags = "absvalue",
}
-- cracks in the shells of the great rings
np_3d_ring = {
    offset = 0,
    scale = 1,
    spread = {x = 8, y = 8, z = 8},
    seed = 0,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
    -- flags = "absvalue",
}

local side_lenght = 80
local chunk_size = {x = 80, y = 80, z = 80}
local chunk_area = VoxelArea:new{MinEdge={x = 1, y = 1, z = 1}, MaxEdge=chunk_size}

local nobj_2d_b = noise_handler.get_noise_object(np_2d_base, chunk_size)
local nobj_2d_c = noise_handler.get_noise_object(np_2d_crag, chunk_size)
local nobj_2d_a = noise_handler.get_noise_object(np_2d_alt, chunk_size)
local nobj_3d_i = noise_handler.get_noise_object(np_3d_intrude, chunk_size)
local nobj_3d_r = noise_handler.get_noise_object(np_3d_ring, chunk_size)

local data = {}

minetest.register_on_generated(function(minp, maxp, blockseed)
	if maxp.y < 0 or minp.y > 80 then return end
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
	local flat_area = VoxelArea:new({MinEdge=emin, MaxEdge={x = emax.x, y = emin.y, z = emax.z}})
	vm:get_data(data)

    local nvals_2d_b = nobj_2d_b:get_2d_map_flat(minp)
    local nvals_2d_c = nobj_2d_c:get_2d_map_flat(minp)
    local nvals_2d_a = nobj_2d_a:get_2d_map_flat(minp)
    local nvals_3d_i = nobj_3d_i:get_3d_map_flat(minp)
	local nvals_3d_r


    math.randomseed(blockseed)

	local rdir, rpos
	if math.random() < 1/25 then
		nvals_3d_r = nobj_3d_r:get_3d_map_flat(minp)
		rdir = vector.new(math.random() - 0.5, (math.random() - 0.5)/2, math.random() - 0.5):normalize()
		rpos = {}
		-- vector.new(math.floor((minp.x + maxp.x) / 2),
		-- 		math.floor((minp.z + maxp.z) / 2),
		-- 		math.floor(nvals_2d_b[(ring_z-minp.z) * 80 + (ring_x-minp.x) + 1]))
		rpos.x = math.floor((minp.x + maxp.x) / 2)
		rpos.z = math.floor((minp.z + maxp.z) / 2)
		rpos.y = math.floor(nvals_2d_b[(rpos.z-minp.z) * 80 + (rpos.x-minp.x) + 1])
	end

	local ni = 0
	for z = minp.z, maxp.z do
		for y = minp.y, maxp.y do
			for x = minp.x, maxp.x do
				local vi = area:index(x, y, z)

                local nv_2d_b = nvals_2d_b[(z-minp.z) * 80 + (x-minp.x) + 1]
                local nv_2d_c = nvals_2d_c[(z-minp.z) * 80 + (x-minp.x) + 1]
                local nv_2d_a = nvals_2d_a[(z-minp.z) * 80 + (x-minp.x) + 1] + nv_2d_b
                local nv_3d_i = nvals_3d_i[(z - minp.z) * 80 * 80 + (y - minp.y) * 80 + (x - minp.x) + 1]

				ni = ni + 1

				local surface = math.max(nv_2d_b, nv_2d_a)
				local bottom = math.max(nv_2d_b - depth, nv_2d_a)

				if surface > y then
					data[vi] = c_grass
				end

				if surface - 1 > y then
					data[vi] = c_stone
				end

                if nv_2d_c < math.max(surface_limit, botom_limit) and bottom < surface then
                    if bottom < y and surface > y then
                        local limit = lerp(surface_limit, botom_limit, (nv_2d_b - y)/depth)
                        if nv_2d_c < limit then
                            data[vi] = c_air
                        end
                    end
                    if bottom > y and bottom < y + 1  and nv_2d_c < botom_limit then
                        data[vi] = c_dirt
                        if nv_2d_c < botom_limit - 0.05 then
                            data[vi] = c_grass
                        end
                    end
                end

				-- intrusion
                if nv_3d_i < 0.02 then
                    if surface + 1 > y then
                        local limit = lerp(surface_limit, botom_limit, (nv_2d_b - y)/depth)
                        if nv_2d_c > limit - 0.02 or nv_2d_b + 1.5 - depth > y then
                            if data[vi] == c_air then
                                data[vi] = c_intrude
                            end
                        end
    				end
				end

				-- ring
				if rdir then
					local dist = math.pow(rpos.x - x, 2) + math.pow(rpos.z - z, 2) + math.pow(rpos.y - y, 2)
					if dist > math.pow(31, 2) and dist < math.pow(34, 2) and
					 	math.abs((x-rpos.x) * rdir.x + (y-rpos.y) * rdir.y + (z-rpos.z) * rdir.z) <= 2 then
						data[vi] = c_ring_i
					end
					local nv_3d_r = nvals_3d_r[(z - minp.z) * 80 * 80 + (y - minp.y) * 80 + (x - minp.x) + 1]

					if data[vi] ~= c_ring_i and nv_3d_r < 0.3 and
							dist > math.pow(30, 2) and dist < math.pow(35, 2) and
						 	math.abs((x-rpos.x) * rdir.x + (y-rpos.y) * rdir.y + (z-rpos.z) * rdir.z) <= 3 then
						data[vi] = c_ring
					end
				end

			end
		end
	end

	vm:set_data(data)
	minetest.generate_decorations(vm)
	-- minetest.generate_ores(vm)
	-- vm:update_liquids()
	-- vm:set_lighting({day = 0, night = 0})
	vm:calc_lighting()
	vm:write_to_map()
	if rdir then
		minetest.fix_light(minp, maxp)
	end
end)


-- SKY
minetest.register_on_joinplayer(
    function(player)
        player:set_sky({
            type = "regular",
            -- base_color = "#a45037",
            clouds = true,
            sky_color = {
                day_sky = "#d53a39",
                day_horizon = "#b3594d",
                dawn_sky = "#c8776c",
                dawn_horizon = "#fbaf8e",
                night_sky = "#232943",
                night_horizon = "#323c51",
            },
            player:set_clouds({
                density = 0.6,
                color = "#722b30",
                ambient = "#1c080a",
            })
        })
    end
)

-- DECORATIONS
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:clay",
    y_min = 20,
    y_max = 80,
	fill_ratio = 0.01,
	schematic = "schematics/bloom.mts",
	-- schematic = u.get_sphere_schematic(5, {name = "cicrev:bark_chaktekok"}),
	flags = "place_center_x, place_center_z, force_placement",
	place_offset_y = -2,
})
-- TODO: use gennotify to spread some intrusion around the bloom

minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = 0,
    y_max = 50,
	fill_ratio = 0.0001,
	schematic = "schematics/tree_dry_3.mts",
	flags = "place_center_x, place_center_z",
	rotation = "random",
	place_offset_y = 1,
})
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = -10,
    y_max = 50,
	fill_ratio = 0.001,
	schematic = "schematics/tree_dry_2.mts",
	flags = "place_center_x, place_center_z",
	place_offset_y = 1,
})
minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
	fill_ratio = 0.0005,
	schematic = "schematics/tree_dry_1.mts",
	flags = "place_center_x, place_center_z",
	rotation = "random",
	place_offset_y = 1,
})

minetest.register_decoration({
	deco_type = "schematic",
	place_on = "cicrev:silt_with_fungus",
    y_min = -80,
    y_max = 30,
	fill_ratio = 0.001,
	schematic = "schematics/boulder.mts",
	flags = "place_center_x, place_center_z, place_center_y",
	place_offset_y = 1,
	rotation = "random",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 80,
    -- param2 = 32,
    -- param2_max = 34,
	fill_ratio = 0.003,
	decoration = {"cicrev:log_stripped_chestnut"},
    height = 3,
    height_max = 8,
	-- flags = "place_center_x, place_center_z",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
    param2 = 0,
    param2_max = 3,
	fill_ratio = 0.1,
	decoration = {"df_stones:rhyolite_rock"},
	-- flags = "place_center_x, place_center_z",
})

minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -80,
    y_max = 50,
    param2 = 0,
    param2_max = 45,
	fill_ratio = 0.7,
	decoration = {"cicrev:tall_grass_dry_1", "cicrev:tall_grass_dry_2", "cicrev:tall_grass_dry_3"},
	-- flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
	deco_type = "simple",
	place_on = "cicrev:silt_with_fungus",
	y_min = -10,
    y_max = 80,
    sidelen = 4,
    param2 = 32,
    param2_max = 35,
	fill_ratio = 0.6,
	decoration = {"cicrev:sawgrass_dry"},
    noise_params = {
        offset = -0.25,
        scale = 0.8,
        spread = {x = 16, y = 16, z = 16},
        seed = 354,
        octaves = 1,
        persistence = 0.7,
        lacunarity = 2.0,
        -- flags = "absvalue"
    },
	-- flags = "place_center_x, place_center_z",
})
-- TODO: shrooms grouwing on intrusion

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

Re: Post your Screenshots of Terrain!

by MisterE » Post

very cool o.O

User avatar
freshreplicant
Member
Posts: 223
Joined: Sun Aug 09, 2020 10:37
In-game: freshreplicant

Re: Post your Screenshots of Terrain!

by freshreplicant » Post

Skamiz Kazzarch wrote:
Thu Mar 17, 2022 06:56
I still want to add some large scale terrain features, but no, this is not part of a larger project. I was just in the mood for doing some mapgen stuff and by now I have enough assets, code, and knowledge that I can prototype new stuff pretty fast.
This stuff is really cool. It reminds me of Hieronymus Bosch's work, or something from Beetlejuice.

I think there's way to few Minetest mods/games exploring large scale overland structures. Even came up with my dream Minetest game based on that lack.

Are these ring-like structures filled with lava? What about the white bulbs that look like poppies - what's inside?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Post your Screenshots of Terrain!

by runs » Post

manor.png
manor.png (244.33 KiB) Viewed 16060 times
Some casual work in The Samz pre-alpha server, by Chojin.

The 08-april new update: simple beds, simple farming, simple hunger and more!!!

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

The inside of the rings is made of corite (created specifically to have something to put in the rings) and in the blooms there is just more chaktekok bark nodes (same stuff as the outside).
Since I made this mapgen more as an art project rather then a game project I used whatever node looked right and didn't concern myself with that which isn't visible. But yes, if this were to be put into an actual game, the blooms would definitively contain some resource or another.
While I don't intend to make that game, I like to think about how the mapgen would integrate with it.
For example, I was thinking that corite would be indestructible and immovable. But some machines would have to be connected to it for them to work. For one it would give the rings some connection to game-play, other then being visually impressive, for another it creates an interesting kind of scarcity, because while they are huge, they are only available in certain locations.
I know that in practice some arse would probably put their protections all over it. But I like to imagine that around each ring a small community develops where everyone has access to part of the ring, which results in some interesting architecture since the rings orientation is random and they are pretty-much always partially buried.
If you make the plating also indestructible you suddenly have a mechanic where some rings are more valuable then others, depending how much corite is exposed. If you instead just make it very difficult to remove you just created a potential long-term project for your players.

The blooms grow on the veins in higher altitudes, and could be made renewable by having an abm check every so often if there are other alive(not harvested for whatever resource they contain) blooms nearby.
The veins themselves could be made to spread according to the same pattern in which they are originally generated, allowing them to regrow where the player destroyed them, without taking over everything. They could even grow over player built structures (though the players would need a way to combat this).

Lots of stuff that could be done if someone was willing to invest their time and energy into it.

runs: I believe for player built structures you were looking for this thread: viewtopic.php?f=3&t=10128 ?

OSS:
screenshot_20220317_213554.png
screenshot_20220317_213554.png (569.01 KiB) Viewed 16053 times

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 Screenshots of Terrain!

by Skamiz Kazzarch » Post

So I just encountered something completely baffling. Take a look on this picture:
puzzle_001.png
puzzle_001.png (466.6 KiB) Viewed 15980 times
Both sides are generated using the same noise:

Code: Select all

np_3d_branches = {
    offset = 0,
    scale = 4,
    spread = {x = 4, y = 4, z = 4},
    seed = 0,
    octaves = 1,
    persist = 1,
    lacunarity = 1.0,
    flags = "absvalue",
}
by placing a node when the noise value is bellow 0.6 and the height is at a certain level.
The only difference: on the left y = 30, on the right y = 20
So I present you with the riddle: Why is there such a qualitative difference?

Very curious if someone can answer that from their own knowledge.
.
.
.
Solution:
Spoiler
The answer is in the fact that the noise has a spread of 4 and perlin noise is generated in cells. At the edge of the cell the noise has a different character then in the middle. y = 20 gets the noise at the edge and y = 30 gets the noise from the middle.
The only reason why I figured it out myself is because I once spend a day making my own perlin noise implementation, to learn how it works.

I wish Minetest would offer simplex noise as an alternative, because while writing mapgens I keep running into these little artifacts.

User avatar
Mantar
Member
Posts: 582
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Post your Screenshots of Terrain!

by Mantar » Post

That is fantastic work! I'll have to see about fitting these into Exile, surface structures left by the Ancients have been on Dokimi's todo list for some time, and these rings could be a good start.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 10 guests