Skip to content

v0.19.0 — Caller-directed terrain shape (elevation_hint)

Choose a tag to compare

@sligara7 sligara7 released this 03 Jun 01:09

elevation_hint — art-direct the continent's shape

RegionalTerrainGenerator.generate(..., elevation_hint=…) lets a host (or an LLM) supply the macro land/sea/elevation shape while mapwright fills in organic coastlines, erosion, rivers and climate.

mask = [[0.0, 0.0, 0.0, 0.0],
        [0.0, 0.9, 0.6, 0.0],   # a coarse painted heightmap
        [0.0, 0.6, 0.3, 0.0],
        [0.0, 0.0, 0.0, 0.0]]
terrain = RegionalTerrainGenerator(SeededRNG(7)).generate(80, 56, elevation_hint=mask)
  • Pass a coarse 2D grid (rows north→south, cols west→east — easy for an LLM to emit) or a callable f(x_norm, y_norm) -> elevation over normalised [0, 1] coords.
  • Only relative ordering matters; sea_level still sets how much floods, and the full erosion/hydrology/biome pipeline runs on top — so rivers form and coasts stay organic.
  • Takes precedence over template; set edge_falloff=0 to allow land at the map borders. Non-finite (NaN/inf) hints raise rather than silently poisoning the map.

This is the most on-philosophy answer to "make shapes non-circular": the caller draws the shape, mapwright does the physics (the mapgen4 hint-map idea, clean-room). Pairs naturally with the media_service partnership — an LLM can sketch a continent and mapwright realises it.

Purely additive — the default (elevation_hint=None) output is byte-identical. The README gallery shows a hint-driven crescent continent.


315 tests pass; ruff clean.