41 lines
1.6 KiB
GDScript
41 lines
1.6 KiB
GDScript
extends SceneTree
|
|
const GENERATOR := preload("res://scripts/planets/surface_generator.gd")
|
|
const DETAILS := preload("res://scripts/planets/surface_details.gd")
|
|
|
|
func _initialize() -> void:
|
|
var total := 0
|
|
var fallen := 0
|
|
for biome in 6:
|
|
var profile := {"temperature":75 if biome == 4 else (-35 if biome == 5 else 20)}
|
|
var data := GENERATOR.generate(200+biome, profile)
|
|
assert(int(data.landscape.index) == biome)
|
|
assert(data.pois.size() == 8 and data.structures.size() <= 5)
|
|
var original := var_to_str(data.details)
|
|
DETAILS.generate(data)
|
|
assert(original == var_to_str(data.details), "Decoration generation must be reproducible")
|
|
assert(not data.details.is_empty())
|
|
for detail in data.details:
|
|
assert(detail.position.length() > 210)
|
|
assert(DETAILS._height(data, detail.position) >= 0.315)
|
|
for poi in data.pois:
|
|
assert(detail.position.distance_to(poi.position) > 135)
|
|
for event in data.events:
|
|
assert(detail.position.distance_to(event.position) > 115)
|
|
total += data.details.size()
|
|
print("Biome ",biome,": ",data.details.size()," details, ",data.trees.size()," trees")
|
|
# Exercise rare-tree rolls on one fixed map, without baking terrain repeatedly.
|
|
for sample_index in 40:
|
|
data.seed = 10000+sample_index
|
|
DETAILS.generate(data)
|
|
var count := 0
|
|
for detail in data.details:
|
|
if int(detail.variant) == 12:
|
|
count += 1
|
|
assert(count <= 1)
|
|
if biome >= 4:
|
|
assert(count == 0)
|
|
fallen += count
|
|
assert(fallen > 0 and fallen < 32)
|
|
print("NATURE PASS: six biomes; ",total," details; reproducible generation; clear POI/event/landing areas; ",fallen," fallen trees across 240 samples")
|
|
quit()
|