Page 1 of 2

[Experimental][Mod] More rocks / oregen / geology [rocks]

PostPosted: Tue Apr 07, 2015 13:15
by Tomas Brod
Rocks is a mod to add variety of natural rocks to enhace the underground of minetest. This mod is inspired by Minecraft mod PFFA Geologica. In fact all textures are copied from geologica.

Note: this mod is not complete and is far from. Currently I work on ore and layer generators and most of the content are just placeholders.

Features

Currently 2 layers are generated. On the top is sedimental layer consistig mainy of dirt and Mudstone, which extends down to ~10 blocks underground. Under sedimentary is an igneous layer, consisting mainly of Basalt. 45% of basalt is replaced by Granite, 10% by Diorite and some Gabbro. Strata of the above rocks extend to hundreds of nodes according to large scale 3D noise.

There is an experimental vein generator, which is faster, but limited by mapgen chunk size. Veins are shaped like deformed sphere according to equation of sphere (x*x+y*y+z*z=r*r), where the radius is varied by 3D noise.

There are skarn veins currently defined, which contains a mixture of valuable minerals and spawn in granite and limestone.
Default ore generation is not disabled.

More detailed description is in the readme.

Speed

On my machine sedimentary layer generator performs at 0.57s per 80^3 chunk, igneous layer generator performs at 0.68s/chunk. And vein generator with abovementoined vein at 0.2s/chunk. The way it is implemented causes the whole server to lock down while generating my rocks/ores.

Download

fork by Gael de Sailly on github
last usable version zip
... extract this to your mod folder under the name "rocks".
Changes to the Engine (oredev branch)

License: My code: GPLv2.
Please do not get angry on me copying your stuff, I'll sort that out on release.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Tue Apr 07, 2015 13:52
by Thermal_Shock
I'm always happy to see mods that add more stone types to play with.

I'd highly recommend altering the textures to make them your own. You'll find the experience rewarding when you create a texture you really like.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Tue Apr 07, 2015 15:28
by 12Me21
Tomas Brod wrote:Default ore generation is not disabled (idk how to).

You could alias the ores to stone, or make this into its own game, and edit the mapgen.lua in the default mod.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Thu Apr 16, 2015 17:09
by Tomas Brod
Progress: Added a Skarn vein. There are few types of skarn vein each containing different ore combination. See the git log for details. Also I thinking about making the code GPL (ur opinion?).

I have a dillema of how I want this mod to move on:

1. Should I add all the useful(les) ores or concentrate on rocks and leave ores for another mod?

2. Do I really want a clone of geologica's (or decoblocks') mapgen or should I create something different?

Also I did some research and figured out that doing expensive tasks (mapgen) in the ServerThread (read on_generated) does completly lock down the server. Whereas generating rocks and ores in EmergeTherad does not. But EmergeTherad is not lua-accesible. Following options arise to my mind:

a. Keep it as it is. Lag? Just Deal With It.

b. Modify minetest source (mg_ores.cpp) and improve the oregen, which is currently only 300 lines and extremly basic.

c. Overvrite standard biomes (from lua) and abuse the scatter oretype to spawn that large strata of rock I like so much.

Thanks m8s for ur patience!

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Fri Apr 17, 2015 01:07
by Don
I really like the ideas you have. I think doing it in lua is best so it gives people the choice. Saying that, I think it might be good to suggest your idea to the core team. Might want to avoid using words like dumb. Remember that everyone does this for free.
Just my opinion.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Fri Apr 17, 2015 16:08
by Tomas Brod
Don wrote:I really like the ideas you have. I think doing it in lua is best so it gives people the choice. Saying that, I think it might be good to suggest your idea to the core team.

Your right. I myself do not feel like hacking C++ (prefer algol style languages). I might write the suggestion in the furure.

Don wrote:Might want to avoid using words like dumb. Remember that everyone does this for free.

Yeah, me too. I already edited it. I meant it as "simple".

I thing about using the MapgenV7's biomes for surface and sedimentary rock types (eg: mountain=limestone, ocean, beach=sand, plains=mudstone). And the "blob" ore type for other formations.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Fri Apr 17, 2015 16:12
by Don
Tomas Brod wrote:
Don wrote:I really like the ideas you have. I think doing it in lua is best so it gives people the choice. Saying that, I think it might be good to suggest your idea to the core team.

Your right. I myself do not feel like hacking C++ (prefer algol style languages). I might write the suggestion in the furure.

Don wrote:Might want to avoid using words like dumb. Remember that everyone does this for free.

Yeah, me too. I already edited it. I meant it as "simple".

I thing about using the MapgenV7's biomes for surface and sedimentary rock types (eg: mountain=limestone, ocean, beach=sand, plains=mudstone). And the "blob" ore type for other formations.

Really hope you do find a good why to do what you want to do. I think it will be a very popular mod. Would be really nice to have different layers.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat Apr 18, 2015 08:25
by Krock
Looks interesting.
I get masses of the mudstone and clay.

Image

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat Apr 18, 2015 15:20
by Tomas Brod
This mod now depends on Mapgen V7. I have overridden the minetest.register_biome to inject my rocks for every new biome. I recommend to use paramats mod https://github.com/paramat/biomesdev.git and make it depend on rocks mod. MGv7 is amazing together with the abowementoined mod.
The general guide on how to find coal is: Walk around, look at ridges/rivers and randomly dig a 2 block hole in the ground.
However, do not expect to see anything specaial deeper underground. I had to temporary disable igneous layer.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat Apr 18, 2015 15:23
by Tomas Brod
Krock wrote:Looks interesting.
I get masses of the mudstone and clay.
http://i.imgur.com/Jb1qo8j.png


Thank you for testing! As you may have discovered, this mod is highly work in progress. The amount of mudstone was decreased and in the future will be decreased more by limestone, metamorphics or other rocks.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sun Apr 19, 2015 11:04
by Tomas Brod
Re-enabled skarn and nyancat veins using the awesome oretype blob. Rewritten the igneous layer gen using a trick with scatter ore type and noise params. It looks bit ugly, but since it is generated by core (mg_ore.pp, unmodified) in emerge it is fast. There is actually a large scale 3D noise determinig wheter the depostis should be copper-rich or rich in other future mineral. See git log for details.

And I forgot to mentoin that I added a generic mountain biome with limestone. This biome re-registers itself every time biome list is cleared (eg by Paramat's biomesdev). This fills the ugly stone-only mountains caused by me trimming every registered biome to y 27.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon Apr 20, 2015 00:43
by bdjnk
Hey Tomas,

This is amazing work. After trying it out a bit, in conjunction with biomesdev, I've got a few suggestions.

Ores should definitely be a part of this. It's a central aspect of geology, and you can't craft an entirely new rock system without considering how it informs the presence of ores, and vice versa.

Speaking of ores, I actually found the existence of default:stone to be distracting, especially when you have layers of, say granite, spotted with ore in default:stone. I feel like default:stone should be entirely gone.

On the topic of what should be included, while exploring I found myself missing marble. I also didn't find any gravel, which made me think of pebbles, like you find along many river banks.

The only thing that struck me as truly wrong however, were the giant blobs of nyan cat ;)

Image

This is really an amazing endeavor though, and I'm looking forward to it becoming more and more awesome.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon Apr 20, 2015 16:03
by Krock
Nyan cats without rainbows aren't nyan cats. Please add some colors!

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon Apr 20, 2015 16:19
by Tomas Brod
bdjnk wrote:Hey Tomas, This is amazing work.

Thanks!
Ores should definitely be a part of this. It's a central aspect of geology, and you can't craft an entirely new rock system without considering how it informs the presence of ores, and vice versa.

I split this to modpack of following mods:
  • rocks: the rocks
  • mineral: the ores and minerals
  • name?: mountain and underwater (geo)biomes
Speaking of ores, I actually found the existence of default:stone to be distracting, especially when you have layers of, say granite, spotted with ore in default:stone. I feel like default:stone should be entirely gone.

No default:stone allowed. Default ores should now be disabled. Stone replaced by basalt down to -48. I overriden node_stone in the biome code but, I cant seem to override alias (mapgen_stone) defined in default.
On the topic of what should be included, while exploring I found myself missing marble. I also didn't find any gravel, which made me think of pebbles, like you find along many river banks.

Thanks for suggestion. I will implemet it definitly.
The only thing that struck me as truly wrong however, were the giant blobs of nyan cat ;)
They are for testing purposes and wont be removed until beta.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat May 02, 2015 19:00
by Tomas Brod
I have added clay, claystone, slate, gravel, conglomerate, sand, sandstone to spawn in sedimentary layer. Under grass it is like a rainbow. Will be adding some bio and chemo sediments later. Slate is nice black stone, and good for roofing. This rocks spawn simillary to biomes, but using different noises. There are 2 that select "type" (silico/bio/chemo/vulcano/cosmo), third that determines particle size (gravel vs clay) and fourth the hardness (sand vs sandstone).

Beware: The code is a mess. Node properties are largely unset, stones do not drop cobble and the chunk is saved like 3 times during generation for no reason.

Also the readme is now bi-lingual :-). But the rock names are largely international with our weirid suffixes. Will be translated, of course.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sun May 03, 2015 09:09
by Tomas Brod
Added limestone and 3 coal qualities. Tunded the parameters a bit. It is difficult to get all parameters right due to nature of the noises. Statistics are printed after mapgen. Express your opinion on what should be more and what should be less. If you do not install biomesdev, all sedimentary formations remain visible. No metamorphics, so no marble yet. Creative is a must, or you will be digging forever.

Have a fun prospecting!

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sun May 03, 2015 19:32
by Napiophelios
Is it intended to have such massive grouping of the same stone type?
All I have hit so far is limestone...oh well I will keep digging.
Image

Image

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 04, 2015 17:07
by Tomas Brod
Napiophelios wrote:Is it intended to have such massive grouping of the same stone type?
All I have hit so far is limestone...oh well I will keep digging.

Thank you for testing. Sedimentary geomes are 2D. By digging down you only find one type of sedimentary rock.
The noises are extremly difficult to controll. It takes trial and error to set the tresholds just right. Last time I was exploring, 20% of all sed was lignite coal, for example. How big the geomes should be on average?

This is how it looks from above (all dirt removed):
Image

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 04, 2015 19:59
by sofar
As a former Geology student I can't help worry that rock types are deposited in entirely unrealistic ways in these images :^)

Sedimentary rocks can be found as deep as 10km, Basalt and igneous rocks can be found at 8km elevation. Sandstone can be under limestone, but also above limestone. Plus they can all be folder, tilted, sheared and pushed either up or down.

A 2D mapgen seems terribly wrong. Perhaps you need to combine several 3d noise maps - one determining the barrier between crust(igneous) and sediments. By all means let that barrier go above 0. Above the barrier you'd want to create semi-horizontal "cakes" of sediments of random order and thickness. Then intersect everything with the actual topography and cover with a soft deposit.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 04, 2015 20:38
by paramat
This looks good, at one point i was planning to work on coloured stone located by 3D noise, i was inspired by MC videos.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Fri May 08, 2015 05:25
by SegFault22
This mod is very interesting. It adds a good amount of diversity to the stone underground, which is good for making things less boring, especially considering how things can be made to generate only in certain types of stone.
I have a suggestion - instead of doing this:
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( "rocks:granite", { 
   description = S("Granite"),
   tiles = { "rocks_wgr.png" },
   is_ground_content = true, sounds = default.node_sound_stone_defaults(),
   groups = {cracky=3, stone=1},
})
minetest.register_node( "rocks:diorite", { 
   description = S("Diorite"),
   tiles = { "rocks_Diorite.png" },
   groups = {cracky=3, stone=1},
   is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
minetest.register_node( "rocks:gabbro", { 
   description = S("Gabbro"),
   tiles = { "rocks_Gabbro.png" },
   groups = {cracky=3, stone=1},
   is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
minetest.register_node( "rocks:basalt", { 
   description = S("Basalt"),
   tiles = { "rocks_Basalt.png" },
   groups = {cracky=3, stone=1},
   is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})

you could do:
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
nodes = {
{ "diorite", "Diorite", {cracky=3, stone=1} },
{ "granite", "Granite", {cracky=3, stone=1} },
{ "gabbro", "Gabbro", {cracky=3, stone=1} },
{ "basalt", "Basalt", {cracky=3, stone=1} },
}
for _, row in ipairs(nodes) do
   local node_id = row[1]
   local node_name = row[2]
   local node_groups = row[3]

   minetest.register_node( "rocks:"..node_id, {
      description = S(node_name),
      tiles = { "rocks_"..node_id..".png" },
      is_ground_content = true,
      sounds = default.node_sound_stone_defaults(),
      groups = node_groups,
   })
end

That way, you only use 15 lines of code for registering nodes (13 for the ipairs do function, plus 2 for "nodes = {}) plus 1 line for each node that is registered (in ipairs "nodes"), instead of 6 lines for registering each individual node. When you add a new node with that code, you only have to add one more line to the ipairs table "nodes", instead of 6 for every node being registered.
You could even move "nodes = " and everything encased in the braces/curly-brackets to a new file, and leave the registering code in the file it was already in, preceded by a dofile line targeting the file with the ipairs table "nodes" in it. That way, the code doing logical/registry is not mixed up with the strings of information that make each registered node different, and they can be accessed/modified much faster and easier. (More rows would be needed in the table if you want to register rocks with different sounds or other properties, which could be difficult if you have a large number of lines in the ipairs table, because you would have to add a new row to every line, with a short string in it. You would also have to enter the name of the local variable (representing the value of the property) into the registering code where the property is set.)

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Fri May 08, 2015 14:04
by domtron vox
@Tomas Brod this is awesome and would probably go well with Wuzzy's Pedology (soils) mod viewtopic.php?f=11&t=9429

Does this mod need to depend on default or could this and Pedology be put together to replace default's terrain part completely?

I think you should stick with rocks and maybe add some sort of register ore alias that can be called by other modders to register ores in specific 'geomes' as you put it. that way they can add in different kinds of iron for each geome: iron in limestone, iron in granite, ect.

Thanks for making the mod. :)

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat May 09, 2015 13:49
by Tomas Brod
Thank you for the suggestion, Segfault22. I have been thinking about that.
SegFault22 wrote:More rows would be needed in the table if you want to register rocks with different sounds or other properties, which could be difficult if you have a large number of lines in the ipairs table

That is exactly the reason why I wont do it like that. No offense. Now it seems repetitive, but once I start adding node properties, the registration code would become more complicated than standard register_node.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sat May 09, 2015 14:05
by Tomas Brod
sofar wrote:As a former Geology student I can't help worry that rock types are deposited in entirely unrealistic ways in these images :^)

A 2D mapgen seems terribly wrong. Perhaps you need to combine several 3d noise maps - one determining the barrier between crust(igneous) and sediments. By all means let that barrier go above 0. Above the barrier you'd want to create semi-horizontal "cakes" of sediments of random order and thickness. Then intersect everything with the actual topography and cover with a soft deposit.

It is not a 2d mapgen, just the noise is 2D. In fact, base height of terrain in v7 is calculated by 2d noise (the noise value is height of terrain).
Your idea with 3d noise separating crust from sediments seems interesting. I can already see what it will look like. And a last thing: I do not want to create complete lua mapgen, nor a geological simulatior. I just want to have more than dirt and stone.

Is this better? (not uploaded code yet)
Image
It is created by stacking a few layers. In every layer, the same algorithm is used to select 'geome', but with different seeds. Also the height of the layers is varied by noise. But it is also slower. I want it to be fast, so all people (incl me) can play it.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sun May 10, 2015 04:36
by sofar
Tomas Brod wrote:It is not a 2d mapgen, just the noise is 2D. In fact, base height of terrain in v7 is calculated by 2d noise (the noise value is height of terrain).
Your idea with 3d noise separating crust from sediments seems interesting. I can already see what it will look like. And a last thing: I do not want to create complete lua mapgen, nor a geological simulatior. I just want to have more than dirt and stone.

Is this better? (not uploaded code yet)

It is created by stacking a few layers. In every layer, the same algorithm is used to select 'geome', but with different seeds. Also the height of the layers is varied by noise. But it is also slower. I want it to be fast, so all people (incl me) can play it.


indeed, you do not want to create a geological simulator, that would be a thesis project (Just look at my sedimentology mod, which only models 2 geological processes).

It indeed looks nice, I like the waving layers. We'll just consider any vertical edges to be "faults" like real geologists, and make up a good story about it!

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Sun May 10, 2015 14:33
by Tomas Brod
It indeed looks nice, I like the waving layers. We'll just consider any vertical edges to be "faults" like real geologists, and make up a good story about it!

The faults in a singe layer are caused by switching "geomes". But I have a bug hidden somewhere causing whole layers to be shifted on chunk borders (see on the left). Vertical intrusions are planned and can already be seen in crust layer.
Image

Also added a experimental vein generator based on quadratic and linear curves {P=(1-t)A+tB} {P=(1-t)^2A+2t(1-t)B+t^2C}. Could be used for hydrotermal veins.
Image
Step size for the quadratic curve is approximated by {step=sqrt(2)/(|AB|+|BC|)}.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 11, 2015 03:48
by sofar
veins are, geologically speaking, usually faults, and therefore planes. They can be intrusions, and then they're shaped dendric (like a tree).

You may be able to get a fractal tree algorithm that works well.

But, the images themselves look pretty good as a start. I think that would work well. I would maybe try to make sure that the veins don't loop forever, that would make players only mine the veins. You want to make them dead end I think.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 11, 2015 10:26
by Tomas Brod
sofar wrote:veins are, geologically speaking, usually faults, and therefore planes. They can be intrusions, and then they're shaped dendric (like a tree).

The quadratic curve will be used for (kimberlite?) pipes. Planes for hidrotermal veins.

Image
I think about making the plane to follow the quadratic curve and smoothly vary in width, and inclination. Alternative is to fill an area between two random curves (below).
Image(swag coordinates)
Or area between two curves with the same start and end point, but different curvature, which I like the most (below).
Image

You may be able to get a fractal tree algorithm that works well.

Nore has one in "mg". It produces nice caves and ores with regular turns and branches.

I would maybe try to make sure that the veins don't loop forever, that would make players only mine the veins. You want to make them dead end I think.

They do not loop forever. Start and end point is randomly placed in the current mapchunk. However limiting the length (start-end distance) is a good idea.

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Mon May 11, 2015 17:59
by sofar
Nice, that looks like a great approximation...!

Re: [WIP][Mod] More rocks [rocks]

PostPosted: Thu May 28, 2015 06:14
by Tomas Brod
I see that the state this mod is now is horrible. Now, as I passed my final
exams, i decided to spend more time on this. Since I cannot write a
complete geological simulator, I decided on the following strategy:

1. Under like 5km generate only igneous rocks.
2. Abowe that generate sandstone, that will serve as placeholder for more rocks.
3. Generate a fixed amout of layers of rocks there.
- some igneous layers could represent lava spills
- including metamorphic rocks
4. Shift everything around (possibly multiple times) to simulate faults.
5. Create some intrusions (name?) and underground volcanic activity.
6. Create some veins.

Using 2d noise as heightmap has one notable advantage: Looping over 80*80
nodes is faster than 80*80*80.

Minecraft mods I inspire from: Geologica, SGU bettergeo, geocraft.

Doing a complete geological mapgen could be possible too: Start with plate
tectonics, deposit rock in layer on top of each other, do some faults and
folding inbetween, put soil on top. This could produce an interesting
landscape.