cave generating

User avatar
fireuser
Member
 
Posts: 21
Joined: Wed Jul 02, 2014 21:05

cave generating

by fireuser » Sat Aug 16, 2014 23:29

I'm new to the forums and I need some help with modding. I want to change the cave size and the amount of caves generated. How do I do so? I am using minetest_game and no magpen mods...
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: cave generating

by HeroOfTheWinds » Sun Aug 17, 2014 02:20

This is an interesting question, but unfortunately I can only answer it partway.

For one thing, it is impossible to use Lua to change the default mapgen's cave generation parameters directly. However, you CAN change the minetest.conf file through Lua, using these settings (the #'s are comments):

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
# Perlin noise attributes for different map generation parameters
# Offset, scale, spread factor, seed offset, number of octaves, persistence

#mgv6_np_cave = 6, 6, (250, 250, 250), 34329, 3, 0.50

So by editing the values for mgv6_np_cave, you can affect how the caves are generated. Here, I believe the values you would be interested the most in are the 2nd (scale = 6), 3rd (spread = (250,250,250)), 5th (octaves = 3), and 6th (persistance = 0.5).
The scale controls the "volume" of the noise that makes the caves: a larger value makes larger caves, which are somewhat farther apart because the gaps are also amplified.
The spread has similar effects (paramat could tell you better), but the upshot of changing THESE values is that you can "squash" or "stretch" the structure of the caves by say, cutting the 2nd (y) value in half to make the caves shorter in height.
The octaves control how many times the noise calculation is performed on the terrain. A higher value smooths things out in the long run while also slightly increasing the maximum and minimum values that can be reached. This can greatly affect structure and even frequency of caves.
Finally, the persist is directly tied to the octaves: it is the value that the base is multiplied by for each octave. 0.5 is default, 0.6 is a slightly rougher value used in the industry, and 0.67 is a favorite among minetest modders because of the extreme terrains it makes (look at watershed!).

Alternatively, you can tweak the C++ code directly and recompile it yourself (not recommended), or make a lua on_mapgen mod to add even more caves. If you choose that route, look at paramat's subterrain mod for a simple example or my CaveRealms for a detailed example.

Hope this helps!
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: cave generating

by philipbenr » Sun Aug 17, 2014 04:19

So it looks like my younger brother asked for help here instead of asking me again. (I don't know, now will you stop asking me? ; )

I had a feeling it had something to do with minetest.conf... That was my first guess, although I didn't know what I would specify/change.

Welcome to the forums, bro.
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 11 guests

cron