Version 0.2.0
This commit is contained in:
parent
b5bde42184
commit
56dd643d38
20
README.txt
20
README.txt
@ -1,22 +1,14 @@
|
|||||||
Release thread http://forum.minetest.net/viewtopic.php?id=5159
|
Release thread http://forum.minetest.net/viewtopic.php?id=5159
|
||||||
For Minetest 0.4.3 and later.
|
For latest stable Minetest and compatible back to 0.4.3.
|
||||||
Depends default.
|
Depends default.
|
||||||
License WTFPL.
|
License WTFPL.
|
||||||
|
|
||||||
* A way up to the float lands.
|
* Meru mod is a vertical 1 dimensional realm, 1D referring to large scale structure, and can act as a vertical connector between horizontal realms, such as the ground and the floatlands.
|
||||||
|
|
||||||
* This mod generates a 1 km mountain / tower thing at a chosen position in a newly generated chunk. The lower section has a hollow core surrounded by caves and ledges that help with carving steps to the top. When generated over water the hollow core can be used for jumping down the last 300m.
|
* A single spike shaped mountain is created in newly generated chunks, at a random location within a chosen area; by default this area is +/-1024 for use in a new world, to add a mountain to an existing world you need to edit these area parameters to a completely ungenerated part of your world.
|
||||||
|
|
||||||
* By default this generates near x = 0, z = 272 for testing in new worlds, for any other use you will need to edit the co-ordinate parameters to an ungenerated location.
|
* For testing this mod or for cheating edit parameter COORD = true, the co-ordinates of the mountain will be printed to terminal while within the generation area.
|
||||||
|
|
||||||
* Constructed from stone or red desert stone dependant on biome, when on a biome transition there is a smooth transition of material creating red stripes.
|
* No new nodes, the mountain is a hollow cone made of stone and desert stone, with a smooth transition across biome boundaries creating the red stripes. By default the height is 1km, but since i have increased the maximum width to 3x3 chunks the mountain can still look well proportioned when 2km. There are a few cave entrances on the surface, these 'fissure system' caves expand under the surface helping the creation of a path upwards. If the mountain generates over water you can use the central conical void to jump down the last few hundred metres.
|
||||||
|
|
||||||
* The structure is limited to y = -32 to 1008, 13 chunks in height, and occupies an area of 2x2 chunks. This large area allows a wider structure if wanted, controlled by parameter HGRAD. Parameter VGRAD controls how fast the structure tapers with altitude.
|
* There are many parameters for fine tuning the structure, some parameters change smoothly with height or distance from the center. Reducing noise to zero at the center creates a perfect spike as a summit. Constant noise throughout often creates floating islands at the summit. Choosing zero noise throughout creates a smooth geometric conical shape. There is a parameter CONVEX to control whether the basic conical structure bulges outwards or is pinched inwards in the middle.
|
||||||
|
|
||||||
* The lower chunks can take up to 2 minutes to generate depending on tower width.
|
|
||||||
|
|
||||||
* No new nodes.
|
|
||||||
|
|
||||||
* Grass and trees often spawn on the structure, caused by a cool mapgen bug.
|
|
||||||
|
|
||||||
* I refer to the Mount Meru of ancient eastern cosmology.
|
|
||||||
|
171
init.lua
171
init.lua
@ -1,95 +1,128 @@
|
|||||||
-- meru 0.1.0 by paramat.
|
-- meru 0.2.0 by paramat.
|
||||||
-- License WTFPL, see license.txt.
|
-- License WTFPL.
|
||||||
|
|
||||||
-- Editable parameters.
|
-- Parameters.
|
||||||
|
|
||||||
local MERU = false
|
local ONGEN = true -- (true / false) Enable / disable generation.
|
||||||
local MERUX = 0 -- Approximate centre, will be rounded to nearest chunk.
|
local PROG = true -- Print processing progess to terminal.
|
||||||
local MERUZ = 272
|
local COORD = false -- Print tower co-ordinates to terminal.
|
||||||
local VGRAD = 448 -- 448 -- Vertical noise gradient. Height is approx twice this.
|
|
||||||
local HGRAD = 24 -- 24 -- Horizontal noise gradient. Radius is approx twice this.
|
|
||||||
local CAVOFF = 0.8 -- 0.8 -- Cave noise offset.
|
|
||||||
local DEBUG = true
|
|
||||||
|
|
||||||
local SEEDDIFF1 = 4689 -- 3D noise for surface generation
|
local XMIN = -1024 -- Area for random spawn.
|
||||||
local OCTAVES1 = 5 -- 5
|
local XMAX = 1024
|
||||||
local PERSISTENCE1 = 0.53 -- 0.53
|
local ZMIN = -1024
|
||||||
local SCALE1 = 64 -- 64
|
local ZMAX = 1024
|
||||||
|
|
||||||
local SEEDDIFF2 = 9294 -- 3D noise for caves.
|
local BASRAD = 64 -- -- Average radius y = -32.
|
||||||
local OCTAVES2 = 2 -- 2
|
local HEIGHT = 1024 -- -- Approximate height measured from y = -32.
|
||||||
local PERSISTENCE2 = 0.5 -- 0.5
|
local CONVEX = 0.6 -- -- Convexity. 0.5 = concave, 1 = perfect cone, 2 = convex.
|
||||||
local SCALE2 = 8 -- 8
|
local VOID = 0.4 -- -- Void threshold. Controls size of central voids.
|
||||||
|
local NOISYRAD = 0.2 -- -- Noisyness of structure at base radius. 0 = smooth geometric form, 0.3 = noisy.
|
||||||
|
local NOISYCEN = 0 -- -- Noisyness of structure at centre.
|
||||||
|
local FISOFFBAS = 0.02 -- -- Fissure noise offset at base. controls amount / size of fissure entrances on outer surface.
|
||||||
|
local FISOFFTOP = 0.04 -- -- Fissure noise offset at top.
|
||||||
|
local FISEXPBAS = 0.6 -- -- Fissure expansion rate under surface at base.
|
||||||
|
local FISEXPTOP = 1.2 -- -- Fissure expansion rate under surface at top.
|
||||||
|
|
||||||
-- End of editable parameters.
|
local SEEDDIFF1 = 46893 -- 3D noise for primary structure.
|
||||||
|
local OCTAVES1 = 5 --
|
||||||
|
local PERSISTENCE1 = 0.5 --
|
||||||
|
local SCALE1 = 64 --
|
||||||
|
|
||||||
local SEEDDIFF3 = 9130 -- 9130 -- Values must match minetest mapgen desert perlin.
|
local SEEDDIFF2 = 92940980987 -- 3D noise for fissures.
|
||||||
|
local OCTAVES2 = 4 --
|
||||||
|
local PERSISTENCE2 = 0.5 --
|
||||||
|
local SCALE2 = 24 --
|
||||||
|
|
||||||
|
-- End of parameters.
|
||||||
|
|
||||||
|
meru = {}
|
||||||
|
|
||||||
|
local SEEDDIFF3 = 9130 -- 9130 -- Values should match minetest mapgen desert perlin.
|
||||||
local OCTAVES3 = 3 -- 3
|
local OCTAVES3 = 3 -- 3
|
||||||
local PERSISTENCE3 = 0.5 -- 0.5
|
local PERSISTENCE3 = 0.5 -- 0.5
|
||||||
local SCALE3 = 250 -- 250
|
local SCALE3 = 250 -- 250
|
||||||
|
|
||||||
-- Stuff.
|
local SEEDDIFF4 = 5839090
|
||||||
|
local OCTAVES4 = 2 -- 2
|
||||||
|
local PERSISTENCE4 = 0.5 -- 0.5
|
||||||
|
local SCALE4 = 3 -- 3
|
||||||
|
|
||||||
meru = {}
|
local cxmin = math.floor((XMIN + 32) / 80) -- chunk co ordinates
|
||||||
|
local czmin = math.floor((ZMIN + 32) / 80)
|
||||||
local meruxq = (80 * math.floor((MERUX + 32) / 80)) - 32
|
local cxmax = math.floor((XMAX + 32) / 80)
|
||||||
local meruzq = (80 * math.floor((MERUZ + 32) / 80)) - 32
|
local czmax = math.floor((ZMAX + 32) / 80)
|
||||||
|
local cxav = (cxmin + cxmax) / 2
|
||||||
|
local czav = (czmin + czmax) / 2
|
||||||
|
local xnom = (cxmax - cxmin) / 4
|
||||||
|
local znom = (czmax - czmin) / 4
|
||||||
|
|
||||||
-- On generated function.
|
-- On generated function.
|
||||||
|
|
||||||
if MERU then
|
if ONGEN then
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
if (minp.x == meruxq or minp.x == meruxq - 80)
|
if maxp.x >= XMIN and minp.x <= XMAX
|
||||||
and (minp.z == meruzq or minp.z == meruzq - 80)
|
and maxp.z >= ZMIN and minp.z <= ZMAX then
|
||||||
and minp.y >= -32 and minp.y <= 928 then
|
|
||||||
local env = minetest.env
|
local env = minetest.env
|
||||||
local perlin1 = env:get_perlin(SEEDDIFF1, OCTAVES1, PERSISTENCE1, SCALE1)
|
local perlin4 = env:get_perlin(SEEDDIFF4, OCTAVES4, PERSISTENCE4, SCALE4)
|
||||||
local perlin2 = env:get_perlin(SEEDDIFF2, OCTAVES2, PERSISTENCE2, SCALE2)
|
local noisex = perlin4:get2d({x=31,y=23})
|
||||||
local perlin3 = env:get_perlin(SEEDDIFF3, OCTAVES3, PERSISTENCE3, SCALE3)
|
local noisez = perlin4:get2d({x=17,y=11})
|
||||||
local xl = maxp.x - minp.x
|
local cx = cxav + math.floor(noisex * xnom) -- chunk co ordinates
|
||||||
local yl = maxp.y - minp.y
|
local cz = czav + math.floor(noisez * znom)
|
||||||
local zl = maxp.z - minp.z
|
local merux = 80 * cx + 8
|
||||||
local x0 = minp.x
|
local meruz = 80 * cz + 8
|
||||||
local y0 = minp.y
|
if COORD then
|
||||||
local z0 = minp.z
|
print ("[meru] x "..merux.." z "..meruz)
|
||||||
-- Loop through nodes in chunk.
|
end
|
||||||
for i = 0, xl do
|
if minp.x >= merux - 120 and minp.x <= merux + 40
|
||||||
-- For each plane do.
|
and minp.z >= meruz - 120 and minp.z <= meruz + 40
|
||||||
if DEBUG then
|
and minp.y >= -32 and minp.y <= HEIGHT * 1.2 then
|
||||||
print ("[meru] Plane "..i.." Chunk ("..minp.x.." "..minp.y.." "..minp.z..")")
|
local perlin1 = env:get_perlin(SEEDDIFF1, OCTAVES1, PERSISTENCE1, SCALE1)
|
||||||
end
|
local perlin2 = env:get_perlin(SEEDDIFF2, OCTAVES2, PERSISTENCE2, SCALE2)
|
||||||
for k = 0, zl do
|
local perlin3 = env:get_perlin(SEEDDIFF3, OCTAVES3, PERSISTENCE3, SCALE3)
|
||||||
-- For each column do.
|
local x1 = maxp.x
|
||||||
local x = x0 + i
|
local y1 = maxp.y
|
||||||
local z = z0 + k
|
local z1 = maxp.z
|
||||||
local noise3 = perlin3:get2d({x=x+150,y=z+50}) -- Offsets must match minetest mapgen desert perlin.
|
local x0 = minp.x
|
||||||
local desert = false
|
local y0 = minp.y
|
||||||
if noise3 > 0.45 or math.random(0,10) > (0.45 - noise3) * 100 then -- Smooth transition 0.35 to 0.45.
|
local z0 = minp.z
|
||||||
desert = true
|
-- Loop through nodes in chunk.
|
||||||
|
for x = x0, x1 do
|
||||||
|
-- For each plane do.
|
||||||
|
if PROG then
|
||||||
|
print ("[meru] Plane "..x - x0.." Chunk ("..minp.x.." "..minp.y.." "..minp.z..")")
|
||||||
end
|
end
|
||||||
for j = 0, yl do
|
for z = z0, z1 do
|
||||||
-- For each node do.
|
-- For each column do.
|
||||||
local y = y0 + j
|
local noise3 = perlin3:get2d({x=x+150,y=z+50}) -- Offsets must match minetest mapgen desert perlin.
|
||||||
local noise1 = perlin1:get3d({x=x,y=y,z=z})
|
local desert = false
|
||||||
local radius = ((x - meruxq) ^ 2 + (z - meruzq) ^ 2) ^ 0.5
|
if noise3 > 0.45 or math.random(0,10) > (0.45 - noise3) * 100 then -- Smooth transition 0.35 to 0.45.
|
||||||
local offset = - y / VGRAD - radius / HGRAD
|
desert = true
|
||||||
local noise1off = noise1 + offset + 2
|
end
|
||||||
if noise1off > 0 and noise1off < 1 then
|
for y = y0, y1 do
|
||||||
local noise2 = perlin2:get3d({x=x,y=y,z=z})
|
-- For each node do.
|
||||||
if noise2 - noise1off / 2 + CAVOFF > 0 then
|
local noise1 = perlin1:get3d({x=x,y=y,z=z})
|
||||||
if desert then
|
local radius = ((x - merux) ^ 2 + (z - meruz) ^ 2) ^ 0.5
|
||||||
env:add_node({x=x,y=y,z=z},{name="default:desert_stone"})
|
local deprop = (BASRAD - radius) / BASRAD
|
||||||
else
|
local noisy = NOISYRAD + deprop * (NOISYCEN - NOISYRAD)
|
||||||
env:add_node({x=x,y=y,z=z},{name="default:stone"})
|
local heprop = ((y + 32) / HEIGHT)
|
||||||
|
local offset = deprop - heprop ^ CONVEX
|
||||||
|
local noise1off = noise1 * noisy + offset
|
||||||
|
if noise1off > 0 and noise1off < VOID then
|
||||||
|
local noise2 = perlin2:get3d({x=x,y=y,z=z})
|
||||||
|
local fisoff = FISOFFBAS + heprop * (FISOFFTOP - FISOFFBAS)
|
||||||
|
local fisexp = FISEXPBAS + heprop * (FISEXPTOP - FISEXPBAS)
|
||||||
|
if math.abs(noise2) - noise1off * fisexp - fisoff > 0 then
|
||||||
|
if desert then
|
||||||
|
env:add_node({x=x,y=y,z=z},{name="default:desert_stone"})
|
||||||
|
else
|
||||||
|
env:add_node({x=x,y=y,z=z},{name="default:stone"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if DEBUG then
|
|
||||||
print ("[meru] Completed")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user