diff --git a/src/server/terrain/chunkgen/StructureGenerator.zig b/src/server/terrain/chunkgen/StructureGenerator.zig index 84a5d49ca..4f70034d4 100644 --- a/src/server/terrain/chunkgen/StructureGenerator.zig +++ b/src/server/terrain/chunkgen/StructureGenerator.zig @@ -56,7 +56,6 @@ pub fn generate(worldSeed: u64, chunk: *main.chunk.ServerChunk, caveMap: CaveMap model.generate(px, py, relZ, chunk, caveMap, &seed); break; } else { - // Make sure that after the first one was considered all others get the correct chances. randomValue -= model.chance; } } @@ -77,15 +76,14 @@ pub fn generate(worldSeed: u64, chunk: *main.chunk.ServerChunk, caveMap: CaveMap var randomValue = random.nextFloat(&seed); const biome = biomeMap.getBiome(px, py, relZ); for(biome.vegetationModels) |model| { // TODO: Could probably use an alias table here. - var adaptedChance = model.chance; + var adaptedChance = model.chance/16; // Increase chance if there are less spawn points considered. Messes up positions, but at that distance density matters more. adaptedChance = 1 - std.math.pow(f32, 1 - adaptedChance, @as(f32, @floatFromInt(chunk.super.pos.voxelSize*chunk.super.pos.voxelSize))); if(randomValue < adaptedChance) { model.generate(px - 16, py - 16, relZ, chunk, caveMap, &seed); break; } else { - // Make sure that after the first one was considered all others get the correct chances. - randomValue = (randomValue - adaptedChance)/(1 - adaptedChance); + randomValue -= adaptedChance; } } }