nx_anchor_feature.nx
buildroot/runtime/nx_anchor_feature.nx
about
nx_anchor_feature.nx -- singular landmark-feature contributions.
Solves the "generic FBM noise" problem for procgen worlds. Pure
fractional Brownian motion gives terrain that LOOKS LIKE A WORLD
in the abstract but has no signature features. Real worlds have
landmarks that POP: Olympus Mons (22 km shield volcano, single
massive cone), Hellas Basin (7 km deep impact crater 2300 km
across), Valles Marineris (4000 km canyon system), Mt Everest,
Mariana Trench, Caloris Basin on Mercury.
This primitive ships the SHAPE FUNCTIONS for those features.
Caller queries a feature's contribution at a (px, py) world coord;
composer adds the contribution to the base FBM height. Body-
specific anchor lists (Olympus Mons at 18 N 226 E, etc.) ship in
nishi-engine/nx as the per-body data layer that composes this
primitive into the surface generator.
V1 kinds shipped (3):
VOLCANIC_DOME -- Olympus Mons style: single radial peak with
parabolic falloff (smooth shield-volcano profile)
IMPACT_BASIN -- Hellas style: large circular depression with
optional raised rim (negative magnitude)
RIDGE -- mountain-range linear feature, 4-cardinal
orientations (N-S or E-W in v1; arbitrary
angle in v2 via nx_camera_q14 sin/cos import)
V2 kinds queued (2):
CANYON -- Valles Marineris style: linear depression with
optional inner ridge / chasma structure
PLATEAU -- Tharsis Bulge style: smooth flat-topped uplift
Per cardinal `feedback-procgen-causal-growth-not-direct-sampling`:
anchor features ARE the causal layer that makes one world feel
distinct from another. Without them you get noise; with them you
get geography.
Loss audit: Q14 integer arithmetic throughout. Parabolic falloff
is exact in Q14. Linear-feature distance is exact for the 2
cardinal orientations supported in v1.
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_body_anchors.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 53 | const NX_MAGIC_22000: i64 = 22000 |
| 54 | const NX_MAGIC_7000: i64 = 7000 |
| 55 | const NX_MAGIC_8000: i64 = 8000 |
| 56 | const NX_MAGIC_6395: i64 = 6395 |
| 57 | const NX_MAGIC_6405: i64 = 6405 |
| 58 | const NX_MAGIC_5000: i64 = 5000 |
| 59 | const NX_MAGIC_3000: i64 = 3000 |
| 62 | const NX_ANCHOR_Q: nx_int = 16384 |
| 66 | const NX_ANCHOR_VOLCANIC_DOME: nx_int = 0 |
| 67 | const NX_ANCHOR_IMPACT_BASIN: nx_int = 1 |
| 68 | const NX_ANCHOR_RIDGE: nx_int = 2 |
| 69 | const NX_ANCHOR_CANYON: nx_int = 3 // queued v2 |
| 70 | const NX_ANCHOR_PLATEAU: nx_int = 4 // queued v2 |
| 72 | const NX_ANCHOR_KIND_COUNT: nx_int = 5 |
| 75 | const NX_ANCHOR_ORIENT_NS: nx_int = 0 // N-S running; varies in Y |
| 76 | const NX_ANCHOR_ORIENT_EW: nx_int = 1 // E-W running; varies in X |
functions
| 79 | func nx_anchor_kind_is_valid(k: nx_int) -> nx_int called by 1: main |
| 88 | func nx_anchor_orient_is_valid(o: nx_int) -> nx_int |
| 101 | func nx_anchor_volcanic_dome( |
| 124 | func nx_anchor_impact_basin( |
| 148 | func nx_anchor_ridge( |
| 200 | func nx_anchor_canyon( |
| 247 | func nx_anchor_plateau( |
| 283 | func nx_anchor_feature_contribution( |
| 312 | func main() -> i64 |