OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-tps / scenes / maps / map_geiss_world.gd

50 lines · gd ref:
extends "res://scenes/maps/map_geiss_terraces.gd"
## THE TWO TOGETHER (2026-10-06): random-height terraces with the Geiss field draped on
## every tread as their detail octave — TerraceGeissGraph, knob values from both bridged
## scenes. Material and fly camera as map_geiss_terraces (plain rock shading, altitude
## ramp over the terrace range); voxel 0.5 in the .tscn for the Geiss lumps.


func _ready() -> void:
	super()
	_place_on_surface()


func _field_graph() -> ProcNodeGraph:
	return TerraceGeissGraph.make_from_scenes()


## SPAWN, PLAYER AND THE HOME PAD ON THE REAL TOP SURFACE (TerraceGeissGraph.surface_at:
## terraces + Geiss lumps, scanned from above, so never inside rock or in a cave). The
## .tscn's heights are map_geiss's (y = 6): on this terrain that can be tens of metres
## inside a terrace — the start camera's first height was. Same shape as
## map_dc_erosion._place_player. A column with no surface is logged LOUDLY and its node
## left where the scene put it.
func _place_on_surface() -> void:
	var kn := TerraceGeissGraph.scene_knobs()
	for spec in [["SpawnPoint", Vector2(0.0, 16.0), 2.0], ["Player", Vector2(0.0, 16.0), 2.0],
			["TeleporterToHome", Vector2(6.0, 16.0), 0.0]]:
		var n := get_node_or_null(String(spec[0])) as Node3D
		if n == null:
			continue
		var xz: Vector2 = spec[1]
		var y := _graph_y(func(x: float, z: float) -> float:
				return TerraceGeissGraph.surface_at(x, z, kn[0], kn[1]), xz.x, xz.y)
		if is_nan(y):
			push_error("[geiss-world] no surface in column (%.0f, %.0f) — %s left at the scene's position"
					% [xz.x, xz.y, spec[0]])
			continue
		n.position = Vector3(xz.x, y + float(spec[2]), xz.y)
		print("[geiss-world] %s on the surface at y = %.1f" % [spec[0], y])


## 60 m above the terrace under it (the Geiss lumps reach ~15 m above a tread), looking
## down 15 degrees so the detail on the treads is readable. The height comes FROM THE
## FIELD: the first version hard-coded 120 m, the surface there is 150 m, and the camera
## started inside the rock with nothing to see.
func _camera_start() -> Array:
	var kn := TerraceGraph.tknobs_for(TerraceGraph.load_terraces())
	var y := _graph_y(func(x: float, z: float) -> float: return TerraceGraph.surface_at(x, z, kn), 0.0, 300.0) + 60.0
	print("[geiss-world] start camera %.0f m (terrace %.0f m below)" % [y, 60.0])
	return [Vector3(0.0, y, 300.0), -15.0]