How to make ores more abundant?

User avatar
JoshMars
Member
 
Posts: 103
Joined: Sat May 17, 2014 23:24
In-game: rubber UbuntuJosh

How to make ores more abundant?

by JoshMars » Fri Sep 30, 2016 15:02

I've been looking for a way to make ores more abundant. Is there a simple way to do this?
 

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

Re: How to make ores more abundant?

by SegFault22 » Mon Oct 03, 2016 11:02

There is a way, but it isn't as simple as I would prefer it to be. You have to go into the Lua files for whatever mod adds the ores (in minetest_game, this means the mod "default"), and look for calls to minetest.register_ore(). Ignore stuff like clay because that probably isn't what you are wanting to modify, since it technically isn't an "ore", it just uses the ore generation system for its generation. Eventually you will find some calls that look like 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_ore({
      ore_type       = "scatter",
      ore            = "default:stone_with_coal",
      wherein        = "default:stone",
      clust_scarcity = 8 * 8 * 8,
      clust_num_ores = 8,
      clust_size     = 3,
      y_min          = -31000,
      y_max          = 64,
   })

There are 3 things you can change in order to increase the abundance.

"clust_scarcity" is the chance that the ore cluster will generate inside a chunk; it is a number value usually represented by multiplying 3 numbers that are the same, to get one really big number that is basically the "cube" of one of the numbers. In the case with the first coal ore, the numbers are all "8", so the chance is 512 (higher number = less ore per chunk). You can change this to something like 7*7*7 (343), or just fill in some number like 300 or 256 (I'm not sure if non-square numbers break something, so you'll have to be careful and test this in a test world before committing the changes to a server or something).

"clust_size" is the size of one side of the cluster; to determine how many ore nodes will fit into the maximum volume of a cluster, this number is cubed - so a clust_size of 3 can fit up to 27 nodes of the ore, and not any more. You usually want the clust_size to be high enough there is still plenty of room for stone inside the cluster, making it look more like a deposit instead of just a cube - but it isn't really necessary to make room for some stone, unless you just want to. It's kinda an aesthetics thing (if the clust_size were reduced to 2, the default number of ore nodes would make it a cube of 8 coal ore nodes).

"clust_num_ores" is the number of ore-nodes per cluster; if this meets or exceeds the cube of clust_size, all of the ore will be in a cube-shaped deposit, which usually isn't preferable, and any more than the cube of clust_size overflows the volume of clust_size, so only what fits into clust_size is really generated. So when clust_size is 3 as in the first coal ore, clust_num_ores should be less than 27 (it is 8). I think that 8 is pretty low for a 3^3 region of space, so you could increase it to 16 or 18 for there to be more ore per cluster.

The reason it isn't preferable to change it this way, is that you have to modify all of those values for all of the ore definitions manually, and there is a lot of scrolling involved in getting to wherever the next minetest.register_ore() call is located. I'm working on a mod which wraps around the minetest.register_*() calls for stuff like items, nodes, tools, ores and crafting recipes, which reduces the complexity such that you would only have to change the values in a single line of a much shorter function call, that is much shorter than the whole minetest.register_*() call. However, this mod is not yet ready to be released, and it will probably be even longer before it gets integrated into most popular mods, or minetest_game, if ever.

There are 15 minetest.register_ore() calls (of interest; who really wants to add more clay, and fool with all of those noise parameters until you can get it to generate as desired?) in the "default" mod's mapgen.lua file. That's 150 lines of code (135 excluding the closing bracket/parenthesis), instead of just 15 as it could be with that mod I'm working on (who wouldn't want that?). If you have mods which add more ores, such as moreores or technic, this would easily be a lot more, and you would probably want to modify those as well.
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: How to make ores more abundant?

by ExeterDad » Mon Oct 03, 2016 12:07

@SegFault22
Nice explanation.
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

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

Re: How to make ores more abundant?

by SegFault22 » Mon Oct 03, 2016 12:29

ExeterDad wrote:@SegFault22
Nice explanation.

Thank you :D

I like to help, whenever I can...
 

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

Re: How to make ores more abundant?

by paramat » Mon Oct 03, 2016 16:59

Nah don't edit MTGame, never do that. Write a mod that depends on default, first line is:

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.clear_registered_ores()


After that copy-paste in all the ore registrations from 'mods/default/mapgen.lua' and make your changes.

You can do the same for decorations and biomes.
 

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

Re: How to make ores more abundant?

by SegFault22 » Tue Oct 04, 2016 17:03

paramat wrote:Nah don't edit MTGame, never do that.

There isn't any reason why you shouldn't change minetest_game; otherwise, people wouldn't be making subgames, due to problems. He's not going to be committing his changes to the github repository, or something like that.

Many servers which are heavily modified have significant changes to minetest_game, and don't have problems. Problems only begin to happen when you break something, and I didn't suggest anything which would cause that.

Also, it is a waste of time to clear the ores registered by minetest_game and register them all over again with only slightly different parameters. The game has to process the registry function calls twice, in addition to removing all of the existing registered ores between loading minetest_game and the "mod".

If it isn't possible for you to accept that it's okay to modify minetest_game (outside of the github repository), tell us why.
 

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

Re: How to make ores more abundant?

by paramat » Wed Oct 05, 2016 22:15

You can if you want, but with a mod you don't need to rewrite your changes each time MTGame is updated.

The clearing and re-registering of biomes, decorations and ores by mod is the intended standard practice for customising these.
 

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

Re: How to make ores more abundant?

by SegFault22 » Mon Oct 31, 2016 00:58

paramat wrote:You can if you want, but with a mod you don't need to rewrite your changes each time MTGame is updated.

The clearing and re-registering of biomes, decorations and ores by mod is the intended standard practice for customising these.

It would be useful if it were to be distributed for others to use, that it is made a mod instead of just changing the subgame That would be a legitimate reason. However, if it is just going to be used on a single server or just a few, and since minetest-game isn't being expanded any more (until someone realizes another minecraft feature that didn't get added yet), one could just copy their modified subgame files over to any new release of Minetest, and it should work the same as it did with the previous version, unless a part of the API which is used by the modified subgame is changed extensively in the new version just like Minecraft with Forge. In the latter case, creating a mod would not be any more or less beneficial than simply modifying the subgame.
 

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

Re: How to make ores more abundant?

by paramat » Mon Oct 31, 2016 07:40

it would, it would be much less work then re-editing MTGame on every release or on every update of the dev version. Even if you're not distributing it.
 

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

Re: How to make ores more abundant?

by SegFault22 » Mon Oct 31, 2016 22:21

Why would you have to edit the subgame every release, instead of just copying the subgame's folder from the older version?
 

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

Re: How to make ores more abundant?

by paramat » Tue Nov 01, 2016 06:59

Well, by 'edit' i mean copy-paste, which is still more work than a mod.

> one could just copy their modified subgame files over to any new release of Minetest

Usually, a file is a mix of updated stuff and stuff you wish to edit, for ores it's in one neat section, but for other things the editing is not so easy.
 

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

Re: How to make ores more abundant?

by SegFault22 » Tue Nov 01, 2016 19:16

If you're using the PPA to install Minetest, then it would probably be less work, because you wouldn't have to edit any files in the game directory, as long as the software update scripts don't overwrite your mods folder as well; but if you install the game the old way, you have to copy all of your mods over anyways - so it would be easy to select the games directory as well as the mods directory from the older version, and copy them both into the new version's directory at the same time, replacing the existing files.

It would be less work if you made a mod, but one shift-button press and one left click are not enough work to be significant. You would gain about as much time as is taken by the game during loading to register all of the ore definitions and clear them before the new ones are defined.
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 9 guests

cron