Geolosys

Geolosys

5M Downloads

Ore Generation Probabilities

dizzyd opened this issue · 2 comments

commented
  • Minecraft Forge: 14.23.5.2768
  • Geolosys: 2.1.3.1

What happens:

If I understand the code correctly, for each chunk, Geolosys selects one OreGenerator at random and attempts to generate a deposit with that generator. This means that the probability of a given deposit is:

(1 / number-of-ore generators) * (deposit chance / 100)

For example, with default config, there are 18 generators and the probability of Coal generation is 8%. Thus the odds of Coal generation are:

(1 / 18) * (8 / 100) = 0.14%

I.e. the odds of Coal generation is a 10th of a percent per chunk. On average, you'd have to traverse 1000 chunks to find a single deposit of Coal.

What should happen:

If the chance config setting should be a global percentage (i.e. 8% of a chance per-chunk), the OreGenerator should traverse ALL individual generators, giving them each a chance to generate a deposit.

Additional Comments:

I'm unclear if this is an intentional design decision -- feel free to close this issue if this was how it's meant to work anyways. :)

commented

I’ll give this a look soon and see how much I can tweak it to make any sense, because when I wrote it it was a matter of “how can I make numbers that correspond to a rarity I like?!” And it became that garbled mess of math.

commented

Alright so I've opted for a different algorithm that is a combination of yours and mine. It goes like:

  1. When adding an ore, it's weight is added to an accumulated overallWeight variable
  2. When the generator gets called, it uses rng to pick a number (target weight) using overallWeight
  3. The generator loops picking some random ore to generate. If that ore's weight is greater-than or equal-to the target weight, it is generated and the loop is stopped.

This to me makes more sense and is closer to "letting everything have a chance" instead of what it was before.