Per-preset height curve for terracing and flatter land #160

Open
opened 2026-10-11 20:23:46 +01:00 by liamjd · 0 comments
Owner

Milestone 2, items 3 (second half: height distribution) and 2 (first half: more flat land generally).

Problem

Height is linear in the noise: h = n * height_scale + datum_level, then floored into levels. Noise is smooth, so a linear map gives evenly spread levels, and the terrain is a staircase of narrow one-tile terraces everywhere. Buildings need a footprint with no level spread (placement_controller.max_level_spread = 0), so a narrow terrace is unbuildable even when it is gently sloped.

Proposal

A per-preset curve between the shaped noise and the height scale:

n = _apply_shape(n, x, z)
n = _apply_height_curve(n)   # new: remap to 0..1, sample the curve, back to -1..1
var h := n * preset.height_scale + preset.datum_level
  • @export var height_curve: Curve on TerrainPreset, null meaning linear. That keeps existing .tres files unchanged, and the Curve editor in the inspector makes it tunable without code.
  • A curve with flat shelves gives terracing: wide plateaus joined by short steep risers, which is the classic way to get buildable land out of noise. A curve that is flat low and steep high gives flat lowlands and sharp peaks.
  • Apply it after _apply_shape(), so a crater's profile is shaped too. Or before; decide which reads better and note why.
  • Optionally a terrace_steps: int shorthand that builds a stepped curve in code, if hand-authoring curves proves fiddly. Not required.

Each of the four presets gets a tuned curve as part of this ticket.

Acceptance criteria

  • TerrainPreset.height_curve exists, and null reproduces today's maps exactly. Pin that with a unit test against a fixed seed.
  • Each preset has a tuned curve, and the flat 3×3 site count at NORMAL rises for every preset. Before/after from tools/probe_terrain_stats.gd (#159) goes in the PR.
  • Main-region share does not fall for any preset. Wider plateaus with taller risers can wall regions off, which is exactly what #162 is then fighting.
  • Headed screenshots of each preset before and after.

Depends on

#159, so the curve is tuned against a size-independent range rather than retuned after it.

Milestone 2, items 3 (second half: height distribution) and 2 (first half: more flat land generally). ## Problem Height is linear in the noise: `h = n * height_scale + datum_level`, then floored into levels. Noise is smooth, so a linear map gives evenly spread levels, and the terrain is a staircase of narrow one-tile terraces everywhere. Buildings need a footprint with **no** level spread (`placement_controller.max_level_spread = 0`), so a narrow terrace is unbuildable even when it is gently sloped. ## Proposal A per-preset curve between the shaped noise and the height scale: ```gdscript n = _apply_shape(n, x, z) n = _apply_height_curve(n) # new: remap to 0..1, sample the curve, back to -1..1 var h := n * preset.height_scale + preset.datum_level ``` - `@export var height_curve: Curve` on `TerrainPreset`, null meaning linear. That keeps existing `.tres` files unchanged, and the Curve editor in the inspector makes it tunable without code. - A curve with flat shelves gives **terracing**: wide plateaus joined by short steep risers, which is the classic way to get buildable land out of noise. A curve that is flat low and steep high gives flat lowlands and sharp peaks. - Apply it **after** `_apply_shape()`, so a crater's profile is shaped too. Or before; decide which reads better and note why. - Optionally a `terrace_steps: int` shorthand that builds a stepped curve in code, if hand-authoring curves proves fiddly. Not required. Each of the four presets gets a tuned curve as part of this ticket. ## Acceptance criteria - [ ] `TerrainPreset.height_curve` exists, and null reproduces today's maps exactly. Pin that with a unit test against a fixed seed. - [ ] Each preset has a tuned curve, and the flat 3×3 site count at NORMAL rises for every preset. Before/after from `tools/probe_terrain_stats.gd` (#159) goes in the PR. - [ ] Main-region share does not fall for any preset. Wider plateaus with taller risers can wall regions off, which is exactly what #162 is then fighting. - [ ] Headed screenshots of each preset before and after. ## Depends on #159, so the curve is tuned against a size-independent range rather than retuned after it.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
liamjd/UntitledColonyBuilder#160
No description provided.