Biome-aware surface rules from the vanilla rule tree
Replaces the biome-blind fillVanillaColumn heuristics with a full interpreter for the overworld surface_rule tree (already embedded in overworld.json): block/sequence/condition/bandlands rules plus all 11 condition tests (biome, steep, hole, water, temperature, y_above, stone_depth, noise_threshold, not, vertical_gradient, above_preliminary_surface). - worldgen/blockids.go: name(+Properties)→network-ID table for surface blocks (grass/sand/terracotta/mycelium/podzol/coarse_dirt/sandstone/ calcite/snow/ice/...), with snowy property variants. - worldgen/surface.go: rule-tree parser + interpreter + SurfaceContext; LoadOverworldSurfaceRule caches the seed-independent tree. - loader.go: OverworldDensity.SurfaceRule() exposes the parsed tree. - biome_lookup.go: BiomeNameAt returns the biome name for biome tests. - vanilla.go: samples the 2D climate + biome before column fill, threads the rule tree and biome name into fillVanillaColumn, and applies it top-down with stone as the default for non-matching (deeper) blocks. The above_preliminary_surface gate uses an inclusive bound so the top solid block reaches the biome dispatch. - Performance: one per-column RNG and a reused SurfaceContext keep the overhead to ~+13ms/chunk (71ms vs 58ms baseline), within the gate.
This commit is contained in:
parent
d3142e7687
commit
4dcf938a85
8 changed files with 934 additions and 26 deletions
|
|
@ -124,6 +124,14 @@ func BiomeAt(od *worldgen.OverworldDensity, wx, wz int) uint16 {
|
|||
return biomeID(loadBiomeTable().FindBiome(point))
|
||||
}
|
||||
|
||||
// BiomeNameAt returns the resolved surface biome NAME at block (wx, wz), for
|
||||
// surface-rule biome tests which match on name. It mirrors BiomeAt but skips
|
||||
// the name→ID→name round-trip the ID path would require.
|
||||
func BiomeNameAt(od *worldgen.OverworldDensity, wx, wz int) string {
|
||||
point := worldgen.SampleColumn(od, SeaLevel, wx, wz)
|
||||
return loadBiomeTable().FindBiome(point)
|
||||
}
|
||||
|
||||
// BiomeAt3D returns the network biome ID for the biome cell containing block
|
||||
// (wx, wy, wz). s2D carries the five precomputed 2D climate axes for the column
|
||||
// (sampled once via SampleColumn2D); the 3D depth axis is evaluated at wy inside
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue