code wiki / (root) / nx_worldgen_tunelib.nx

nx_worldgen_tunelib.nx

buildroot/runtime/nx_worldgen_tunelib.nx

14531 B325 linesdepth 7pulls 11 transitivereach 4 importersview sourcekind librarytopic worldgen
docsdependenciesstructsconstsfunctions

about

nx_worldgen_tunelib.nx -- shared library for the worldgen knob-tuning loop (no main; consumed by nx_worldgen_tuner, its KAT test, and nx_worldgen_refine). The capability this closes (operator 2026-06-10 "build the team's capabilities to handle your callouts"): the refine loop's auto-filed verdict NAMES a weak axis; this library lets a team organ OPTIMIZE the generator's exposed knobs against exactly that axis -- verdict -> assignment -> tuner -> re-verdict, with the 8-axis grader as referee and no LLM anywhere in the loop. Knobs (all DATA, swept under the verdict): river_depth -- channel incision depth (P4) rill_depth -- drainage texture depth (P4) rill_radius -- drainage density (poisson) (P4) detail_amp -- fine-octave relief (nx_sig_detail) Score = (grade, named-axis value) lexicographic: grade dominates; the banked refine axis breaks ties, so the tuner climbs the axis the verdict called out without ever trading the grade away. license_tier: ORIGINAL

dependencies 7 imports · 4 importers

nx_syscalls.nx nx_tier.nx nx_procgen_preset.nx nx_procgen_water.nx nx_procgen_biome.nx nx_procgen_features.nx nx_world_quality_grader.nx nx_worldgen_tunelib.nx _ts_diag.nx nx_worldgen_refine.nx nx_worldgen_tuner.nx nx_worldgen_tuner_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_procgen_preset.nxnx_procgen_water.nxnx_procgen_biome.nxnx_procgen_features.nxnx_world_quality_grader.nx

imported by: _ts_diag.nxnx_worldgen_refine.nxnx_worldgen_tuner.nxnx_worldgen_tuner_test.nx

structs

none

consts

28const TL_MAGIC_1024: i64 = 1024
29const TL_MAGIC_4096: i64 = 4096
30const TL_MAGIC_4095: i64 = 4095
32const TL_W: i64 = 64
33const TL_H: i64 = 64
34const TL_RELIEF: i64 = 1024
35const TL_SEEDS: i64 = 3
38const TL_K_RIVER_DEPTH: i64 = 0
39const TL_K_RILL_DEPTH: i64 = 1
40const TL_K_RILL_RADIUS: i64 = 2
41const TL_K_DETAIL_AMP: i64 = 3
42const TL_K_PEAKS_EXTRA: i64 = 4
43const TL_K_AMP_BOOST: i64 = 5
44const TL_K_TERRACE: i64 = 6
45const TL_K_COUNT: i64 = 7

functions

49func tl_compose_world(seed: i64, preset: i64, density: i64,
66func tl_eval(preset: i64, density: i64, knobs: *i64, out12: *i64) -> i64
102func tl_axis_offset(refine_axis: i64) -> i64
called by 2: tl_axis_valuemain
115func tl_axis_value(out12: *i64, refine_axis: i64) -> i64
called by 4: maintl_scoremainmain calls 1: tl_axis_offset
127func tl_health(out12: *i64) -> i64
called by 2: maintl_score
150func tl_score(grade: i64, out12: *i64, refine_axis: i64) -> i64
called by 3: mainmainmain calls 2: tl_axis_valuetl_health
165func tl_conf_get(buf: *u8, n: i64, key: *u8, fallback: i64) -> i64
209func tl_read_file(path: *u8, buf: *u8, cap: i64) -> i64
224func tl_conf_find_val(buf: *u8, n: i64, key: *u8) -> i64
called by 1: tl_conf_get_refine
251func tl_word_at(buf: *u8, n: i64, off: i64, word: *u8) -> i64
called by 1: tl_conf_get_refine
265func tl_conf_get_refine(buf: *u8, n: i64, fallback: i64) -> i64
called by 2: mainmain calls 2: tl_conf_find_valtl_word_at
280func tl_grade_name(g: i64) -> *u8
called by 2: tn_reportmain
290func tl_refine_name(r: i64) -> *u8
called by 2: tn_reportmain
306func tl_load_knobs(conf_path: *u8, preset: i64, knobs: *i64) -> i64