RegionIO/internal/worldgen/simple.go
Master290 a7bb9496ae Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775)
Vanilla-faithful overworld generator (final_density + multi-noise biomes),
full connection lifecycle (status/login/configuration/play), chunk streaming,
creative block editing, and the protocol/nbt/registry infrastructure.
2026-06-24 00:32:51 +03:00

16 lines
761 B
Go

package worldgen
// SimpleTerrain builds a small density-function tree producing gentle 3D hills,
// using the verified noise primitives. It is a placeholder shaped by hand until
// the full vanilla overworld density tree is ported.
//
// density(x,y,z) = yBias(y) + amplitude * noise3D(scaled x,y,z)
//
// yBias goes from +1 at fromY to -1 at toY (clamped), so the surface sits where
// the noise crosses the bias — roughly midway, perturbed by the noise.
func SimpleTerrain(seed int64) DensityFunction {
noise := NewNormalNoise(NewXoroshiro(seed), -4, []float64{1, 1, 1, 1})
bias := YClampedGradient{FromY: 40, ToY: 104, FromV: 1.0, ToV: -1.0}
perturb := Mul(Constant(0.7), NoiseDF{Noise: noise, XZScale: 0.2, YScale: 0.1})
return Add(bias, perturb)
}