Vertical layers: surface, underground, cavern, underworld #20

Closed
opened 2026-11-07 18:28:29 +00:00 by claude · 2 comments
Member

Formalize depth layers with their own stone/wall types, cave density, ore tables, background tint and spawn tables. Add a strata.mapgen.layer_at(y) API that other systems (spawning, music, biome effects) can query. Tune depths so there are about 3 minutes of digging from the surface to the underworld.

Formalize depth layers with their own stone/wall types, cave density, ore tables, background tint and spawn tables. Add a `strata.mapgen.layer_at(y)` API that other systems (spawning, music, biome effects) can query. Tune depths so there are about 3 minutes of digging from the surface to the underworld.
claude added this to the v0.3 World & Biomes milestone 2026-11-07 18:28:29 +00:00
claude added the area/worldgen
priority
high
type
feature
labels 2026-11-07 18:28:29 +00:00
eric added this to the Strata Roadmap project 2026-11-07 18:36:39 +00:00
eric closed this issue 2026-11-12 06:21:47 +00:00
Author
Member

Done in 0e0c431.

What changed

  • The mapgen is driven by a layer table, strata.mapgen.layers. Each row has the layer's stone and wall, tunnel width, cavern threshold, ore table, background colour and spawn table. strata.mapgen.layer_at(y) returns the row for a height.
Layer From y Stone / wall Caves Ores
surface sky stone tunnels only copper
underground −20 stone tunnels, rare chambers (17% open) iron, copper
cavern −300 slate (new) large caverns (31% open) iron (richer), copper
underworld −900 basalt (new) mostly open (74%) none yet (#25)
  • Unbreakable bedrock from y = −1000 down.
  • Stone gets harder: slate is cracky = 2 (slow with copper), basalt is cracky = 1 (needs an iron pickaxe).
  • Boundaries dither over 6 rows; cave sizes ease over 16 rows.
  • The creature spawner reads the layer's spawn table (strata.spawn_candidates). Only the surface has an entry so far (slimes by day).
  • Below the surface layer the player's sky becomes the layer's flat colour with no sun, moon, stars or clouds. Walls are tinted per layer through their own textures.
  • Slate and basalt walls can be crafted at the Work Bench.

Depth tuning. Real dig times are about 0.18 s per stone block with a copper pickaxe, much faster than I first assumed, so the world is deeper than planned. The selftest digs 11 straight shafts to the underworld: 673 blocks dug and 239 rows of open cave on average, 168 s with a copper pickaxe.

Tests. 13 new cases in tests/strata_selftest/tests/layers.lua. Full suite: 79/79 pass locally, zero ERROR lines.

Not checked in the client: how the layer colours and new textures look, and the sky change when crossing a layer.

Note for existing worlds: areas already generated keep their old caves, so there are seams where new chunks meet old ones.

Done in 0e0c431. **What changed** - The mapgen is driven by a layer table, `strata.mapgen.layers`. Each row has the layer's stone and wall, tunnel width, cavern threshold, ore table, background colour and spawn table. `strata.mapgen.layer_at(y)` returns the row for a height. | Layer | From y | Stone / wall | Caves | Ores | |---|---|---|---|---| | surface | sky | stone | tunnels only | copper | | underground | −20 | stone | tunnels, rare chambers (17% open) | iron, copper | | cavern | −300 | slate (new) | large caverns (31% open) | iron (richer), copper | | underworld | −900 | basalt (new) | mostly open (74%) | none yet (#25) | - Unbreakable bedrock from y = −1000 down. - Stone gets harder: slate is `cracky = 2` (slow with copper), basalt is `cracky = 1` (needs an iron pickaxe). - Boundaries dither over 6 rows; cave sizes ease over 16 rows. - The creature spawner reads the layer's spawn table (`strata.spawn_candidates`). Only the surface has an entry so far (slimes by day). - Below the surface layer the player's sky becomes the layer's flat colour with no sun, moon, stars or clouds. Walls are tinted per layer through their own textures. - Slate and basalt walls can be crafted at the Work Bench. **Depth tuning.** Real dig times are about 0.18 s per stone block with a copper pickaxe, much faster than I first assumed, so the world is deeper than planned. The selftest digs 11 straight shafts to the underworld: 673 blocks dug and 239 rows of open cave on average, **168 s with a copper pickaxe**. **Tests.** 13 new cases in `tests/strata_selftest/tests/layers.lua`. Full suite: 79/79 pass locally, zero `ERROR` lines. **Not checked in the client:** how the layer colours and new textures look, and the sky change when crossing a layer. **Note for existing worlds:** areas already generated keep their old caves, so there are seams where new chunks meet old ones.
Author
Member

CI follow-up: runs 19916 and 19917 failed on the commits above. Two of the new cases timed out, because the shared runner took 49.5 s to generate the deep test column against a 20 s case limit; no assertion failed. Fixed in 140c2e0 (per-case timeouts, a narrower column). Run 19918 is green.

CI follow-up: runs 19916 and 19917 failed on the commits above. Two of the new cases timed out, because the shared runner took 49.5 s to generate the deep test column against a 20 s case limit; no assertion failed. Fixed in 140c2e0 (per-case timeouts, a narrower column). Run [19918](https://gitea.eom.dev/Gaming/luanti_game_strata/actions/runs/19918) is green.
Sign in to join this conversation.