More Beautiful Mapgen Ever?
More Beautiful Mapgen Ever?
By Beautiful I mean the Best Of The Best.
I am looking for the perfect mapgen and seed for my JuanchiZ server.
I feel that v7 is the best, it's just perfect. Much better than Minecraft without a doubt. The rest I didn't use them much the truth.
I want a mapgen C++, a cheetah, cos my server will be like a cheetah.
I need some guidance. I open a poll,.
I am looking for the perfect mapgen and seed for my JuanchiZ server.
I feel that v7 is the best, it's just perfect. Much better than Minecraft without a doubt. The rest I didn't use them much the truth.
I want a mapgen C++, a cheetah, cos my server will be like a cheetah.
I need some guidance. I open a poll,.
Re: More Beautiful Mapgen Ever?
Oh guys, 'flat' is cool only for testing, don't kiddin me, be serious cos my query is it.
Re: More Beautiful Mapgen Ever?
Please, guyz, vote and vote! I have to select the Perfect Map...
- Festus1965
- Member
- Posts: 4181
- Joined: Sun Jan 03, 2016 11:58
- GitHub: Festus1965
- In-game: Festus1965 Thomas Thailand Explorer
- Location: Thailand ChiangMai
- Contact:
Re: More Beautiful Mapgen Ever?
can't vote as
* have not seen all this mapgen results or didn't realize it - so how to compare then ?
* best is personal decision ...
* most I work under in tunnel, and if, I just dig everything away in my projects way
so I guess flat would be my perfect
* have not seen all this mapgen results or didn't realize it - so how to compare then ?
* best is personal decision ...
* most I work under in tunnel, and if, I just dig everything away in my projects way
so I guess flat would be my perfect
Last edited by Festus1965 on Fri Aug 06, 2021 23:02, edited 1 time in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)
If urgend, you find me in Roblox (as CNXThomas)
- pampogokiraly
- Member
- Posts: 293
- Joined: Wed Jan 08, 2020 22:21
- In-game: i_love_mesecon
Re: More Beautiful Mapgen Ever?
singlenode is the best ever survival map
All praise the Bacon God! The one and only god in MineTest
-
- Member
- Posts: 129
- Joined: Sun Aug 05, 2018 12:37
- In-game: Maverick2797
- Location: Poking about here and there...
Re: More Beautiful Mapgen Ever?
I have been FALLING... for THIRTY MINUTES!
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]
- pampogokiraly
- Member
- Posts: 293
- Joined: Wed Jan 08, 2020 22:21
- In-game: i_love_mesecon
Re: More Beautiful Mapgen Ever?
watching the Y coordinate going down and down is so cool!
All praise the Bacon God! The one and only god in MineTest
-
- Member
- Posts: 1482
- Joined: Fri Apr 19, 2013 16:19
- GitHub: twoelk
- IRC: twoelk
- In-game: twoelk
- Location: northern Germany
Re: More Beautiful Mapgen Ever?
ever tried a sort of singlenode with nyan cats activated?
the idea is to travel between nyan cats by jumping and running in mid air.
So how many nyan cats can you collect befor hitting the void or some other set depth?
but back to the poll
so many mapgens are so extremely different and thus I would love to use some combined in the same map.
just imagine being able to assign different built in mapgens to different regions of the same map with pleasing border zones or reasonable contact zones.
And then above that blend in some more restricted regions of lua mapgens for special purposes similar like we used mount meru.
Just imagine something like choosing mapgen v7 but adding a larger mount meru at the center of the map and a circle ocean beginning at 20km from the center maybe with a australia style island in one outer corner and another new zealand style one in another. Spawn could be on a nice 2km across plain maybe 10k from center but using mapgen flat. Aaaaaand way up in the sky we have some nice fractal mapgen objects.
We allready have so interesting mapgens but being able to combine them with acceptable blending at the edges would probably make minetest absolutely epic.
choosing a single mapgen is so difficult
for personal projects I usually use flat.
Carpathian and valleys make so interesting landscapes that I usually forget building and just wander around gazing at the beauty of the landscape.
v7 is what I mostly use and encounter on servers and I still discover places that surprise me.
Just to name the obvious but there are so many more and some lua mapgens are really wonderfull although they can get slow.
Not to forget mapgen configuration mistakes like the start of the "just test" style servers.
I don't want to choose; I want them all!
the idea is to travel between nyan cats by jumping and running in mid air.
So how many nyan cats can you collect befor hitting the void or some other set depth?
but back to the poll
so many mapgens are so extremely different and thus I would love to use some combined in the same map.
just imagine being able to assign different built in mapgens to different regions of the same map with pleasing border zones or reasonable contact zones.
And then above that blend in some more restricted regions of lua mapgens for special purposes similar like we used mount meru.
Just imagine something like choosing mapgen v7 but adding a larger mount meru at the center of the map and a circle ocean beginning at 20km from the center maybe with a australia style island in one outer corner and another new zealand style one in another. Spawn could be on a nice 2km across plain maybe 10k from center but using mapgen flat. Aaaaaand way up in the sky we have some nice fractal mapgen objects.
We allready have so interesting mapgens but being able to combine them with acceptable blending at the edges would probably make minetest absolutely epic.
choosing a single mapgen is so difficult
for personal projects I usually use flat.
Carpathian and valleys make so interesting landscapes that I usually forget building and just wander around gazing at the beauty of the landscape.
v7 is what I mostly use and encounter on servers and I still discover places that surprise me.
Just to name the obvious but there are so many more and some lua mapgens are really wonderfull although they can get slow.
Not to forget mapgen configuration mistakes like the start of the "just test" style servers.
I don't want to choose; I want them all!
- Hume2
- Member
- Posts: 710
- Joined: Tue Jun 19, 2018 08:24
- GitHub: Hume2
- In-game: Hume2
- Location: Czech Republic
Re: More Beautiful Mapgen Ever?
Singlenode is the best mapgen in all of these criteria:
- disc usage
- CPU usage
- GPU usage
- network usage
If you lack the reality, go on a trip or find a job.
Re: More Beautiful Mapgen Ever?
personally i like v5 the most for it's interesting island structures.
then again, it tends to look weird on greater landmasses with tall mountains.
v7 does better there, but smaller islands are not very interesting.
valleys and carphatian look very natural, but only on large scales. for small scale building i find them rather bland...
generally, v7 seems to be the most popular, as it combines some aspects of both.
i'm fine with v7 on servers, but would always pick v5 for singleplayer.
(this may change with skylands, but as far as i know they are still in developmental stage)
v6 is probably good for beginners. it is easy to navigate and build on, with moderately flat surfaces at low and high ground, and straight cliffs. but for me it lost all it's charms as soon as i found out about biomes and custom mapgen mods and that v6 doesn't support those.
then again, it tends to look weird on greater landmasses with tall mountains.
v7 does better there, but smaller islands are not very interesting.
valleys and carphatian look very natural, but only on large scales. for small scale building i find them rather bland...
generally, v7 seems to be the most popular, as it combines some aspects of both.
i'm fine with v7 on servers, but would always pick v5 for singleplayer.
(this may change with skylands, but as far as i know they are still in developmental stage)
v6 is probably good for beginners. it is easy to navigate and build on, with moderately flat surfaces at low and high ground, and straight cliffs. but for me it lost all it's charms as soon as i found out about biomes and custom mapgen mods and that v6 doesn't support those.
✨🏳️🌈♣️✨
Re: More Beautiful Mapgen Ever?
v7 mapgen looks great and generates some very interesting terrain, the only additions to improve this would be proper layer support for floating biomes and a river feature.
- v-rob
- Developer
- Posts: 971
- Joined: Thu Mar 24, 2016 03:19
- GitHub: v-rob
- IRC: v-rob
- Location: Right behind you.
Re: More Beautiful Mapgen Ever?
I've personally never liked v7 too much; so many of the things seem to repeat themselves over and over. It's hard to find a world without the characteristic v7 ultra high cliffs nearby, for instance. v5 is the weirdest of all, since you'll find odd blobby terrain around, but generates pleasing terrain apart from that. v6 is perhaps the best small-scale mapgen, with lots of lakes, small hills, short cliffs, and no large plains, oceans, or mountains. If you just want small villages, v6 may be the best for you.
However, I think valleys, and especially carpathian, are the best ones. They are natural and generate very nice and interesting terrain. They don't seem to repeat themselves as much as v6 or v7, in my opinion. Certainly, if you just want to build something like a small village and nothing else, choose a smaller scale mapgen. But for anything larger, they are the best.
Fractal is mostly worthless for normal stuff. Singlenode actually can be nice even without a Lua mapgen if you have some way to place down a block. I've made some incredible sky structures, especially when combined with sofar's skybox mod, for example.
(Sometime, I hope v6 can get new biomes. Then it might actually see some use nowadays, although it used to be the default mapgen in early 0.4 versions)
However, I think valleys, and especially carpathian, are the best ones. They are natural and generate very nice and interesting terrain. They don't seem to repeat themselves as much as v6 or v7, in my opinion. Certainly, if you just want to build something like a small village and nothing else, choose a smaller scale mapgen. But for anything larger, they are the best.
Fractal is mostly worthless for normal stuff. Singlenode actually can be nice even without a Lua mapgen if you have some way to place down a block. I've made some incredible sky structures, especially when combined with sofar's skybox mod, for example.
(Sometime, I hope v6 can get new biomes. Then it might actually see some use nowadays, although it used to be the default mapgen in early 0.4 versions)
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: More Beautiful Mapgen Ever?
Hey, don't diss flat. With some simple tweaks, flat can be very pretty.
Believe in people and you don't need to believe anything else.
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: More Beautiful Mapgen Ever?
v7 without caves, ridges, mountains, caverns, or floatlands, with tweaked noise params as follows.
alt and base noises: offset -4, scale 25, octaves 7, persist 0.4, lacunarity 2 - 2.15, spread 600.
height_select: offset 0.5, scale 1, octaves 7, persist 0.4, lacunarity 2 - 2.15, spread 1000.
persist: offset 0.6, scale 0.1, octave 7, persist 0.4, lacunarity 2 - 2.15, spread 2000.
valleys for naturalness.
carpathian for variety.
the rest are bland.
Dokimis Tectonic mapgen.
Termos Islands mapgen.
Gael de Sailley's new mapgen_rivers.
My own voronoi based mapgen.
And some code to share, for those willing or interested.
Enjoy!
Shad
alt and base noises: offset -4, scale 25, octaves 7, persist 0.4, lacunarity 2 - 2.15, spread 600.
height_select: offset 0.5, scale 1, octaves 7, persist 0.4, lacunarity 2 - 2.15, spread 1000.
persist: offset 0.6, scale 0.1, octave 7, persist 0.4, lacunarity 2 - 2.15, spread 2000.
valleys for naturalness.
carpathian for variety.
the rest are bland.
Dokimis Tectonic mapgen.
Termos Islands mapgen.
Gael de Sailley's new mapgen_rivers.
My own voronoi based mapgen.
And some code to share, for those willing or interested.
Spoiler
NOTE: The code is dirty, full of commented sections, references to projects not posted. The logic is solid, and for those willing to figure it out, should be easy enough to play with.
Credits to Pyrollo for the v6 and v7 code, Termos for the Islands code, duane, Gael de Sailley, and paramat for code and inspiration.
Both of these and others are found and usable within my GAL project.
v7 singlenode, using above params, with Termos' Islands cliff logic superimposed. A personal fave!
v6 with biomes.
Credits to Pyrollo for the v6 and v7 code, Termos for the Islands code, duane, Gael de Sailley, and paramat for code and inspiration.
Both of these and others are found and usable within my GAL project.
v7 singlenode, using above params, with Termos' Islands cliff logic superimposed. A personal fave!
Spoiler
Code: Select all
if gal.mapgen.name ~= "mg_v7" then
return
end
mg_v7 = {}
mg_v7.name = "mg_v7"
mg_v7.ver_max = 0
mg_v7.ver_min = 1
mg_v7.ver_rev = 0
mg_v7.ver_str = mg_v7.ver_max .. "." .. mg_v7.ver_min .. "." .. mg_v7.ver_rev
mg_v7.authorship = "ShadMOrdre. Additional credits to Termos' Islands mod; Gael-de-Sailleys' Valleys; duane-r Valleys_c, burli mapgen, and paramats' mapgens"
mg_v7.license = "LGLv2.1"
mg_v7.copyright = "2020"
mg_v7.path_mod = minetest.get_modpath(minetest.get_current_modname())
mg_v7.path_world = minetest.get_worldpath()
mg_v7.intllib = gal.intllib
local S = gal.intllib
minetest.log(S("[MOD] mg_v7: Loading..."))
minetest.log(S("[MOD] mg_v7: Version:") .. S(mg_v7.ver_str))
minetest.log(S("[MOD] mg_v7: Legal Info: Copyright ") .. S(mg_v7.copyright) .. " " .. S(mg_v7.authorship) .. "")
minetest.log(S("[MOD] mg_v7: License: ") .. S(mg_v7.license) .. "")
local abs = math.abs
local max = math.max
local min = math.min
local floor = math.floor
local player_spawn_point = {x=-5,y=0,z=-5}
local origin_y_val = {x=0,y=0,z=0}
mg_v7.heightmap = {}
mg_v7.fillermap = {}
mg_v7.cliffmap = {}
mg_v7.biomemap = {}
mg_v7.biome_info = {}
mg_v7.rivermap = {}
mg_v7.water_level = 1
mg_v7.use_heat_scalar = false
mg_v7.mg_world_scale = gal.mapgen.mg_world_scale
mg_v7.mg_alt_scale_scale = 1
mg_v7.mg_base_scale_scale = 1
local mg_world_scale = mg_v7.mg_world_scale
mg_v7.mg_river_size = 5
local max_highland = gal.mapgen.maxheight_highland
local max_mountain = gal.mapgen.maxheight_mountain
mg_v7.mg_noise_spread = (1200 * mg_v7.mg_alt_scale_scale) * mg_v7.mg_world_scale
mg_v7.mg_noise_scale = 25
mg_v7.mg_alt_noise_scale = mg_v7.mg_noise_scale * mg_v7.mg_world_scale
mg_v7.mg_base_noise_scale = ((mg_v7.mg_noise_scale * 2.8) * mg_v7.mg_base_scale_scale) * mg_v7.mg_world_scale
mg_v7.mg_noise_offset = -4 * mg_v7.mg_world_scale
mg_v7.mg_noise_octaves = 7
mg_v7.mg_noise_persist = 0.4
mg_v7.mg_noise_lacunarity = 2.11
mg_v7.mg_height_noise_spread = 1000 * mg_v7.mg_world_scale
mg_v7.mg_persist_noise_spread = 2000 * mg_v7.mg_world_scale
local nobj_alt = nil
local nbuf_alt = {}
local nobj_base = nil
local nbuf_base = {}
local nobj_height = nil
local nbuf_height = {}
local nobj_persist = nil
local nbuf_persist = {}
local nobj_cliffs = nil
local nbuf_cliffs = {}
local nobj_filler_depth = nil
local nbuf_filler_depth = {}
local nobj_val_river = nil
local nbuf_val_river = {}
local nobj_heatmap = nil
local nbuf_heatmap = {}
local nobj_heatblend = nil
local nbuf_heatblend = {}
local nobj_humiditymap = nil
local nbuf_humiditymap = {}
local nobj_humidityblend = nil
local nbuf_humidityblend = {}
local np_v7_alt = {
offset = mg_v7.mg_noise_offset,
scale = mg_v7.mg_alt_noise_scale,
seed = 5934,
spread = {x = mg_v7.mg_noise_spread, y = mg_v7.mg_noise_spread, z = mg_v7.mg_noise_spread},
octaves = mg_v7.mg_noise_octaves,
persist = mg_v7.mg_noise_persist,
lacunarity = mg_v7.mg_noise_lacunarity,
--flags = "defaults"
--flags = "eased",
}
local np_v7_base = {
offset = mg_v7.mg_noise_offset * mg_v7.mg_base_scale_scale,
scale = mg_v7.mg_base_noise_scale,
--seed = 82341,
seed = 5934,
spread = {x = mg_v7.mg_noise_spread, y = mg_v7.mg_noise_spread, z = mg_v7.mg_noise_spread},
octaves = mg_v7.mg_noise_octaves,
persist = mg_v7.mg_noise_persist,
lacunarity = mg_v7.mg_noise_lacunarity,
flags = "defaults"
}
local np_v7_height = {
flags = "defaults",
lacunarity = mg_v7.mg_noise_lacunarity,
--offset = 0.25,
offset = 0.5,
scale = 1,
spread = {x = mg_v7.mg_height_noise_spread, y = mg_v7.mg_height_noise_spread, z = mg_v7.mg_height_noise_spread},
seed = 4213,
octaves = mg_v7.mg_noise_octaves,
persist = mg_v7.mg_noise_persist,
}
local np_v7_persist = {
flags = "defaults",
lacunarity = mg_v7.mg_noise_lacunarity,
offset = 0.6,
scale = 0.1,
spread = {x = mg_v7.mg_persist_noise_spread, y = mg_v7.mg_persist_noise_spread, z = mg_v7.mg_persist_noise_spread},
seed = 539,
octaves = 3,
persist = 0.6,
}
np_v7_filler_depth = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.2,
spread = {x = 150, y = 150, z = 150},
seed = 261,
octaves = 3,
persistence = 0.7,
}
local np_v7_cliffs = {
offset = 0,
scale = 0.72,
spread = {x = 180, y = 180, z = 180},
seed = 78901,
octaves = 5,
persist = 0.5,
lacunarity = 2.19,
}
local np_val_river = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1,
spread = {x = 256, y = 256, z = 256},
seed = -6050,
octaves = 5,
persist = 0.6,
}
local np_heat = {
flags = "defaults",
lacunarity = 2,
offset = 50,
scale = 50,
--spread = {x = 1000, y = 1000, z = 1000},
spread = {x = (1000 * mg_v7.mg_world_scale), y = (1000 * mg_v7.mg_world_scale), z = (1000 * mg_v7.mg_world_scale)},
seed = 5349,
octaves = 3,
persist = 0.5,
}
local np_heat_blend = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.5,
spread = {x = 8, y = 8, z = 8},
seed = 13,
octaves = 2,
persist = 1,
}
local np_humid = {
flags = "defaults",
lacunarity = 2,
offset = 50,
scale = 50,
--spread = {x = 1000, y = 1000, z = 1000},
spread = {x = (1000 * mg_v7.mg_world_scale), y = (1000 * mg_v7.mg_world_scale), z = (1000 * mg_v7.mg_world_scale)},
seed = 842,
octaves = 3,
persist = 0.5,
}
local np_humid_blend = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.5,
spread = {x = 8, y = 8, z = 8},
seed = 90003,
octaves = 2,
persist = 1,
}
local cliffs_thresh = floor((np_v7_alt.scale) * 0.5)
local function rangelim(v, min, max)
if v < min then return min end
if v > max then return max end
return v
end
local function max_height(noiseprm)
local height = 0
local scale = noiseprm.scale
for i=1,noiseprm.octaves do
height=height + scale
scale = scale * noiseprm.persist
end
return height+noiseprm.offset
end
local function min_height(noiseprm)
local height = 0
local scale = noiseprm.scale
for i=1,noiseprm.octaves do
height=height - scale
scale = scale * noiseprm.persist
end
return height+noiseprm.offset
end
local v7_min_height = min_height(np_v7_base)
local v7_max_height = max_height(np_v7_base)
local function get_terrain_height_cliffs(theight,cheight)
-- cliffs
local t_cliff = 0
if theight > 1 and theight < cliffs_thresh then
local clifh = max(min(cheight,1),0)
if clifh > 0 then
clifh = -1 * (clifh - 1) * (clifh - 1) + 1
t_cliff = clifh
theight = theight + (cliffs_thresh - theight) * clifh * ((theight < 2) and theight - 1 or 1)
end
end
return theight, t_cliff
end
local function get_v7_height(z,x)
local aterrain = 0
local hselect = minetest.get_perlin(np_v7_height):get_2d({x=x,y=z})
local hselect = rangelim(hselect, 0, 1)
local persist = minetest.get_perlin(np_v7_persist):get_2d({x=x,y=z})
np_v7_base.persistence = persist;
local height_base = minetest.get_perlin(np_v7_base):get_2d({x=x,y=z})
np_v7_alt.persistence = persist;
local height_alt = minetest.get_perlin(np_v7_alt):get_2d({x=x,y=z})
if (height_alt > height_base) then
aterrain = floor(height_alt)
else
aterrain = floor((height_base * hselect) + (height_alt * (1 - hselect)))
end
return aterrain
end
local mapgen_times = {
noisemaps = {},
preparation = {},
loop2d = {},
loop3d = {},
biomes = {},
mainloop = {},
setdata = {},
liquid_lighting = {},
writing = {},
make_chunk = {},
}
local get_cell = gal.lib.voronoi.get_nearest_cell
local data = {}
minetest.register_on_generated(function(minp, maxp, seed)
-- Start time of mapchunk generation.
local t0 = os.clock()
local x1 = maxp.x
local y1 = maxp.y
local z1 = maxp.z
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
local sidelen = maxp.x - minp.x + 1
local permapdims2d = {x = sidelen, y = sidelen, z = 0}
--local permapdims3d = {x = sidelen, y = sidelen, z = sidelen}
--local minpos3d = {x = x0, y = y0, z = z0}
local minpos2d = {x = x0, y = z0}
nobj_cliffs = nobj_cliffs or minetest.get_perlin_map(np_v7_cliffs, permapdims2d)
nbuf_cliffs = nobj_cliffs:get_2d_map(minpos2d)
nobj_filler_depth = nobj_filler_depth or minetest.get_perlin_map(np_v7_filler_depth, permapdims2d)
nbuf_filler_depth = nobj_filler_depth:get_2d_map(minpos2d)
--nobj_val_river = nobj_val_river or minetest.get_perlin_map(np_val_river, permapdims2d)
--nbuf_val_river = nobj_val_river:get_2d_map(minpos2d, nbuf_val_river)
nobj_heatmap = nobj_heatmap or minetest.get_perlin_map(np_heat, permapdims2d)
nbuf_heatmap = nobj_heatmap:get_2d_map(minpos2d)
nobj_heatblend = nobj_heatblend or minetest.get_perlin_map(np_heat_blend, permapdims2d)
nbuf_heatblend = nobj_heatblend:get_2d_map(minpos2d)
nobj_humiditymap = nobj_humiditymap or minetest.get_perlin_map(np_humid, permapdims2d)
nbuf_humiditymap = nobj_humiditymap:get_2d_map(minpos2d)
nobj_humidityblend = nobj_humidityblend or minetest.get_perlin_map(np_humid_blend, permapdims2d)
nbuf_humidityblend = nobj_humidityblend:get_2d_map(minpos2d)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
vm:get_data(data)
local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local csize = vector.add(vector.subtract(maxp, minp), 1)
-- Mapgen preparation is now finished. Check the timer to know the elapsed time.
local t1 = os.clock()
--local center_of_chunk = {
-- x = maxp.x - gal.mapgen.mg_half_chunk_size,
-- y = maxp.y - gal.mapgen.mg_half_chunk_size,
-- z = maxp.z - gal.mapgen.mg_half_chunk_size
--}
--current_chunk = center_of_chunk
local center_of_chunk_x = maxp.x - (sidelen / 2)
local center_of_chunk_z = maxp.z - (sidelen / 2)
--local mn_idx, mn_dist, mn_rise, mn_run, mn_edge = get_cell({x = center_of_chunk_x, z = center_of_chunk_z}, dist_metric, 1)
--local pn_idx, pn_dist, pn_rise, pn_run, pn_edge = get_cell({x = center_of_chunk_x, z = center_of_chunk_z}, dist_metric, 2)
--local cn_idx, cn_dist, cn_rise, cn_run, cn_edge = get_cell({x = center_of_chunk_x, z = center_of_chunk_z}, dist_metric, 3)
--gal.mapgen.chunk_voronoi_cells = {
-- m = mn_idx,
-- p = pn_idx,
-- c = cn_idx
--}
local write = false
local river_size_factor = mg_v7.mg_river_size / 100
--
--2D HEIGHTMAP GENERATION
local index2d = 0
local mean_alt = 0
for z = z0, z1 do
for x = x0, x1 do
index2d = (z - minp.z) * csize.x + (x - minp.x) + 1
local nfiller = nbuf_filler_depth[z-minp.z+1][x-minp.x+1]
local ncliff = nbuf_cliffs[z-minp.z+1][x-minp.x+1]
--local t_f = n_terrain * (1 / v7_max_height)
--local t_x = t_f * (mg_world_scale / 0.01)
--local h_terrain = n_terrain * math.sin(nfiller)
--local vterrain = n_terrain + h_terrain
local vterrain = get_v7_height(z,x)
--local vterrain = t_x
local t_y, t_c = get_terrain_height_cliffs(vterrain,ncliff)
gal.mapgen.heightmap[index2d] = t_y
mg_v7.cliffmap[index2d] = t_c
mg_v7.fillermap[index2d] = nfiller
--local v_rivers = nbuf_val_river[z-minp.z+1][x-minp.x+1]
--local abs_rivers = abs(v_rivers)
--local river_course
--river_size_factor = (mg_v7.mg_river_size - (t_y / (40 * mg_world_scale))) / 100
--if abs_rivers <= river_size_factor then
-- -- TODO: Add riverbed calculation
-- river_course = abs_rivers
--end
--mg_v7.rivermap[index2d] = river_course
local nheat = nbuf_heatmap[z-minp.z+1][x-minp.x+1] + nbuf_heatblend[z-minp.z+1][x-minp.x+1]
local nhumid = nbuf_humiditymap[z-minp.z+1][x-minp.x+1] + nbuf_humidityblend[z-minp.z+1][x-minp.x+1]
gal.mapgen.biomemap[index2d] = gal.mapgen.get_biome_name(nheat,nhumid,t_y)
if z == center_of_chunk_z and x == center_of_chunk_x then
gal.mapgen.chunk_biome = gal.mapgen.biomemap[index2d]
end
mean_alt = mean_alt + t_y
--## SPAWN SELECTION
if z == player_spawn_point.z then
if x == player_spawn_point.x then
player_spawn_point.y = t_y
end
end
if z == origin_y_val.z then
if x == origin_y_val.x then
origin_y_val.y = t_y
end
end
end
end
gal.mapgen.chunk_mean_altitude = mean_alt / ((x1 - x0) * (z1 - z0))
local t2 = os.clock()
local t3 = os.clock()
--2D HEIGHTMAP RENDER
local index2d = 0
for z = z0, z1 do
for y = y0, y1 do
for x = x0, x1 do
index2d = (z - minp.z) * csize.x + (x - minp.x) + 1
local ivm = a:index(x, y, z)
local nheat = nbuf_heatmap[z-minp.z+1][x-minp.x+1] + nbuf_heatblend[z-minp.z+1][x-minp.x+1]
local nhumid = nbuf_humiditymap[z-minp.z+1][x-minp.x+1] + nbuf_humidityblend[z-minp.z+1][x-minp.x+1]
local theight = gal.mapgen.heightmap[index2d]
local t_fillmap = mg_v7.fillermap[index2d]
local t_cliff = mg_v7.cliffmap[index2d] or 0
--local t_rivermap = mg_v7.rivermap[index2d] or (river_size_factor + 1)
local t_biome_name = gal.mapgen.biomemap[index2d]
local fill_depth = 4
local top_depth = 1
--BUILD BIOMES.
local t_air = gal.mapgen.c_air
local t_ignore = gal.mapgen.c_ignore
local t_top = gal.mapgen.c_top
local t_filler = gal.mapgen.c_filler
local t_stone = gal.mapgen.c_stone
local t_water = gal.mapgen.c_water
local t_river = gal.mapgen.c_river
local t_riverbed = gal.mapgen.c_gravel
local t_riverbed_depth = 5
local t_ice = gal.mapgen.c_ice
local t_mud = gal.mapgen.c_mud
t_stone = gal.mapgen.biome_info[t_biome_name].b_stone
t_filler = gal.mapgen.biome_info[t_biome_name].b_filler
local t_filldepth = fill_depth + t_fillmap
t_top = gal.mapgen.biome_info[t_biome_name].b_top
top_depth = 1
t_water = gal.mapgen.biome_info[t_biome_name].b_water
t_river = gal.mapgen.biome_info[t_biome_name].b_river
t_riverbed = gal.mapgen.biome_info[t_biome_name].b_riverbed
t_riverbed_depth = gal.mapgen.biome_info[t_biome_name].b_riverbed_depth
if t_cliff > 0 then
t_filler = t_stone
end
local max_high = max_highland + (nheat * mg_world_scale) - (nhumid * mg_world_scale)
local max_mount = max_mountain + (nheat * mg_world_scale) - (nhumid * mg_world_scale)
if theight > max_high then
t_top = t_stone
t_filler = t_stone
t_stone = t_stone
t_water = t_water
t_river = t_ice
end
if theight > max_mount then
t_top = t_ice
t_filler = t_stone
t_stone = t_stone
t_water = t_ice
t_river = t_ice
end
--river_size_factor = (mg_v7.mg_river_size - (theight / (40 * mg_world_scale))) / 100
--if t_rivermap <= river_size_factor then
-- if theight >= (gal.mapgen.water_level -1) then
-- t_filldepth = t_riverbed_depth - (theight / (75 * mg_world_scale))
-- end
--end
--NODE PLACEMENT FROM HEIGHTMAP
local t_node = t_ignore
--2D Terrain
if y < (theight - (t_filldepth + top_depth)) then
t_node = t_stone
elseif y >= (theight - (t_filldepth + top_depth)) and y < (theight - top_depth) then
--if t_rivermap <= river_size_factor then
-- if y > (gal.mapgen.water_level - 1) then
-- if y >= (theight - ((t_filldepth - (t_riverbed_depth * 0.5)) + top_depth)) and y < (theight - top_depth) then
-- t_filler = t_river
-- else
-- t_filler = t_riverbed
-- end
-- if t_rivermap >= (river_size_factor * 0.7) then
-- t_filler = t_mud
-- end
-- end
--end
t_node = t_filler
elseif y >= (theight - top_depth) and y <= theight then
--if t_rivermap <= river_size_factor then
-- if y > gal.mapgen.water_level then
-- t_top = t_air
-- else
-- t_top = t_water
-- end
--end
t_node = t_top
elseif y > theight and y <= gal.mapgen.water_level then
--Water Level (Sea Level)
t_node = t_water
end
--[[
if y < (theight - (fill_depth + top_depth)) then
t_node = t_stone
elseif y >= (theight - (fill_depth + top_depth)) and y < (theight - top_depth) then
t_node = t_filler
elseif y >= (theight - top_depth) and y <= theight then
if y <= gal.mapgen.water_level then
t_top = c_sand
end
t_node = t_top
elseif y > theight and y <= gal.mapgen.water_level then
--Water Level (Sea Level)
t_node = t_water
end
--]]
data[ivm] = t_node
write = true
end
end
end
local t4 = os.clock()
if write then
vm:set_data(data)
end
local t5 = os.clock()
if write then
minetest.generate_ores(vm,minp,maxp)
minetest.generate_decorations(vm,minp,maxp)
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
end
local t6 = os.clock()
if write then
vm:write_to_map()
end
local t7 = os.clock()
-- Print generation time of this mapchunk.
local chugent = math.ceil((os.clock() - t0) * 1000)
print ("[mg_v7] Mapchunk generation time " .. chugent .. " ms")
table.insert(mapgen_times.noisemaps, 0)
table.insert(mapgen_times.preparation, t1 - t0)
table.insert(mapgen_times.loop2d, t2 - t1)
table.insert(mapgen_times.loop3d, t3 - t2)
table.insert(mapgen_times.mainloop, t4 - t3)
table.insert(mapgen_times.setdata, t5 - t4)
table.insert(mapgen_times.liquid_lighting, t6 - t5)
table.insert(mapgen_times.writing, t7 - t6)
table.insert(mapgen_times.make_chunk, t7 - t0)
-- Deal with memory issues. This, of course, is supposed to be automatic.
local mem = math.floor(collectgarbage("count")/1024)
if mem > 1000 then
print("mg_v7 is manually collecting garbage as memory use has exceeded 500K.")
collectgarbage("collect")
end
end)
local function mean( t )
local sum = 0
local count= 0
for k,v in pairs(t) do
if type(v) == 'number' then
sum = sum + v
count = count + 1
end
end
return (sum / count)
end
minetest.register_on_shutdown(function()
if #mapgen_times.make_chunk == 0 then
return
end
local average, standard_dev
minetest.log("mg_v7 lua Mapgen Times:")
average = mean(mapgen_times.noisemaps)
minetest.log(" noisemaps: - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.preparation)
minetest.log(" preparation: - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.loop2d)
minetest.log(" 2D Noise loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.loop3d)
minetest.log(" 3D Noise loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.mainloop)
minetest.log(" Main Render loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.setdata)
minetest.log(" writing: - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.liquid_lighting)
minetest.log(" liquid_lighting: - - - - - - - - - - - - "..average)
average = mean(mapgen_times.writing)
minetest.log(" writing: - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.make_chunk)
minetest.log(" makeChunk: - - - - - - - - - - - - - - - "..average)
end)
minetest.log(S("[MOD] mg_v7: Successfully loaded."))
Spoiler
Code: Select all
if gal.mapgen.name ~= "mg_v6" then
return
end
mg_v6 = {}
mg_v6.name = "mg_v6"
mg_v6.ver_max = 0
mg_v6.ver_min = 1
mg_v6.ver_rev = 0
mg_v6.ver_str = mg_v6.ver_max .. "." .. mg_v6.ver_min .. "." .. mg_v6.ver_rev
mg_v6.authorship = "ShadMOrdre. Additional credits to Termos' Islands mod; Gael-de-Sailleys' Valleys; duane-r Valleys_c, burli mapgen, and paramats' mapgens"
mg_v6.license = "LGLv2.1"
mg_v6.copyright = "2020"
mg_v6.path_mod = minetest.get_modpath(minetest.get_current_modname())
mg_v6.path_world = minetest.get_worldpath()
mg_v6.intllib = gal.intllib
local S = gal.intllib
minetest.log(S("[MOD] mg_v6: Loading..."))
minetest.log(S("[MOD] mg_v6: Version:") .. S(mg_v6.ver_str))
minetest.log(S("[MOD] mg_v6: Legal Info: Copyright ") .. S(mg_v6.copyright) .. " " .. S(mg_v6.authorship) .. "")
minetest.log(S("[MOD] mg_v6: License: ") .. S(mg_v6.license) .. "")
local abs = math.abs
local max = math.max
local min = math.min
local floor = math.floor
local player_spawn_point = {x=-5,y=0,z=-5}
local origin_y_val = {x=0,y=0,z=0}
mg_v6.heightmap = {}
mg_v6.fillermap = {}
mg_v6.biomemap = {}
mg_v6.biome_info = {}
mg_v6.water_level = 1
mg_v6.use_heat_scalar = false
mg_v6.mg_world_scale = 1
local mg_world_scale = mg_v6.mg_world_scale
local max_highland = gal.mapgen.maxheight_highland
local max_mountain = gal.mapgen.maxheight_mountain
-- Cave Parameters
local YMIN = -1024 -- Cave realm limits
local YMAX = 64
local TCAVE = 0.6 -- Cave threshold: 1 = small rare caves,
-- 0.5 = 1/3rd ground volume, 0 = 1/2 ground volume.
local BLEND = 128 -- Cave blend distance near YMIN, YMAX
mg_v6.mg_noise_spread = 600
mg_v6.mg_noise_scale = 25
--mg_v6.mg_noise_offset = 0
mg_v6.mg_noise_offset = -4
mg_v6.mg_noise_octaves = 8
mg_v6.mg_noise_persist = 0.3
mg_v6.mg_noise_lacunarity = 2.19
-- Stuff
local yblmin = YMIN + BLEND * 1.5
local yblmax = YMAX - BLEND * 1.5
-- Initialize noise objects to nil
local nobj_cave = nil
local nvals_cave = {}
local nobj_filler_depth = nil
local nbuf_filler_depth = {}
local nobj_heatmap = nil
local nbuf_heatmap = {}
local nobj_heatblend = nil
local nbuf_heatblend = {}
local nobj_humiditymap = nil
local nbuf_humiditymap = {}
local nobj_humidityblend = nil
local nbuf_humidityblend = {}
local mgv6_np_terrain_base = {
flags = "defaults",
lacunarity = 2,
offset = -4,
scale = 20,
spread = {x = 250, y = 250, z = 250},
seed = 82341,
octaves = 5,
persist = 0.6,
}
local mgv6_np_terrain_higher = {
flags = "defaults",
lacunarity = 2,
offset = 20,
scale = 16,
spread = {x = 500, y = 500, z = 500},
seed = 85039,
octaves = 5,
persist = 0.6,
}
local mgv6_np_steepness = {
flags = "defaults",
lacunarity = 2,
offset = 0.85,
scale = 0.5,
spread = {x = 125, y = 125, z = 125},
seed = -932,
octaves = 5,
persist = 0.7,
}
local mgv6_np_height_select = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1,
spread = {x = 250, y = 250, z = 250},
seed = 4213,
octaves = 5,
persist = 0.69,
}
np_v6_filler_depth = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.2,
spread = {x = 150, y = 150, z = 150},
seed = 261,
octaves = 3,
persistence = 0.7,
}
-- 3D noise for caves
local mgv6_np_cave = {
offset = 0,
scale = 1,
spread = {x = 768, y = 256, z = 768}, -- squashed 3:1
seed = 59033,
octaves = 6,
persist = 0.63
}
local np_heat = {
flags = "defaults",
lacunarity = 2,
offset = 50,
scale = 50,
spread = {x = (1000), y = (1000), z = (1000)},
seed = 5349,
octaves = 3,
persist = 0.5,
}
local np_heat_blend = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.5,
spread = {x = 8, y = 8, z = 8},
seed = 13,
octaves = 2,
persist = 1,
}
local np_humid = {
flags = "defaults",
lacunarity = 2,
offset = 50,
scale = 50,
spread = {x = (1000), y = (1000), z = (1000)},
seed = 842,
octaves = 3,
persist = 0.5,
}
local np_humid_blend = {
flags = "defaults",
lacunarity = 2,
offset = 0,
scale = 1.5,
spread = {x = 8, y = 8, z = 8},
seed = 90003,
octaves = 2,
persist = 1,
}
--##
--## Create a table of biome ids, so I can use the biomemap.
--##
mg_v6.biome_info = {}
for name, desc in pairs(minetest.registered_biomes) do
if desc then
mg_v6.biome_info[desc.name] = {}
mg_v6.biome_info[desc.name].b_name = desc.name
mg_v6.biome_info[desc.name].b_cid = minetest.get_biome_id(name)
mg_v6.biome_info[desc.name].b_top = c_dirtgrass
mg_v6.biome_info[desc.name].b_top_depth = 1
mg_v6.biome_info[desc.name].b_filler = c_dirt
mg_v6.biome_info[desc.name].b_filler_depth = 4
mg_v6.biome_info[desc.name].b_stone = c_stone
mg_v6.biome_info[desc.name].b_water_top = c_water
mg_v6.biome_info[desc.name].b_water_top_depth = 1
mg_v6.biome_info[desc.name].b_water = c_water
mg_v6.biome_info[desc.name].b_river = c_river
----mg_v6.biome_info[desc.name].b_riverbed = c_gravel
----mg_v6.biome_info[desc.name].b_riverbed_depth = 2
----mg_v6.biome_info[desc.name].b_cave_liquid = c_lava
----mg_v6.biome_info[desc.name].b_dungeon = c_mossy
----mg_v6.biome_info[desc.name].b_dungeon_alt = c_brick
----mg_v6.biome_info[desc.name].b_dungeon_stair = c_block
----mg_v6.biome_info[desc.name].b_node_dust = c_air
mg_v6.biome_info[desc.name].vertical_blend = 0
mg_v6.biome_info[desc.name].min_pos = {x=-31000, y=-31000, z=-31000}
mg_v6.biome_info[desc.name].max_pos = {x=31000, y=31000, z=31000}
mg_v6.biome_info[desc.name].b_miny = -31000
mg_v6.biome_info[desc.name].b_maxy = 31000
mg_v6.biome_info[desc.name].b_heat = 50
mg_v6.biome_info[desc.name].b_humid = 50
if desc.node_top and desc.node_top ~= "" then
mg_v6.biome_info[desc.name].b_top = minetest.get_content_id(desc.node_top) or c_dirtgrass
end
if desc.depth_top then
mg_v6.biome_info[desc.name].b_top_depth = desc.depth_top or 1
end
if desc.node_filler and desc.node_filler ~= "" then
mg_v6.biome_info[desc.name].b_filler = minetest.get_content_id(desc.node_filler) or c_dirt
end
if desc.depth_filler then
mg_v6.biome_info[desc.name].b_filler_depth = desc.depth_filler or 4
end
if desc.node_stone and desc.node_stone ~= "" then
mg_v6.biome_info[desc.name].b_stone = minetest.get_content_id(desc.node_stone) or c_stone
end
if desc.node_water_top and desc.node_water_top ~= "" then
mg_v6.biome_info[desc.name].b_water_top = minetest.get_content_id(desc.node_water_top) or c_water
end
if desc.depth_water_top then
mg_v6.biome_info[desc.name].b_water_top_depth = desc.depth_water_top or 1
end
if desc.node_water and desc.node_water ~= "" then
mg_v6.biome_info[desc.name].b_water = minetest.get_content_id(desc.node_water) or c_water
end
if desc.node_river_water and desc.node_river_water ~= "" then
mg_v6.biome_info[desc.name].b_river = minetest.get_content_id(desc.node_river_water) or c_water
end
--[[
if desc.node_riverbed and desc.node_riverbed ~= "" then
mg_v6.biome_info[desc.name].b_riverbed = minetest.get_content_id(desc.node_riverbed)
end
if desc.depth_riverbed then
mg_v6.biome_info[desc.name].b_riverbed_depth = desc.depth_riverbed or 2
end
if desc.node_cave_liquid and desc.node_cave_liquid ~= "" then
mg_v6.biome_info[desc.name].b_cave_liquid = minetest.get_content_id(desc.node_cave_liquid)
end
if desc.node_dungeon and desc.node_dungeon ~= "" then
mg_v6.biome_info[desc.name].b_dungeon = minetest.get_content_id(desc.node_dungeon)
end
if desc.node_dungeon_alt and desc.node_dungeon_alt ~= "" then
mg_v6.biome_info[desc.name].b_dungeon_alt = minetest.get_content_id(desc.node_dungeon_alt)
end
if desc.node_dungeon_stair and desc.node_dungeon_stair ~= "" then
mg_v6.biome_info[desc.name].b_dungeon_stair = minetest.get_content_id(desc.node_dungeon_stair)
end
if desc.node_dust and desc.node_dust ~= "" then
mg_v6.biome_info[desc.name].b_node_dust = minetest.get_content_id(desc.node_dust)
end
--]]
if desc.vertical_blend then
mg_v6.biome_info[desc.name].vertical_blend = desc.vertical_blend or 0
end
if desc.y_min then
mg_v6.biome_info[desc.name].b_miny = desc.y_min or -31000
end
if desc.y_max then
mg_v6.biome_info[desc.name].b_maxy = desc.y_max or 31000
end
mg_v6.biome_info[desc.name].min_pos = desc.min_pos or {x=-31000, y=-31000, z=-31000}
if desc.y_min then
mg_v6.biome_info[desc.name].min_pos.y = math.max(mg_v6.biome_info[desc.name].min_pos.y, desc.y_min)
end
mg_v6.biome_info[desc.name].max_pos = desc.max_pos or {x=31000, y=31000, z=31000}
if desc.y_max then
mg_v6.biome_info[desc.name].max_pos.y = math.min(mg_v6.biome_info[desc.name].max_pos.y, desc.y_max)
end
if desc.heat_point then
mg_v6.biome_info[desc.name].b_heat = desc.heat_point or 50
end
if desc.humidity_point then
mg_v6.biome_info[desc.name].b_humid = desc.humidity_point or 50
end
end
end
local function get_heat_scalar(z)
if mg_v6.use_heat_scalar == true then
local t_z = abs(z)
local t_heat = 0
local t_heat_scale = 0.0071875
local t_heat_factor = 0
--local t_heat_mid = ((mg_v6.mg_map_size * mg_v6.mg_world_scale) * 0.25)
local t_heat_mid = 15000
local t_diff = abs(t_heat_mid - t_z)
if t_z >= t_heat_mid then
t_heat_factor = t_heat_scale * -1
elseif t_z <= t_heat_mid then
t_heat_factor = t_heat_scale
end
local t_map_scale = t_heat_factor
return t_diff * t_map_scale
else
return 0
end
end
local function rangelim(v, min, max)
if v < min then return min end
if v > max then return max end
return v
end
local function get_v6_base(terrain_base, terrain_higher,
steepness, height_select)
local base = 1 + terrain_base
local higher = 1 + terrain_higher
-- Limit higher ground level to at least base
if higher < base then
higher = base
end
-- Steepness factor of cliffs
local b = steepness
b = rangelim(b, 0.0, 1000.0)
b = 5 * b * b * b * b * b * b * b
b = rangelim(b, 0.5, 1000.0)
-- Values 1.5...100 give quite horrible looking slopes
if b > 1.5 and b < 100.0 then
if b < 10 then
b = 1.5
else
b = 100
end
end
local a_off = -0.20 -- Offset to more low
local a = 0.5 + b * (a_off + height_select);
a = rangelim(a, 0.0, 1.0) -- Limit
return math.floor(base * (1.0 - a) + higher * a)
end
local function get_v6_height(z,x)
local terrain_base = minetest.get_perlin(mgv6_np_terrain_base):get_2d({
x = x + 0.5 * mgv6_np_terrain_base.spread.x,
y = z + 0.5 * mgv6_np_terrain_base.spread.y})
local terrain_higher = minetest.get_perlin(mgv6_np_terrain_higher):get_2d({
x = x + 0.5 * mgv6_np_terrain_higher.spread.x,
y = z + 0.5 * mgv6_np_terrain_higher.spread.y})
local steepness = minetest.get_perlin(mgv6_np_steepness):get_2d({
x = x + 0.5 * mgv6_np_steepness.spread.x,
y = z + 0.5 * mgv6_np_steepness.spread.y})
local height_select = minetest.get_perlin(mgv6_np_height_select):get_2d({
x = x + 0.5 * mgv6_np_height_select.spread.x,
y = z + 0.5 * mgv6_np_height_select.spread.y})
return get_v6_base(terrain_base, terrain_higher, steepness, height_select) + 2 -- (Dust)
end
local mapgen_times = {
liquid_lighting = {},
loop2d = {},
loop3d = {},
mainloop = {},
make_chunk = {},
noisemaps = {},
preparation = {},
setdata = {},
writing = {},
}
local data = {}
minetest.register_on_generated(function(minp, maxp, seed)
-- Start time of mapchunk generation.
local t0 = os.clock()
local x1 = maxp.x
local y1 = maxp.y
local z1 = maxp.z
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
local sidelen = maxp.x - minp.x + 1
local permapdims2d = {x = sidelen, y = sidelen, z = 0}
local permapdims3d = {x = sidelen, y = sidelen, z = sidelen}
local minpos3d = {x = x0, y = y0, z = z0}
local minpos2d = {x = x0, y = z0}
nobj_cave = nobj_cave or minetest.get_perlin_map(mgv6_np_cave, permapdims3d)
--local nvals_cave = nobj_cave:get3dMap_flat(minpos3d)
nvals_cave = nobj_cave:get3dMap_flat(minpos3d)
nobj_filler_depth = nobj_filler_depth or minetest.get_perlin_map(np_v6_filler_depth, permapdims2d)
nbuf_filler_depth = nobj_filler_depth:get_2d_map(minpos2d)
nobj_heatmap = nobj_heatmap or minetest.get_perlin_map(np_heat, permapdims2d)
nbuf_heatmap = nobj_heatmap:get_2d_map(minpos2d)
nobj_heatblend = nobj_heatblend or minetest.get_perlin_map(np_heat_blend, permapdims2d)
nbuf_heatblend = nobj_heatblend:get_2d_map(minpos2d)
nobj_humiditymap = nobj_humiditymap or minetest.get_perlin_map(np_humid, permapdims2d)
nbuf_humiditymap = nobj_humiditymap:get_2d_map(minpos2d)
nobj_humidityblend = nobj_humidityblend or minetest.get_perlin_map(np_humid_blend, permapdims2d)
nbuf_humidityblend = nobj_humidityblend:get_2d_map(minpos2d)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
data = vm:get_data()
local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local csize = vector.add(vector.subtract(maxp, minp), 1)
local center_of_chunk_x = maxp.x - (sidelen / 2)
local center_of_chunk_z = maxp.z - (sidelen / 2)
-- Mapgen preparation is now finished. Check the timer to know the elapsed time.
local t1 = os.clock()
local write = false
--2D HEIGHTMAP GENERATION
local index2d = 0
local mean_alt = 0
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
index2d = (z - minp.z) * csize.x + (x - minp.x) + 1
local t_y = get_v6_height(z,x)
gal.mapgen.heightmap[index2d] = t_y
mg_v6.fillermap[index2d] = nbuf_filler_depth[z-minp.z+1][x-minp.x+1]
if minp.y > YMAX or maxp.y < YMIN then
return
end
local nheat = (nbuf_heatmap[z-minp.z+1][x-minp.x+1] + nbuf_heatblend[z-minp.z+1][x-minp.x+1]) + get_heat_scalar(z)
local nhumid = nbuf_humiditymap[z-minp.z+1][x-minp.x+1] + nbuf_humidityblend[z-minp.z+1][x-minp.x+1]
gal.mapgen.biomemap[index2d] = gal.mapgen.get_biome_name(nheat,nhumid,t_y)
if z == center_of_chunk_z and x == center_of_chunk_x then
gal.mapgen.chunk_biome = gal.mapgen.biomemap[index2d]
end
mean_alt = mean_alt + t_y
--## SPAWN SELECTION
if z == player_spawn_point.z then
if x == player_spawn_point.x then
player_spawn_point.y = t_y
end
end
if z == origin_y_val.z then
if x == origin_y_val.x then
origin_y_val.y = t_y
end
end
end
end
gal.mapgen.chunk_mean_altitude = mean_alt / ((x1 - x0) * (z1 - z0))
local t2 = os.clock()
local t3 = os.clock()
--2D HEIGHTMAP RENDER
local nixyz = 1
local index2d = 0
for z = minp.z, maxp.z do
for y = minp.y, maxp.y do
--local vi = area:index(x0, y, z)
local tcave
if y < yblmin then
tcave = TCAVE + ((yblmin - y) / BLEND) ^ 2
elseif y > yblmax then
tcave = TCAVE + ((y - yblmax) / BLEND) ^ 2
else
tcave = TCAVE
end
for x = minp.x, maxp.x do
index2d = (z - minp.z) * csize.x + (x - minp.x) + 1
local ivm = a:index(x, y, z)
local nheat = nbuf_heatmap[z-minp.z+1][x-minp.x+1] + nbuf_heatblend[z-minp.z+1][x-minp.x+1]
local nhumid = nbuf_humiditymap[z-minp.z+1][x-minp.x+1] + nbuf_humidityblend[z-minp.z+1][x-minp.x+1]
local theight = gal.mapgen.heightmap[index2d]
local t_fillmap = mg_v6.fillermap[index2d]
local t_biome_name = gal.mapgen.biomemap[index2d]
local fill_depth = 4
local top_depth = 1
--BUILD BIOMES.
local t_air = gal.mapgen.c_air
local t_ignore = gal.mapgen.c_ignore
local t_top = gal.mapgen.c_top
local t_filler = gal.mapgen.c_filler
local t_stone = gal.mapgen.c_stone
local t_water = gal.mapgen.c_water
local t_river = gal.mapgen.c_river
local t_riverbed = gal.mapgen.c_gravel
local t_riverbed_depth = 5
local t_ice = gal.mapgen.c_ice
local t_mud = gal.mapgen.c_mud
t_stone = gal.mapgen.biome_info[t_biome_name].b_stone
t_filler = gal.mapgen.biome_info[t_biome_name].b_filler
local t_filldepth = fill_depth + t_fillmap
t_top = gal.mapgen.biome_info[t_biome_name].b_top
top_depth = 1
t_water = gal.mapgen.biome_info[t_biome_name].b_water
t_river = gal.mapgen.biome_info[t_biome_name].b_river
t_riverbed = gal.mapgen.biome_info[t_biome_name].b_riverbed
t_riverbed_depth = gal.mapgen.biome_info[t_biome_name].b_riverbed_depth
local max_high = max_highland + (nheat * mg_world_scale) - (nhumid * mg_world_scale)
local max_mount = max_mountain + (nheat * mg_world_scale) - (nhumid * mg_world_scale)
if theight > max_high then
t_top = t_stone
t_filler = t_stone
t_stone = t_stone
t_water = t_water
t_river = t_ice
end
if theight > max_mount then
t_top = t_ice
t_filler = t_stone
t_stone = t_stone
t_water = t_ice
t_river = t_ice
end
--NODE PLACEMENT FROM HEIGHTMAP
local t_node = t_ignore
local t_cave = false
if nvals_cave[nixyz] > tcave then
--data[vi] = c_air
t_cave = true
end
--2D Terrain
if y < (theight - (fill_depth + top_depth)) then
if t_cave == false then
t_node = t_stone
else
t_node = t_air
end
elseif y >= (theight - (fill_depth + top_depth)) and y < (theight - top_depth) then
if t_cave == false then
t_node = t_filler
else
t_node = t_air
end
elseif y >= (theight - top_depth) and y <= theight then
if t_cave == false then
t_node = t_top
else
t_node = t_air
end
elseif y > theight and y <= mg_v6.water_level then
--Water Level (Sea Level)
if t_cave == false then
t_node = t_water
else
t_node = t_water
end
end
data[ivm] = t_node
nixyz = nixyz + 1
--vi = vi + 1
write = true
end
end
end
local t4 = os.clock()
if write then
vm:set_data(data)
end
local t5 = os.clock()
if write then
minetest.generate_ores(vm,minp,maxp)
minetest.generate_decorations(vm,minp,maxp)
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
end
local t6 = os.clock()
if write then
vm:write_to_map()
end
local t7 = os.clock()
-- Print generation time of this mapchunk.
local chugent = math.ceil((os.clock() - t0) * 1000)
print ("[mg_v6] Mapchunk generation time " .. chugent .. " ms")
table.insert(mapgen_times.noisemaps, 0)
table.insert(mapgen_times.preparation, t1 - t0)
table.insert(mapgen_times.loop2d, t2 - t1)
table.insert(mapgen_times.loop3d, t3 - t2)
table.insert(mapgen_times.mainloop, t4 - t3)
table.insert(mapgen_times.setdata, t5 - t4)
table.insert(mapgen_times.liquid_lighting, t6 - t5)
table.insert(mapgen_times.writing, t7 - t6)
table.insert(mapgen_times.make_chunk, t7 - t0)
-- Deal with memory issues. This, of course, is supposed to be automatic.
local mem = math.floor(collectgarbage("count")/1024)
if mem > 1000 then
print("mg_v6 is manually collecting garbage as memory use has exceeded 500K.")
collectgarbage("collect")
end
end)
local function mean( t )
local sum = 0
local count= 0
for k,v in pairs(t) do
if type(v) == 'number' then
sum = sum + v
count = count + 1
end
end
return (sum / count)
end
minetest.register_on_shutdown(function()
if mg_v6.mg_add_voronoi == true then
mg_v6.save_neighbors()
end
if #mapgen_times.make_chunk == 0 then
return
end
local average, standard_dev
minetest.log("mg_v6 lua Mapgen Times:")
average = mean(mapgen_times.liquid_lighting)
minetest.log(" liquid_lighting: - - - - - - - - - - - - "..average)
average = mean(mapgen_times.loop2d)
minetest.log(" 2D Noise loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.loop3d)
minetest.log(" 3D Noise loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.mainloop)
minetest.log(" Main Render loops: - - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.make_chunk)
minetest.log(" makeChunk: - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.noisemaps)
minetest.log(" noisemaps: - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.preparation)
minetest.log(" preparation: - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.setdata)
minetest.log(" writing: - - - - - - - - - - - - - - - - "..average)
average = mean(mapgen_times.writing)
minetest.log(" writing: - - - - - - - - - - - - - - - - "..average)
end)
minetest.log(S("[MOD] mg_v6: Successfully loaded."))
Enjoy!
Shad
-
- Member
- Posts: 22
- Joined: Sun May 30, 2021 07:25
- GitHub: gramsey
- IRC: BigBear
- In-game: BigBear
Re: More Beautiful Mapgen Ever?
In survival I normally play either v7 or valleys.
v7 - The rugged landscape is interesting. I like building bridges, cliff face houses etc. so the cliffs and extreme landscape suits this. great mapgen.
Valleys - Another great mapgen, but calmer than v7. The rivers are amazing <3 . If i am not in the mood for cliffs, i prefer it over v7.
Carpathian is another solid option, and fractal isn't half bad either (it isn't just a novelty entry), but I don't really see any reason to choose them over valleys - which has similar game play and I find preferable. v5 is still pretty cool too, interesting but kinda weird with all the stuff floating around, good for bridge building, but i would normally choose v7 (with floatlands) over v5.
I don't really understand why v6 is still around when we have these great alternatives.
v7 - The rugged landscape is interesting. I like building bridges, cliff face houses etc. so the cliffs and extreme landscape suits this. great mapgen.
Valleys - Another great mapgen, but calmer than v7. The rivers are amazing <3 . If i am not in the mood for cliffs, i prefer it over v7.
Carpathian is another solid option, and fractal isn't half bad either (it isn't just a novelty entry), but I don't really see any reason to choose them over valleys - which has similar game play and I find preferable. v5 is still pretty cool too, interesting but kinda weird with all the stuff floating around, good for bridge building, but i would normally choose v7 (with floatlands) over v5.
I don't really understand why v6 is still around when we have these great alternatives.
-
- Member
- Posts: 172
- Joined: Sat Mar 27, 2021 22:06
- In-game: DOOM_possum
Re: More Beautiful Mapgen Ever?
v7 seems to be the Ultimate Answer for mesecon technology
so far it has taken Me everywhere i want to go, not to mention the excellent database, that enhances It
so far it has taken Me everywhere i want to go, not to mention the excellent database, that enhances It
Re: More Beautiful Mapgen Ever?
There is a modified version of v6 that adds support for biomes, I do not know if it will be merged into the engine.
viewtopic.php?f=7&t=26751
viewtopic.php?f=7&t=26751
Re: More Beautiful Mapgen Ever?
I will go for Carpathian, flat and beautiful mountains. No oceans but I hate oceans ;-D
-
- Member
- Posts: 307
- Joined: Wed Apr 21, 2021 03:05
- GitHub: tigercoding56
- In-game: bm5 or bemo5 also sell_her_on55
Re: More Beautiful Mapgen Ever?
the lua mapgen mapgen with rivers i wish it was in c++ (speeeed ) and had biome compatibility (biomegen crashes with naturalbiomes installed )
this is a signature not a place to post messages also if i could change my username i would change it to sell_her_on55
Who is online
Users browsing this forum: No registered users and 23 guests