Snowy berg if humid. Harmonic noise returns. Flatter lowlands. New node icydirt: tundra surface

This commit is contained in:
paramat 2014-04-19 19:52:33 +01:00
parent ba596b269f
commit 410f1b39d1
5 changed files with 92 additions and 31 deletions

View File

@ -1,4 +1,4 @@
watershed 0.3.11 by paramat
watershed 0.3.12 by paramat
For latest stable Minetest back to 0.4.8
Depends default bucket
Licenses: code WTFPL, textures CC BY-SA

View File

@ -240,14 +240,30 @@ if SINGLENODE then
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 6,
persist = 0.63
persist = 0.67
}
local np_smooth = {
offset = 0,
scale = 1,
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 5,
persist = 0.33
}
local np_roughalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 6,
persist = 0.67
}
local np_smoothalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 5,
persist = 0.33
}
local np_base = {
@ -282,6 +298,8 @@ if SINGLENODE then
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz)
local nvals_smoothalt = minetest.get_perlin_map(np_smoothalt, chulens):get3dMap_flat(minposxyz)
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz)
@ -291,12 +309,18 @@ if SINGLENODE then
for z = z0, z1 do
for y = y0, y1 do
for x = x0, x1 do
local n_rough = nvals_rough[nixyz]
local n_smooth = nvals_smooth[nixyz]
local n_roughalt = nvals_roughalt[nixyz]
local n_smoothalt = nvals_smoothalt[nixyz]
local n_base = nvals_base[nixz]
local n_xlscale = nvals_xlscale[nixz]
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = (1 - math.abs(n_base)) * BASAMP + nvals_xlscale[nixz] * XLSAMP + grad
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad
local terblen = math.max(1 - math.abs(n_base), 0)
local density = densitybase
+ math.abs(nvals_rough[nixyz] * terblen + nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP
local density = densitybase +
math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.25 * (1 - terblen)) ^ CANEXP * CANAMP
if y >= 1 and density > -0.01 and density < 0 then
ysp = y + 1
xsp = x

View File

@ -1,11 +1,17 @@
-- watershed 0.3.11 by paramat
-- watershed 0.3.12 by paramat
-- For latest stable Minetest and back to 0.4.8
-- Depends default bucket
-- License: code WTFPL, textures CC BY-SA
-- Red cobble texture CC BY-SA by brunob.santos
-- bugfix spawn function
-- 2 iron ore layers
-- snowy iceberg only if humid enough
-- add rough alt, smooth alt noises for harmonic noise
-- persistence to 0.67 for rough noises
-- half scale of smooth noise for flatter lowlands
-- 1 less octave for smooth noise
-- fix sea ice in tundra at y = 47
-- removed snow from tundra
-- New icydirt surface node in tundra
-- Parameters
@ -63,7 +69,7 @@ local np_rough = {
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 6,
persist = 0.63
persist = 0.67
}
-- 3D noise for smooth terrain
@ -73,7 +79,29 @@ local np_smooth = {
scale = 1,
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 5,
persist = 0.33
}
-- 3D noise for alt rough terrain
local np_roughalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 6,
persist = 0.67
}
-- 3D noise for alt smooth terrain
local np_smoothalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 5,
persist = 0.33
}
@ -232,6 +260,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_wsfreshice = minetest.get_content_id("watershed:freshice")
local c_wscloud = minetest.get_content_id("watershed:cloud")
local c_wsluxoreoff = minetest.get_content_id("watershed:luxoreoff")
local c_wsicydirt = minetest.get_content_id("watershed:icydirt")
-- perlinmap stuff
local sidelen = x1 - x0 + 1 -- chunk sidelength
local chulens = {x=sidelen, y=sidelen+2, z=sidelen} -- chunk dimensions, '+2' for overgeneration
@ -240,6 +269,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- 3D and 2D perlinmaps
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz)
local nvals_smoothalt = minetest.get_perlin_map(np_smoothalt, chulens):get3dMap_flat(minposxyz)
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz)
local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz)
@ -268,6 +299,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- noise values for node
local n_rough = nvals_rough[nixyz]
local n_smooth = nvals_smooth[nixyz]
local n_roughalt = nvals_roughalt[nixyz]
local n_smoothalt = nvals_smoothalt[nixyz]
local n_fissure = nvals_fissure[nixyz]
local n_temp = nvals_temp[nixyz]
local n_humid = nvals_humid[nixyz]
@ -281,8 +314,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP -- vertical density gradient
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad -- base terrain
local terblen = math.max(1 - math.abs(n_base), 0) -- canyon terrain blend of rough and smooth
local density = densitybase
+ math.abs(n_rough * terblen + n_smooth * (1 - terblen)) ^ CANEXP * CANAMP -- add canyon terrain
local density = densitybase + -- add canyon terrain
math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.25 * (1 - terblen)) ^ CANEXP * CANAMP
-- other values
local triv = TRIV * (1 - terblen) -- river threshold
local tsand = TSAND * (1 - terblen) -- sand threshold
@ -495,16 +529,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
if y > YWAT and under[si] ~= 0 then
local fnoise = n_fissure -- noise for flower colours
if under[si] == 1 then
if math.random(121) == 2 then
data[viu] = c_snowblock
elseif math.random(121) == 2 then
data[viu] = c_wsfreshice
else
data[viu] = c_wsdrygrass
data[viu] = c_wsicydirt
if math.random(DRYCHA) == 2 then
data[vi] = c_dryshrub
end
end
elseif under[si] == 2 then
data[viu] = c_dirtsnow
data[vi] = c_snowblock
@ -573,11 +601,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
and biome >= 4 then
data[vi] = c_wsgoldengrass
end
elseif under[si] == 11 and n_temp > HITET then -- riverbank
elseif under[si] == 11 and n_temp > HITET then -- hot biome riverbank
if math.random(PAPCHA) == 2 then
watershed_papyrus(x, y, z, area, data)
end
elseif under[si] == 12 then -- iceberg
elseif under[si] == 12 and n_humid > LOHUT then -- snowy iceberg
data[vi] = c_snowblock
end
end
@ -587,13 +615,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif y == y1 + 1 then -- plane of nodes above chunk
if density < 0 and y >= YWAT + 1 and under[si] ~= 0 then -- if air above fine materials
if under[si] == 1 then -- add surface nodes to chunk top layer
if math.random(121) == 2 then
data[viu] = c_dirtsnow
elseif math.random(121) == 2 then
data[viu] = c_ice
else
data[viu] = c_wsdrygrass
end
data[viu] = c_wsicydirt
elseif under[si] == 2 then
data[viu] = c_dirtsnow
elseif under[si] == 3 then

View File

@ -24,6 +24,7 @@ minetest.register_node("watershed:acaciatree", {
description = "WS Acacia Tree",
tiles = {"watershed_acaciatreetop.png", "watershed_acaciatreetop.png", "watershed_acaciatree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
@ -44,6 +45,7 @@ minetest.register_node("watershed:pinetree", {
description = "WS Pine Tree",
tiles = {"watershed_pinetreetop.png", "watershed_pinetreetop.png", "watershed_pinetree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
@ -69,6 +71,18 @@ minetest.register_node("watershed:dirt", {
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("watershed:icydirt", {
description = "WS Icy Dirt",
tiles = {"watershed_icydirt.png"},
is_ground_content = false,
groups = {crumbly=1},
drop = "default:dirt",
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_snow_footstep", gain=0.15},
dug = {name="default_snow_footstep", gain=0.45},
}),
})
minetest.register_node("watershed:grass", {
description = "WS Grass",
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
@ -139,7 +153,7 @@ minetest.register_node("watershed:drygrass", {
description = "WS Dry Grass",
tiles = {"watershed_drygrass.png"},
is_ground_content = false,
groups = {crumbly=3,soil=1},
groups = {crumbly=1,soil=1},
drop = "default:dirt",
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
@ -150,7 +164,7 @@ minetest.register_node("watershed:permafrost", {
description = "WS Permafrost",
tiles = {"watershed_permafrost.png"},
is_ground_content = false,
groups = {crumbly=2},
groups = {crumbly=1},
drop = "default:dirt",
sounds = default.node_sound_dirt_defaults(),
})
@ -194,6 +208,7 @@ minetest.register_node("watershed:luxoreoff", {
description = "WS Lux Ore Off",
tiles = {"watershed_luxore.png"},
light_source = 14,
is_ground_content = false,
groups = {cracky=3},
drop = "watershed:luxcrystal 8",
sounds = default.node_sound_glass_defaults(),

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B