[Mod] Mudflow mapgen [0.3.0] [stability]
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
[Mod] Mudflow mapgen [0.3.0] [stability]
Download https://github.com/paramat/stability/archive/master.zip and rename folder to 'stability'
Browse code https://github.com/paramat/stability
stability 0.3.0 by paramat
For Minetest 0.4.11 or later
Depends default
Licenses: Code WTFPL
Use in a singlenode mapgen world. You might spawn underground so disable damage before starting a world, then enable freemove, switch 'noclip' if necessary and fly to find the surface.
Currently a simple mapgen example / tutorial / framework for developing and demonstrating a new stability system that emulates mudflow while adding surface material. Simple concept: only place a biome node if supported by all 9 nodes directly below it, essentially limiting dirt/sand steepness to 45 degrees, creating a slight pyramid look to the surface.
Last edited by paramat on Mon Feb 16, 2015 23:57, edited 4 times in total.
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Experimenting with this mod i had an idea to use an arctan density gradient instead of a linear one.
Basic 3D noise mapgen
Basic mapgen with 3D noise is done by calculating a sort-of density value for each node, then making that node solid if that value is above zero.
'density' is a combination of some 3D perlin noise and a linear density gradient 'grad' which decreases steadily (linearly) with altitude.
'grad' is what creates a land surface, if it wasnt there, the noise on it's own would create an asteroid field / floatlands type realm, if the noise wasnt there there would just be a completely flat world at y = TCEN, the average terrain level.
So the blend of the 2 creates rough terrain, at certain locations the 3D noise overpowers 'grad' to create overhangs and a few bits of floating terrain, likewise underground a few caves are formed near the surface, this is something that basic 2D noise mapgen cannot do.
Minetest mapgen V5 was in it's simplest form 3D noise plus gradient as described above.
Arctan density gradient
In my moonlet mod i had an idea to put positive and negative limits on 'grad', so that floatlands would continue to be generated throughout the atmosphere, and caves throughout the underground. These hard limits worked but the transitions sharp, i recently realised an arctan function is a smoothed version ideal for mapgen, near zero it is similar to the basic linear gradient, but then smoothly approaches the limits at roughly +/-1.5.
The * 0.8 can be adjusted to tune the number / size of the floatlands and caves.
Basic 3D noise mapgen
Basic mapgen with 3D noise is done by calculating a sort-of density value for each node, then making that node solid if that value is above zero.
Code: Select all
local grad = (TCEN - y) / GRAD
local density = nvals_terrain[ni] + grad
'grad' is what creates a land surface, if it wasnt there, the noise on it's own would create an asteroid field / floatlands type realm, if the noise wasnt there there would just be a completely flat world at y = TCEN, the average terrain level.
So the blend of the 2 creates rough terrain, at certain locations the 3D noise overpowers 'grad' to create overhangs and a few bits of floating terrain, likewise underground a few caves are formed near the surface, this is something that basic 2D noise mapgen cannot do.
Minetest mapgen V5 was in it's simplest form 3D noise plus gradient as described above.
Arctan density gradient
In my moonlet mod i had an idea to put positive and negative limits on 'grad', so that floatlands would continue to be generated throughout the atmosphere, and caves throughout the underground. These hard limits worked but the transitions sharp, i recently realised an arctan function is a smoothed version ideal for mapgen, near zero it is similar to the basic linear gradient, but then smoothly approaches the limits at roughly +/-1.5.
Code: Select all
local grad = math.atan((TCEN - y) / GRAD) * 0.8
local density = nvals_terrain[nixyz] + grad
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Instead of separate code and extra perlin noises for floatlands, the normal mapgen creates floatlands as a seamless extension of the surface realm, with the advantages of simplicity and generation speed.
Last edited by paramat on Mon Feb 16, 2015 23:57, edited 1 time in total.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Spillz, saw the discussion on IRC minetest about water, it might be because stability currently auto-sets water level to be on the edge of a 16x16x16mapblock, try changing the number at the end of this line
to something other than 15 or n*16 - 1. Perhaps if the water level is within a mapblock the surface might be drawn sooner.
I need to update this mod to use a dummy stone to avoid those aptched of grass and trees, i will also set water level within a mapblock.
Code: Select all
waty = (80 * math.floor((WATY + 32) / 80)) - 32 + 15
I need to update this mod to use a dummy stone to avoid those aptched of grass and trees, i will also set water level within a mapblock.
Last edited by paramat on Wed Mar 26, 2014 22:36, edited 1 time in total.
Maybe. Dropping the underground filtering seemed to do the trick too.
http://irc.minetest.ru/minetest/2014-03-26#i_3630084
No obvious adverse effect on performance either (but maybe on network performance)
http://irc.minetest.ru/minetest/2014-03-26#i_3630084
No obvious adverse effect on performance either (but maybe on network performance)
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Okay i tried stability mod and got the same bugs as you: missing water surface with terrain behind. By looking down at the 16x16 areas of water animation i discovered the missing water surfaces are just over 64 nodes away from the player, as soon as you move within 64 nodes the surface appears, and the missing bits of underwater terrain appear too. Perhaps part of the problem is that the realm is at y = 7000?
Btw, the 64 node limit is due to the below piece of code, which I dropped in my local copy and that made this issue much less prevalent too.paramat wrote:Okay i tried stability mod and got the same bugs as you: missing water surface with terrain behind. By looking down at the 16x16 areas of water animation i discovered the missing water surfaces are just over 64 nodes away from the player, as soon as you move within 64 nodes the surface appears, and the missing bits of underwater terrain appear too. Perhaps part of the problem is that the realm is at y = 7000?
Code: Select all
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
Last edited by spillz on Thu Mar 27, 2014 01:13, edited 1 time in total.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
So it seems a mapblock completely full of water has no 'daynightdiff' so is treated as underground and doesn't appear ... having air and water in the mapblock creates a daynightdiff so it appears. So yes this needs to be fixed, perhaps we could talk to hmmmm about it too, and whoever is the client/server dude.
EDIT
Version 0.2.1
EDIT
Version 0.2.1
Last edited by paramat on Thu Mar 27, 2014 01:39, edited 1 time in total.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
pop_harte, it's a simplified mapgen that is also a mapgen tutorial to show how this sand-stability system works, and also a mapgen framework that people (including myself) can use as a starting point, i actually use my 'noise23' mapgen as the starting point for many of my projects, because it has both 2D and 3D perlin noises.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Haven't tested that yet, i expect singlenode would not add grass because default mapgen is disabled.
EDIT
The grass bug isn't much of a problem, as using the mod's own nodes is better mapgen practice anyway, it's just laziness that i use so many default: nodes.
EDIT
The grass bug isn't much of a problem, as using the mod's own nodes is better mapgen practice anyway, it's just laziness that i use so many default: nodes.
Last edited by paramat on Fri Mar 28, 2014 02:03, edited 1 time in total.
Re: [Mod] Mudflow mapgen [0.3.0] [stability]
Can someome please explain me what mudflow exactly is? I now it has something to do with chunk borders and moving dirt. But why and how?
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod] Mudflow mapgen [0.3.0] [stability]
Mgv6 mudflow is different to this.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod] Mudflow mapgen [0.3.0] [stability]
Note with version 0.3.0 this mod has completely changed, see first post for details. All previous comments are not applicable to this code.
Re: [Mod] Mudflow mapgen [0.3.0] [stability]
Beautiful, I love this mod!!!!paramat wrote:Note with version 0.3.0 this mod has completely changed, see first post for details. All previous comments are not applicable to this code.
thanks for all your work!
R
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 76 guests