Sheet ore generation

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

Sheet ore generation

by SegFault22 » Tue Apr 15, 2014 23:39

I'm trying to get Minetest to generate a bunch of different ores in sheet formations. However, this often results in extremely huge lodes, or miniscule lodes.
So, I want to know what variables can control the frequency of lodes and the size of lodes. My experiments with such have failed horribly.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Wed Apr 16, 2014 01:09

An answer I put together a while ago:
Evergreen wrote:Okay, here is some example code for an ore.

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
minetest.register_ore({
    ore_type       = "scatter",
    ore            = "mod:stone_with_ore",
    wherein        = "default:stone",
    clust_scarcity = 8*8*8,
    clust_num_ores = 8,
    clust_size     = 3,
    height_min     = -31000,
    height_max     = 64,
})


To quote the dev wiki:

ore_type: See Ore types
ore: The name of the ore node
wherein: The node that the ore will generate inside of
clust_scarcity: Ore has a 1 out of clust_scarcity chance of spawning in a node.
clust_num_ores: Number of ores in a cluster
clust_size: Size of the bounding box of the cluster
height_min: The lowest level that the ore will generate at
height_max: The highest level that the ore will generate at
noise_threshhold: If noise is above this threshold, ore is placed. Not needed for a uniform distribution
noise_params: NoiseParams structure describing the perlin noise used for ore distribution


Also, the possible ore types are:

scatter

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
Randomly chooses a location and generates a cluster of ore.
If noise_params is specified, the ore will be placed if the 3d perlin noise at
that point is greater than the noise_threshhold, giving the ability to create a non-equal
distribution of ore.


sheet

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
Creates a sheet of ore in a blob shape according to the 2d perlin noise described by noise_params.
The relative height of the sheet can be controlled by the same perlin noise as well, by specifying
a non-zero 'scale' parameter in noise_params.  IMPORTANT: The noise is not transformed by offset or
scale when comparing against the noise threshhold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size.
clust_scarcity and clust_num_ores are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.



EDIT:

Remember to register the ore as a node first.

Like so:

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
minetest.register_node("yourmod:stone_with_yourore", {
    description = "Your Ore",
    tiles = {"default_stone.png^yourmod_mineral_yourore.png"},
    groups = {cracky=3},
    drop = 'yourmod:yourore_lump',
    sounds = default.node_sound_stone_defaults(),
})

Also remember to change "yourmod" with your mod name, and "youore" with the name of your ore.

Hope that answers your question.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Wed Apr 16, 2014 01:36

Evergreen wrote:An answer I put together a while ago:
Evergreen wrote:Okay, here is some example code for an ore.

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
minetest.register_ore({
    ore_type       = "scatter",
    ore            = "mod:stone_with_ore",
    wherein        = "default:stone",
    clust_scarcity = 8*8*8,
    clust_num_ores = 8,
    clust_size     = 3,
    height_min     = -31000,
    height_max     = 64,
})


To quote the dev wiki:

ore_type: See Ore types
ore: The name of the ore node
wherein: The node that the ore will generate inside of
clust_scarcity: Ore has a 1 out of clust_scarcity chance of spawning in a node.
clust_num_ores: Number of ores in a cluster
clust_size: Size of the bounding box of the cluster
height_min: The lowest level that the ore will generate at
height_max: The highest level that the ore will generate at
noise_threshhold: If noise is above this threshold, ore is placed. Not needed for a uniform distribution
noise_params: NoiseParams structure describing the perlin noise used for ore distribution


Also, the possible ore types are:

scatter

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
Randomly chooses a location and generates a cluster of ore.
If noise_params is specified, the ore will be placed if the 3d perlin noise at
that point is greater than the noise_threshhold, giving the ability to create a non-equal
distribution of ore.


sheet

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
Creates a sheet of ore in a blob shape according to the 2d perlin noise described by noise_params.
The relative height of the sheet can be controlled by the same perlin noise as well, by specifying
a non-zero 'scale' parameter in noise_params.  IMPORTANT: The noise is not transformed by offset or
scale when comparing against the noise threshhold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size.
clust_scarcity and clust_num_ores are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.



EDIT:

Remember to register the ore as a node first.

Like so:

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
minetest.register_node("yourmod:stone_with_yourore", {
    description = "Your Ore",
    tiles = {"default_stone.png^yourmod_mineral_yourore.png"},
    groups = {cracky=3},
    drop = 'yourmod:yourore_lump',
    sounds = default.node_sound_stone_defaults(),
})

Also remember to change "yourmod" with your mod name, and "youore" with the name of your ore.

Hope that answers your question.

Indeed, it does help greatly. Thank you.
However, I would also like to know which variables to edit so that the frequency of lodes is changed.
Last edited by SegFault22 on Wed Apr 16, 2014 01:37, edited 1 time in total.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Wed Apr 16, 2014 02:05

Scatter distribution on a large scale creates ugly cubes, so that is out. Sheet distribution is the only option.
But to use it properly, we have to be able to change the scarcity of the lodes. Every page I have found fails to explain that, although such is critically important. No wonder nobody uses it except for that technic guy.
Last edited by SegFault22 on Wed Apr 16, 2014 02:08, edited 1 time in total.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Wed Apr 16, 2014 21:11

Hybrid Dog wrote:
SegFault22 wrote:Scatter distribution on a large scale creates ugly cubes, so that is out. Sheet distribution is the only option.
But to use it properly, we have to be able to change the scarcity of the lodes. Every page I have found fails to explain that, although such is critically important. No wonder nobody uses it except for that technic guy.
there: http://dev.minetest.net/ore
I have problems with the sheet ore, too. For any reason it always generates much and big chunks. Changing the spread didn't help.

Sorry, I have already seen that article. It is not informative enough.
I guess I'll just have to stick to standard ore generation, then...
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

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

by paramat » Thu Apr 17, 2014 01:33

Despite being confident with noise sheet ores confuse me, it needs more explanation.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Thu Apr 17, 2014 09:24

SegFault22 wrote:It is not informative enough.
I know, it's not more informative than lua_api.txt.
EDIT: https://github.com/minetest/minetest/blob/master/src/mapgen.cpp#L182
Last edited by Hybrid Dog on Thu Apr 17, 2014 09:43, edited 1 time in total.
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Thu Apr 17, 2014 23:02

Hybrid Dog wrote:
SegFault22 wrote:It is not informative enough.
I know, it's not more informative than lua_api.txt.
EDIT: https://github.com/minetest/minetest/blob/master/src/mapgen.cpp#L182

Sorry, I don't speak C++.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

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

by paramat » Fri Apr 18, 2014 10:10

I speak a little, i may be able to see how it works ... *looks*
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Fri Apr 18, 2014 19:07

paramat wrote:I speak a little, i may be able to see how it works ... *looks*
What's the meaning of nthresh?
 

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

by paramat » Sat Apr 19, 2014 10:55

Noise threshold, so line 202 means 'if noise value < noise threshold'
Last edited by paramat on Sat Apr 19, 2014 10:55, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 


Return to WIP Mods

Who is online

Users browsing this forum: Bing [Bot] and 14 guests

cron