PoiSet.generate(island) places 10 to 16 points of interest per island from the seed's "poi" stream: hilltop shrines, lighthouses, docks, salt works, quarries and fishing hamlets, at least 85 m apart. Each kind has a siting rule (height band, flatness, coast or summit) that loosens step by step until its minimum is placed. Piers are sited so their deck clears the ground all the way out to water 1.5 m deep. Poi assembles each from modular parts in a local frame turned in quarter turns, so every solid stays an axis-aligned box: walls with a door and lintel, plinths, steps down to the ground, roofs, a stair to a loft. Each POI carries loot spawn markers, exposed through PoiSet.loot_markers(), and walking routes from open ground into its interiors. - Simulation adds every POI solid to its ground and never spawns players inside one. - SimGround indexes solids in 8 m cells, so collision queries only test nearby boxes. Smoke p95 tick is 0.47 ms with about 300 solids. - Movement tests the body where it will stand after stepping up, so stairs with treads narrower than the body can be climbed. The traversal test found the lighthouse stair impassable without it. - PoiView draws parts as one MultiMesh per look, in the seafaring palette. Capture scenarios poi_<kind> frame each kind. - Summit stone is darker so it no longer reads as snow. Tests: 30 seeds get every kind within its limits, 10 to 16 in total, spaced and sited; placement is deterministic; loot markers stand on floors and are not inside solids; a player walks every route of every POI on 4 seeds through doors, up steps and the lighthouse stair; stairs with 0.45 m treads are climbed and a step doesn't carry the body into a wall; the solid index matches a full scan on 500 queries. Closes #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
3.4 KiB
GDScript
88 lines
3.4 KiB
GDScript
## Capture scenario for the streamed island terrain. The camera stands `lift` metres above
|
|
## the ground at `eye` (x, z) and looks at `target`. With `crack_check` the sky is a flat
|
|
## magenta that appears nowhere in the terrain, so any crack between chunks shows up as
|
|
## magenta pixels for tools/crack_check.gd to count.
|
|
extends Node3D
|
|
|
|
const CRACK_COLOUR: Color = Color(1.0, 0.0, 1.0)
|
|
|
|
@export var island_seed: int = 2
|
|
@export var eye: Vector2 = Vector2(700.0, 760.0)
|
|
@export var lift: float = 12.0
|
|
@export var target: Vector3 = Vector3(520.0, 35.0, 470.0)
|
|
@export var show_lod: bool = false
|
|
@export var crack_check: bool = false
|
|
@export var fov: float = 70.0
|
|
## Off only in terrain_cracks_control, which must show cracks.
|
|
@export var skirts: bool = true
|
|
## When set, draw the island's points of interest and frame the first one of this kind:
|
|
## the camera stands `poi_view` (x right, y up, z out of the front) from its origin.
|
|
@export var poi_kind: String = ""
|
|
@export var poi_view: Vector3 = Vector3(6.0, 7.0, 22.0)
|
|
|
|
|
|
func _ready() -> void:
|
|
var island: Island = Island.generate(island_seed)
|
|
var environment: Environment = Environment.new()
|
|
if crack_check:
|
|
environment.background_mode = Environment.BG_COLOR
|
|
environment.background_color = CRACK_COLOUR
|
|
environment.ambient_light_source = Environment.AMBIENT_SOURCE_COLOR
|
|
environment.ambient_light_color = Color(0.5, 0.5, 0.5)
|
|
environment.tonemap_mode = Environment.TONE_MAPPER_LINEAR
|
|
else:
|
|
var sky_material: ProceduralSkyMaterial = ProceduralSkyMaterial.new()
|
|
sky_material.sky_top_color = Color(0.32, 0.5, 0.68)
|
|
sky_material.sky_horizon_color = Color(0.82, 0.78, 0.68)
|
|
sky_material.ground_bottom_color = Color(0.18, 0.2, 0.2)
|
|
sky_material.ground_horizon_color = Color(0.82, 0.78, 0.68)
|
|
var sky: Sky = Sky.new()
|
|
sky.sky_material = sky_material
|
|
environment.background_mode = Environment.BG_SKY
|
|
environment.sky = sky
|
|
environment.ambient_light_source = Environment.AMBIENT_SOURCE_SKY
|
|
environment.ambient_light_energy = 0.45
|
|
environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
|
environment.fog_enabled = true
|
|
environment.fog_light_color = Color(0.78, 0.78, 0.74)
|
|
environment.fog_density = 0.0005
|
|
environment.fog_aerial_perspective = 0.4
|
|
var world: WorldEnvironment = WorldEnvironment.new()
|
|
world.environment = environment
|
|
add_child(world)
|
|
|
|
var sun: DirectionalLight3D = DirectionalLight3D.new()
|
|
sun.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
|
|
sun.light_energy = 0.95
|
|
sun.shadow_enabled = not crack_check
|
|
sun.directional_shadow_max_distance = 600.0
|
|
add_child(sun)
|
|
|
|
var camera: Camera3D = Camera3D.new()
|
|
camera.fov = fov
|
|
camera.far = 2000.0
|
|
camera.position = Vector3(eye.x, island.ground.terrain_height(eye.x, eye.y) + lift, eye.y)
|
|
var look_at_point: Vector3 = target
|
|
if not poi_kind.is_empty():
|
|
var placed: PoiSet = PoiSet.generate(island)
|
|
var view: PoiView = PoiView.new()
|
|
view.setup(placed)
|
|
add_child(view)
|
|
for poi: Poi in placed.pois:
|
|
if poi.kind == poi_kind:
|
|
camera.position = poi.to_world(poi_view)
|
|
camera.position.y = maxf(camera.position.y, island.ground.terrain_height(camera.position.x, camera.position.z) + 2.0)
|
|
look_at_point = poi.origin + Vector3.UP * 2.5
|
|
break
|
|
add_child(camera)
|
|
camera.look_at(look_at_point)
|
|
camera.make_current()
|
|
|
|
var terrain: TerrainView = TerrainView.new()
|
|
terrain.setup(island)
|
|
terrain.focus = camera.position
|
|
terrain.show_lod = show_lod
|
|
terrain.skirts = skirts
|
|
add_child(terrain)
|
|
terrain.build_all_now()
|