code wiki / _hdl_build / nx_worldgen_refine.nx

nx_worldgen_refine.nx

buildroot/runtime/_hdl_build/nx_worldgen_refine.nx

15299 B334 linesdepth 8pulls 12 transitivereach 0 importersview sourcekind tooltopic worldgen
docsdependenciesstructsconstsfunctions

about

nx_worldgen_refine.nx -- TEAM-OWNED worldgen quality gate + AUTO-REFINE loop (operator 2026-06-10: "s class exceed instead of our crummy proc gen -- build the team to do the work"; operator 2026-05-16: "build an iterative loop ... i dont want to have to manually check if you generate good maps"). The loop nobody has to babysit: nx_procgen_landscape(seed, preset, w, h, density) -- current generator -> nx_world_quality_grade (8 axes, Q14, sealed F..S, refine_axis) -> hill-climb the exposed knobs (preset x density x seed batch) -> bank the BEST params to /tmp/nishi_worldgen_best.conf (data-driven; the voxel build reads params, never hardcodes them -- Cardinal 11) HONEST BASELINE FIRST: the first sweep grades the CURRENT generator as-is. "Crummy" becomes a NUMBER with named failing axes; every later rung (composed primitives: causal rivers, erosion, constraint placement per the procgen cardinals) must MOVE that number through this same gate. Note the grader's own posture: Minecraft/No-Man's-Sky/Houdini have NO mathematical world-quality verdict -- this instrument is itself the EXCEED axis; S-class = the generator earns NX_GRADE_S under it. WORLDGEN lines -> stdout + /tmp/nishi_worldgen_gate.log. Exit: 0 if best grade >= floor (argv[1], default C=2), else 1. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_worldgen_tunelib.nx nx_worldgen_refine.nx

imports: nx_syscalls.nxnx_tier.nxnx_worldgen_tunelib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_append sys_now_realtime_sec sys_mmap sys_clock_gettime_real sys_mmap ↻ wr_eval_cfg sys_mmap ↻ tl_load_knobs nx_water_default_river_dep _w_river_depth nx_water_default_rill_dept nx_water_default_rill_radi _w_rill_radius sys_mmap ↻ tl_read_file sys_openat_rd sys_read sys_close tl_conf_get tl_eval sys_mmap ↻ tl_compose_world nx_procgen_landscape_cfg nx_procgen_preset_is_valid _preset_octaves _preset_persistence_q10 _preset_base_radius _apply_density nx_perlin_alloc sys_mmap ↻ _perlin_lcg_step sys_mmap ↻ _fill_heightmap nx_perlin_fbm_2d nx_sig_compose_cfg _sig_n_peaks _sig_peak_radius _sig_peak_amp _sig_argmin

structs

none

consts

27const WR_MAGIC_8192: i64 = 8192
28const WR_MAGIC_8191: i64 = 8191
30const WR_W: i64 = 64
31const WR_H: i64 = 64
32const WR_RELIEF: i64 = 1024 // Q10 full-scale elevation
33const WR_SEEDS_PER_CFG: i64 = 3 // median-ish stability without burning cycles
34const WR_DENSITY_STEPS: i64 = 4 // density_q10 in {512, 1024, 1536, 2048}

functions

36func wr_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
calls 1: sys_write
37func wr_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
38func wr_cat_n(dst: *u8, off: i64, v: i64) -> i64
51func wr_grade_name(g: i64) -> *u8
61func wr_refine_name(r: i64) -> *u8
78func wr_eval_cfg(preset: i64, density_q10: i64, out12: *i64) -> i64
called by 1: main calls 3: sys_mmaptl_load_knobstl_eval
89func wr_report(logfd: i64, ts: i64, preset: i64, density: i64, out12: *i64) -> i64
123func wr_oscillation_check(ts: i64, grade: i64, axis: i64) -> i64
213func main(argc: i64, argv: *i64) -> i64