[Mod] Mudflow mapgen [0.3.0] [stability]

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

[Mod] Mudflow mapgen [0.3.0] [stability]

by paramat » Tue Feb 04, 2014 05:16

Image


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.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Tue Feb 04, 2014 22:20

Fascinating. So little code and it works like a charm.

I already have a mod idea where this will be perfect for.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Feb 04, 2014 23:10

Cool, im happy it's useful. I might as a next step release an example mod that adds 2D noise for biomes, to show how to combine 2D 'per column' noise and 3D noise within the ZYX order mapgen loop, it's all to do with calculating 2D noise indexes.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sun Feb 09, 2014 01:40

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.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local grad = (TCEN - y) / GRAD
local density = nvals_terrain[ni] + grad

'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.

Image

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local grad = math.atan((TCEN - y) / GRAD) * 0.8
local density = nvals_terrain[nixyz] + grad

The * 0.8 can be adjusted to tune the number / size of the floatlands and caves.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sun Feb 09, 2014 03:36

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.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Feb 21, 2014 08:16

Version 0.2.0.
The stability table has been improved and now counts the number of consecutive stone nodes in a vertical column, and only places sand if there are 2 (or any other chosen number of) consecutive stone nodes below.
There are comments in the code to explain how it works.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Wed Mar 26, 2014 22:34

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
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
waty = (80 * math.floor((WATY + 32) / 80)) - 32 + 15

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.
Last edited by paramat on Wed Mar 26, 2014 22:36, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

by spillz » Wed Mar 26, 2014 23:11

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)
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Mar 27, 2014 00:02

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?
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Mar 27, 2014 00:13

Missing water surface is fixed for me by setting water surface to be within a 16^3 mapblock instead of at the mapblock border :) New version coming soon.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

by spillz » Thu Mar 27, 2014 01:10

Your workaround does appear to fix the problem, but isn't this really an engine bug that should be fixed?
Last edited by spillz on Thu Mar 27, 2014 01:10, edited 1 time in total.
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

by spillz » Thu Mar 27, 2014 01:12

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?


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.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
                if(d >= 4)
                {
                    if(block->getDayNightDiff() == false)
                        continue;
                }
   

https://github.com/minetest/minetest/blob/master/src/clientiface.cpp#L279
Last edited by spillz on Thu Mar 27, 2014 01:13, edited 1 time in total.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Mar 27, 2014 01:27

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
Last edited by paramat on Thu Mar 27, 2014 01:39, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
pop_harte
Member
 
Posts: 27
Joined: Sun Mar 23, 2014 07:39

by pop_harte » Thu Mar 27, 2014 13:00

i don't understand. what's that mod doing?
 

User avatar
pop_harte
Member
 
Posts: 27
Joined: Sun Mar 23, 2014 07:39

by pop_harte » Thu Mar 27, 2014 13:02

i don't understand. what's that mod doing?were.
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

by spillz » Thu Mar 27, 2014 13:09

Making a beautiful world of stone and sand (you need to teleport to elevation 7000 or thereabouts)
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Mar 27, 2014 22:07

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.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

spillz
Member
 
Posts: 138
Joined: Thu Feb 13, 2014 05:11

by spillz » Thu Mar 27, 2014 22:10

Paramat: do you still have the grass generation issue if you use singlenode?
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Thu Mar 27, 2014 22:48

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.
Last edited by paramat on Fri Mar 28, 2014 02:03, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: [Mod] Mudflow mapgen [0.3.0] [stability]

by burli » Sat May 21, 2016 08:11

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
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: [Mod] Mudflow mapgen [0.3.0] [stability]

by paramat » Sun May 22, 2016 03:29

Mgv6 mudflow is different to this.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: [Mod] Mudflow mapgen [0.3.0] [stability]

by paramat » Sun May 22, 2016 04:26

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.
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 9 guests

cron