1
0
mirror of git://repo.or.cz/rocks.git synced 2024-09-28 23:30:39 +02:00
Realistic underground (geologic) mapgen for Minetest
Go to file
2015-01-11 11:18:33 +01:00
textures Copied geologica textures. 2015-01-11 11:18:33 +01:00
a.txt Documentation of the api. 2014-12-29 22:28:51 +01:00
coal-pane0.png Add documentation page and some screenshots. 2014-12-28 14:52:27 +01:00
depends.txt Basic layer and rock generation. 2014-12-24 23:42:36 +01:00
geologica_nv.lua Added more layers from geologica. 2015-01-11 11:16:16 +01:00
geologica.lua Copied geologica textures. 2015-01-11 11:18:33 +01:00
init.lua Added more layers from geologica. 2015-01-11 11:16:16 +01:00
layers0.png Add documentation page and some screenshots. 2014-12-28 14:52:27 +01:00
mapgen.lua Removed debugging shit. 2015-01-10 16:05:32 +01:00
readme.md SymLink to docs. 2014-12-28 15:31:33 +01:00
register.lua Vein generator working with 1 3d perlin per vein and 1 prng per ore. 2014-12-29 21:47:55 +01:00
vein0.png Screenshot of some debug vein. 2014-12-29 21:49:45 +01:00

Geological layer generator for [Minetest] "rocks"

Aim of this mod is to replace all generic stone (default:stone) and generate underground layers of different rocks.

Currently everithing generated above ground, in air. This is for debugging.

Features

  • layers of different rocks: sort of working
  • ore veins: nothing
  • extensibility, api: ok

** Work in progress! **

Screenshots

  • Layers: sample of layers
  • Coal pane: large coal deposit
  • Vein: sample of generated vein

Documentation

How the underground is generated: todo.

Underground is divided into horizontal layers. Bottom of each layer is at fixed height and moved up or down by 2d perlin noise.

In every layer there can be multiple veins. Veins are blob-shaped volumes of different rocks. Borders of vein are defined by 3d perlin noise. Veins often contain ores.

In every vein, ores are distributed randomly. Some ores may occur in specific areas of the vein (where noise is higher than treshold) or distributed randomly in specific amount (chance based on pseudorandom number) or combination of both.

There is 1 2d perlin noise per layer, 1 3d perlin noise per vein and 1 pseudorandom number generator per ore.

Modding Interface

"Rocks" exposes api to add new ores, veins and layers. The api is defined in register.

Register layer

rocks.register_layer=function(name,params,rock)

This function registers a layer. Layer is identified by unique string name. Location of layer is specified in params and node, the layer should be composed of is defined by rock.

Field "params.gain" sets how height of the layer should vary. Field "params.height" sets height of bottom of the layer. Field "params.limit" is value of noise above which the layer is not generated. Set to 2 to disable this feature. Last field "params.seed" is offset to world seed to seed the noise.

Register vein

rocks.register_vein=function(name,params)

This function registers a vein with name "name" to be generated according to params.

Field "params.spread" {x,y,z} defines how the vein should look like. X shoudd be equal to z. If y=x=z then the vein is equal in all directions. To make the vein taller, set y to higher value. Larger values make larger and less frequent veins.

Field "params.treshold" specifies rarity of the vein. It should be betveen -2 and +2, mapgen will use this or per-ore treshold if per-ore treshold is larger.

  • 2 never generate
  • 1 extremly rare
  • 0 50% chance
  • less than 0 = SPAM

Field "params.seed" is added to world seed to form seed for noise function.

Depths, where the wein should generate can be controlled by fields hmin and hmax. They can be set to nil to generate everywhere.

Layers, where the vein should generate in must be listed in Field "params.layer".

Register ore

rocks.register_ore=function( vein, node, params )

This function registers ore or rock to be generated in vein "vein". Node to be generated is "node". Params specify parameters, where the rock should spawn.

If noise is larger than Params.treshold, the ore is spawned (set to 2 to spawn everywhere in the vein, 0.8=only in middle). Params.chance specify the chance (/100%) of ore being spawned (0=never 1=always 0.5=50%).

If multiple ores pass the treshhold and chance tests, ore with highest treshold and smallest chance is spawned.