Inactive [WGEN] Mineral Veins 1.4.1 - Ore placement overhaul [1.2.5-R1]

Discussion in 'Inactive/Unsupported Plugins' started by m0rt, Sep 7, 2011.

  1. Offline

    m0rt

    Mineral Vein - Ore generator modification
    Version: v1.4.1
    Download: jar
    Source: github
    BukkitDev

    WARNING - As of MV 1.4.1, instead of veins.yml, config.yml is used. It's purely a name change, caused by switching over to the new API, file format remains the same.

    Mineral Vein changes the way ores are generated. Instead of lots of small, randomly placed deposits, several huge veins will be generated.
    Technically, Mineral Vein adds new BlockPopulator that removes all previously placed ores and generates new ones. This ensures compatibility with any other world generators, including the default one.

    Veins
    Veins are vast, rare areas, that are rich on particular resource. These veins are multiple chunks wide and long, their respective resources don't exist outside them. Veins aren't made completely of given material, it's just very common there, and often multiple veins of different materials overlap. This ore distribution changes mining for resources completely - you have to scout wide areas for a vein, and when you finally find one, it can supply you for quite a long time. In general, the average density of resources/chunk is simillar, but the distribution is changed completely.

    Converting old worlds

    By default, the plugin works as world generator and only affects newly generated chunks. However, you can force it manually to apply the algorithm to any chunks that are already present.
    The command \mineralvein apply <worldname> [x] [z] [width] [height] will apply this to the selected world. Run this command just once after installing MineralVein, then you don't have to run it at all. By default the command is accessible from console and/or anyone with "MineralVein.apply" permission. (since you need to run this command exactly once, you propably won't need the permission at all.
    The numbers default to 0,0 (center) and 200x200 chunks around it. If your map is bigger, use appropriate setting (widht corresponds to X coordinate, the value is in chunks).

    Screenshot:
    Show Spoiler
    comparsion.png Vanilla minecraft on left, MineralVein right. (white areas are iron blocks, other ores aren't shown, but generated in simillar manner)



    Configuration
    All variables used in ore placement can be set in config file.

    Code:
    worlds:
      default:
        -
            block: GOLD_ORE
            seed: 35434
            density: 3
            thickness: 4
            densityBonus: 0
            heightAvg: 20
            heightVar: 20
            heightLength: 80
            densLength: 80
            exclusive: false
            #biomes: [forest,swampland]
            #exclude_biomes: [desert]
            mode: replace
    
    Each item of the list represents one "layer" that is generated. By default, there is one layer for each ore type, but there can be more.
    seed is a unique number for each layer. If you want to create a layer with two different ores, that always uses same space, just use the same seed.
    density is a chance multiplier. Higher density means more ore
    thickness is vertical size (actually it's distance from the center of the vein, in which the ore can spawn, so it's one-half of the actual thickness)
    densityBonus: The density in an area is determined using a random generator, that gives values between -1 and 1, where 0 and less represent no chance of ore spawning in given location. Giving a densityBonus of 1 will represent in this layer to be filled with resource everywhere on the map.
    heighAvg is the average height in which this layer can be found
    heightVar is the random portion of heigh, the actual heigh goes from avg - var to avg + var (in the example, setting of 20/20 would result in layer beeing between 0-40)
    heightLength is distance in blocks between height definition points changes (higher values -> less frequent height changes)
    densLength is distance in blocks between density definition points changes (higher values -> bigger, rarer veins)
    exclusive parameter makes sure no other veins appear if this one is present (technically, it descreases their chance by the density of this ore here)
    biomes is a list of biomes this vein can appear in. If this parameter is NOT present, it appears everywhere.
    exclude_biomes is a list of biomes to be excluded from the list (logically this should be used when biomes option is defaulted to all)
    mode allows to turn off replacement (by setting mode to "add") - this vein will just add more blocks, without removing the old ones

    The mathematics behind (open)

    This section explains how exactly the ore generation works, which should help you in deciding what config to use.

    The ore placement process works in two levels: column(X and Z coordinate) and block (Y coordinate, within the column). Some of the values (like VeinHeight) will be generated for each column, then all blocks within the column will have a specific chance to spawn ore in them. The following tutorial explains how a single ore vein is generated.

    At the very beginning, height and density maps are generated. Those describe distribution of VeinHeight (block height in world) and VeinDensity (spawn chance multiplier). These maps are based on world seed, so they are identical every time you run the apply command.
    tut1.gif
    This is an example of a density map (not yet finished). The way this generator works is it selects random values each densLength blocks (in this case 40), and interpolates inbetween. (This is a simplified generator, the actual generator has much smoother results). Another example:

    tut2.gif
    Here the densLength is 20, resulting in much faster changes in density. In a moment, the density is "cut", anyting below zero is ignored.

    tut3.gif
    This represents the basic ore vein distribution. Wherever you can see the red plane, the density map generated value below zero, therefore this ore will not spawn in this column. However, before the cut is done, densBonus is applied.

    tut4.gif
    This is the same map with +0.3 densBonus applied. You can see the red areas are much rarer, resulting in ore beeing much more common. This value (random+densBonus) is now multiplied by density, giving the final VeinDensity for the particular column.
    Generating heigh map is simpler, the height map just needs to be adjusted according to heightAvg and heightVar (note this is just a side view, for a single Z coordinate):
    tut5.gif
    This could be described by a simple formula height=heightAvg+(rand*heightVar).

    So now we have VeinHeight and VeinDensity for each column. Each column is then run through, and generated a ChanceMap for. It looks like this (Y is on the horizontal axis):
    tut6.gif
    The result of this function (0 to 1) is multiplied by VeinDensity for this column, resulting in a chance that the ore is spawned in this block (0 is no chace, 1 is 100% chance).
    You can see that blocks that are close to the VeinHeight have a high chance of ore spawning, while blocks that are further that thickness have zero chance. Then a "dice" is rolled for each block and compared with the resulting chance, to see whether this block will have the ore spawned in it or not. Note that the "dice" roll is completely random, independent of world seed, so each run of apply would result in different local layout.


    Changelog:
    Version 1.4.1:
    • Compatibility for MC 1.2.3
    • Minor fixes, permissions should work
    Version 1.3.10:
    • added debug mode ("debug: true" in config file)
    • BEWARE - permission now defaulted to OP (temporary solution)
    Version 1.3.9:
    • application now runs in sync, should take care of concurrent modification exceptions
    Version 1.3.8:
    • fixed some issues, now works quite fine
    Version 1.3.7:
    • Now supports ANY id, even non-existing ones. Useful for MCForge-added blocks (e.g. Industrialcraft)
    Version 1.3.6:
    • fixed thread usage in apply command
    Version 1.3.5:
    • new HeightRel option
    Version 1.3.4:
    • Two new config options - mode and exclude_biomes
    • Fixed bug with using same noise generator for height and density
    • Fixed apply command
    Version 1.3.3:
    • Fixed crash for config files that don't have "default" world setting
    Version 1.3.2:
    • The "Apply" command is now executed in separate thread, and worlds can be referenced by their index (failed command will display list of worlds and indexes)
    • Huge changes in default config file, hopefully for the best
    Version 1.3.1:
    • The "Apply" command now works much better and safer
    Version 1.3:
    • Added exclusive and biomes parameters to config
    • It is now possible to populate already existing worlds
    Version 1.2:
    • Added heightLenght and densLength parameters to conf file
    Version 1.1:
    • Fixed bugs, switched to in-built Noise generators for better results
    Version 1.0:
    • First release
     
  2. Offline

    PyPKjE

    If I understood the values ​​of this plugins is a very good job for which I praise!
     
  3. Offline

    m0rt

    Glad you like it.
    I am not really sure how this plugin will affect gameplay, I fear it could create an excess of resources. I would like to have a balanced version before 1.8, so that new servers could use it (I am planning to on my server).
     
  4. Offline

    IRS

    Are the height limits for the ores the same as default minecraft generation? Or no? I say that because it might be useful to have height changes in a config if you want them.
     
  5. Offline

    m0rt

    Yes, you can change it in the config:
    I think of adding height and density frequency (higher frequency - changes more often), which would allow of creating multiple smaller deposits (with high density freq.), or stranger shapes of veins (with high height freq.)
     
  6. if you set heighAvg to 64 and heightVar to 63, will there be ore-spawn in the air?
    just asking if you check this because that would be very ugly :D
    nicely done anyway i like the idea :)
    Edit: can you explain a bit on how the mechanism works?
    like if i set a density of 10, what does that means and what distance is one thickness?
     
  7. Offline

    m0rt

    No, I forgot to mention, just as the vanilla ore populator, it only places ores over stone.
     
  8. i tested this throughtout and sadly, with the default-settings things are getting overwhelmed
    i digged straight down and instantly found a diamond-vein under an iron-vein. got at least two inventories full of diamonds.
    tested the same thing thousand blocks away and after 5 minutes searching found the second diamond-vein
    How should i change the settings to have very very rare big veins?
     
  9. Offline

    m0rt

    For testing your setting, I suggest using something like minecraft x-ray, it could have been luck. To increase rarity, set densityBonus to something like -0.5. I am still testing it and developing a better setting, currently I am at much lower values than the 1.1 version.
     
  10. Hey, i tryed it out with this setting:
    Code:
            block: DIAMOND_ORE
            seed: 98746835
            density: 2
            thickness: 2
            densityBonus: -0.6
            heightAvg: 10
            heightVar: 10
    works like it should, but it keeps the smaller groups of ores together with the veins:
    Show Spoiler
    [​IMG]
     
  11. Offline

    m0rt

    The smaller groups are strange, I mean statistically they should appear, but very rarely. I think they are leftovers from the original generator, that weren't removed for some reason. Gonna look into that. Also, for some reason, MineralVein populator isn't run until all chunks around the given one are generated, so the outer line of chunks is always filled with the original ores (although players can never reach it).
    I am currently using same setting, I am using -0.6 for rare ores and -0.4 for iron.
     
  12. Offline

    Dempere02

    So will this erase and regenerate all ores in a map? or just replace old ones with your new algorithm?
     
  13. Offline

    m0rt

    It is a BlockPopulator, so it will only run when the world is generated, it won't change your old world. It will replace any ore that was generated by any other terrain generators (such as the in-built one) by the new vein-generated ores (which ores it replaces can be defined in config). It works in this way because it is the only way to "disable" default ore placement without disabling anything else (like trees, lakes, villages...).
     
  14. Offline

    Conraad

    What happens if you also use something like Industrial Craft on your sever do I just add the extra 3 resources types in and what's the purpose of the seed number just need to clear this up before give it a bash this mod is most definitely going to a more realistic feel for finding ores making it harder or easier depending on settings love it
     
  15. Offline

    Raniy

    Two things, The ores are alittle too common in your default yml, example below is at spawn on a new world.
    Show Spoiler

    [​IMG]
    [​IMG]

    Second, can you do the same for soulsand and glowstone distribution in the Nether?

    [Edit]
    Forgot to say I love it :)

    And another thought, can you make it so one ore type is most common in a chunk?
    Such that you would find a Redstone mine at 100 100 (Randomness)
    And a diamond mine at 1000 1000
    But not both within a hundred blocks of each other as seen in my pics?
    I realize by tweaking the settings you can make ores rarer. But that is not quite what I want I would like the ore of different types to be less likely to be near each other.

    Possibly even have ores of certain types spawn in certain biomes?


    [Edity edity edit]
    Diamonds should always be surrounded by coal.
    :)
     
  16. Offline

    m0rt

    @Conraad: Yes, you can add as many ores as you want. I am not sure HOW IndustrialCraft adds new blocks (and for that matter, how to use IndustrialCraft in bukkit), but if you use block ID's, it should be safe (you can enter both name OR ID in the field).
    Seed is for random generator, it needs to be a) different for each ore and b) stay same for the ore for the entire time the world runs, that's why it is in config file. You just need to input some random number, different for each ore.

    @Raniy: There is new default file in 1.2, they should be rarer now. It is now artificially limited to normal worlds only, I am not sure how it would look like in nether (there would have to be some minor code changes, otherwise it should work fine), I am not sure whether this method is that suitable for nether (as soulsand and glowstone are already generated "nicely").
    It is not possible to manually determine where the ores will be. The thing is that the algorithm uses a function that somehow maps coordinates to height/density, so that the value can be calculated at any further moment (e.g. if the chunk data is damaged and needs to be generated anew). The only way would be trying multiple seeds, until you reach desired setting. Matching it against biomes would be possible.

    Diamonds+coal: Are you sure? I mean logically it seems possible, but are diamonds really always found with coal?
     
  17. Offline

    Raniy

    No I was kidding... bad geology joke... :)

    http://geology.com/articles/diamonds-from-coal/
    So following the logic presented in that article Diamond deposits should be in vertical columns, distributed in or near a large source of lava. (Converting to MC 'geology' here :p ) And have no relation to coal, or any other ore.

    Im fair certain modelling 'real' geology is a bit beyond the intended scope of your plugin. So lets simplify;
    How about a configuration option for which ores spawn in which Biomes. Something like
    Code:
    ...
       Desert:
           Diamond:2
           Lapis:30
           Redstone:5
           Coal:40
           Iron:10
       Tundra:
           Iron:80
           Coal:40
           Redstone:50
           Diamond:5
    
    
           
    etc

    Presence of an ore line for the biome gives that percentage chance of a vein in that specific chunk, thereafter following your current logic. Absence of a ore line means none of that ore in that biome.

    Its an imperfect solution for more realistic ore distribution... but I like it in theory.

    :)


    Diggy diggy hole?
     
  18. Offline

    G1R Productions

    Does this require new generated chunks or does it modify existing chunks, please say it modifies existing chunks.
     
  19. Offline

    m0rt

    In current setting it is run upon world generation, but theoretically it could be run over an entire existing world, it would definetelly work. I will add that command in next version.

    @Ranyi: The problem is that I can't just determine chance that the vein is "somewhere in the biome", because the biome is not generated as a whole area. The generator has to work even if I generate a singe random chunk in middle of nowhere. I can currently think of using the same algorithm, with much less rare ores, and simply overriding the calculated chance with 0, if it is in different chunk.
     
  20. Perhaps you could add something like grouos with priority and if the ore with the most priority is used in the chunk, all ores with less priority are ignored. Thats so you do not have different ores in the same chunk. You could also "check" sourounding chunks if you simulate their generation and use this data.
    For people like me i would not care to have an optional recursive method which starts at 0 0 and goes for lets say 5000 blocks in every direction and saves, how the world would look without actually changing anything. After this, you could easily expand the 5000 if needed. Data could be stored in mysql/sqlite for easy searching and you have more control over the veins. At chunk generation, simply parse the data into the chunk
     
  21. Offline

    m0rt

    Alright, I added biome-lock and exclusive parameters for veins (biome-locked will be blocked in any other biomes, exclusive decrease the density of other ores in same columns drastically). But the biggest change is possibility to populate already existing worlds.
     
  22. Offline

    Conraad

    Thanks for your answer will wait for next version so I can run this on my existing world, family would kill me if I inform them of a restart again hehe.

    Tried it out on new map, and it seems that at the spawn there's always resources just below you so digging straight down you hit the jackpot after that you really have to dig and after an hour of digging still didn't find any diamonds, as For Industrycraft I added the ore's but can't say for certain that it's getting populated like with gold and iron you just find the extra 3 ores all over and same density as without this mod so either I have the incorrect block name for that specific id or it's not working just glad to know that i still have those extra 3 ores to mine.

    Just small suggestion but removing resources population from spawn for an X density might be a good idea and the rest will just be playing with the settings and perhaps you should look into changing this into a generator that will generator random reefs on top of what you already have something like the MC dungeon mod I use world border to set my border and then I fill the entire world with chunks so being able to generate ore reefs on top of that afterwards would be a bonus.

    Thanks for the update just one question/concern

    (until server restart or running the same command again)

    1) If you run the command on existing map and it generates ore reefs and you find a ore reef one and start mining it and the server crashes or gets restarted will the existing vein you were working on still be there or will it be erased just important to know since the planning of mine etc would depend on the outcome.

    2) What happens if you disable the command does it remove the veins already created?

    Be carefull when running the populate command it will produce reefs but will then continue to make new reefs the wife started mining and when she wanted to get back home her entrance was gone and populated by new ores one area was populated by Coal and then I disabled the mod and restarted the server and most of the coal previously on server turned into gold so use this mod with caution

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  23. Offline

    m0rt

    Yeah the command should be used with caution, however, it should only be used when transforming old world to new one. Since I found no way of loading the entire map, I am populating all loaded chunks and as long as the command is on, all chunks that are beeing loaded. Basically what you should do is enable the command, run around the entire generated world, then disable it and never touch it again. Then it should work fine. If I figure out a safer way to do this, I will.
     
  24. Offline

    Raniy

    Great synergy with WorldBorder plugin. I love the '/wb fill' command ;) Pumped out a 2500 m square map for me to explore using this plugin and WorldBorder.

    @m0rt What I meant was: on Chunk Generation, if a vein is not already present/being continued, check the percentage chance from config for a vein of this type to form in a chunk with that biome type. Basically, Rarity configured per biome as well as simply can it be there.

    /me looks at that sentence oddly, looks at himself oddly, "Uh yeah.

    Like your idea on exclusivity though ;) I foresee miners going 'Hell yeah! Im 30 levels down and nothing but stone... DIAMONDS HERE I COME!'
     
  25. Offline

    m0rt

    Well I did add the biome limitation, that should work fine. Gold Ore should be in yml, it is the one with comments, it doesn't generate?
     
  26. Offline

    Asterdom

    This is an epic Minecraft improvement! Any chance youll consider generating ores randomly as well just less commonly?

    The veins can be difficult to find and random resources are necessary.

    Either way fantastic idea and props for putting in the coding time and making it! Cant code java myself...
     
  27. Offline

    m0rt

    What you mean is to maintain some of the original ores, while generating veins? That could be hard to do, better solution for you would be defining another iron vein (you can have as many as you want), that has much lower thickness, and much lower densLength. That will produce this: combined.png

    So you have both random small vanilla-like veins, as vell as big veins, and still you can control overall resource density.
    I used this additional iron vein:
    Code:
        -
            block: IRON_ORE
            seed: 4384638
            density: 1
            thickness: 2
            densityBonus: -0.4
            heightAvg: 50
            heightVar: 5
            heightLength: 10
            densLength: 10
            exclusive: false
     
  28. Offline

    Opterongeek

    How would one apply this to a world? I keep getting "Given world not found" when I try the name. I've tried it without spaces, with the spaces, in quotes with and without spaces (my world's name was generated as a joke, and I haven't figured out if it would cause issues later on, but right now it's three distinct words for the name) - the server loads up fine, but I can't get this command to work at all.

    Any ideas?
     
  29. Offline

    Silarn

    I think this is a fantasitic plugin, though the supplied ore config is a tad on the abundant side.

    Despite the improvements to the apply command still basically fails for large worlds. The only way to fix this, I think, is to program a threaded chunk handler that is going to pace how many chunks are analyzed at a time.

    ---

    I figured I'd supply my own explanations of settings here that I figured out after messing around. Honestly, the config explanations are vague at best.

    ---

    The below values rely on the densLength variable to determine the final size of ore deposits.

    densityBonus - Use this value to primarily set the number of ore spawns in your world. 0.0 averages out to mean that 50% of the locations checked for ore deposits will contain ore. -0.5 means that 25% will be ore.

    density - Use this value to set the size of ore veins in your world. This will give you the final % of a strata's ore content when combined with the densityBonus. This means that if you take the average density down to .2 (10% ore chance) with a densityBonus of -.8 and set the density to 2, the final % of rock that will become ore will be 20%. You will still have a 10% chance for any given location to contain ore, but the amount of rock in that location that will become ore is 20%.

    thickness - This is combined with heightLength to determine a vein's shape. Typically, greater thickness translates to vertical veins and lower thickness translates to flat, horizontal veins.

    These values will determine the shape and distance between your deposits.

    densLength - This value determines the distance between each dice roll to spawn an ore deposit. If the densLength is 80 and you have a total average density ((1+densityBonus)*.5density) -> ((1-.80)*(.5*2)) of .2 (20%), then you will have ~16 blocks of ore in an average deposit (This could range from 8 to 24). Keep in mind that you will still only have about (1+densityBonus)*.5 -> 10% of the areas spawning ore. This leads to only about 2% of the stone in that strata becoming ore.

    Make sure the target world is loaded when you use the command. Otherwise not sure. It doesn't seem to give feedback when used (unless it only happens when the command completes, in which case I never used it on a world small enough to complete without running out of memory).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  30. Offline

    Opterongeek

    Well, yes, I have to have the target world loaded to use the command in the CLI, unless there's a way to incorporate it without the game server running, in which case, I haven't done that.
     

Share This Page