code wiki / _hdl_build / nx_drift_engine.nx

nx_drift_engine.nx

buildroot/runtime/_hdl_build/nx_drift_engine.nx

13551 B269 linesdepth 5pulls 15 transitivereach 0 importersview sourcekind tooltopic drift
docsdependenciesstructsconstsfunctions

about

nx_drift_engine.nx -- the SOVEREIGN engine behind /world/drift: "Nishi Drift", a SURVIVAL game emitted by composing certified parts in a DIFFERENT mix than Frontier (no worldsim -- survival is depletion, not a conserved economy). Stranded on a dying hauler: oxygen + hull bleed each cycle, scavenge sector wrecks (loot tiers), dive deep for double parts at the cost of hull or grab safe to recover air, repair the beacon (60 parts) and survive to cycle 12 for rescue -- or die. Proves the recombinator composes into a SECOND genre. The proof battery is genre-honest: the flagship is LOSABILITY (a survival game that cannot be lost is hollow), not conservation. Parts: nx_loottable · nx_rpgstats (rising scavenge skill) · nx_gamehud + nx_wire_harness (risk/safe menu) · nx_game_raster (render) · nx_gamesave · nx_frame_sanity (via harness) · nx_png_write. license_tier: ORIGINAL expect_exit: 0

dependencies 11 imports · 0 importers

nx_syscalls.nx nx_loottable.nx nx_rpgstats.nx nx_gamehud.nx nx_game_raster.nx nx_wire_harness.nx nx_gamesave.nx nx_png_write.nx nx_game_depth.nx nx_game_art.nx nx_drift_engine.nx

diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_loottable.nxnx_rpgstats.nxnx_gamehud.nxnx_game_raster.nxnx_wire_harness.nxnx_gamesave.nxnx_png_write.nxnx_game_depth.nxnx_game_art.nxnx_game_critic.nx

imported by: nobody (leaf or entry point)

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

main ww sys_write sys_mmap de_run de_new sec_x sec_y gh_init g_hud de_tick g_hud ↻ sec_x ↻ sec_y ↻ sys_mmap ↻ loot_weights lt_pick d_rng rs_skill_rank wh_menu_pick2 gh_menu_open gh_menu_item wh_menu_wrapsel gh_menu_move gh_menu_sel de_render art_nebula art_clampb gr_pack art_stardust gr_px gr_pack ↻ art_clampb ↻ gr_hline gr_rect sec_x ↻ sec_y ↻ gr_pack ↻ art_glow_orb gr_disc

structs

none

consts

22const WIN_MAGIC_1469598103: i64 = 1469598103
23const WIN_MAGIC_20260721: i64 = 20260721
24const WIN_MAGIC_7402: i64 = 7402
25const WIN_MAGIC_2000: i64 = 2000
27const NS: i64 = 5
28const FW: i64 = 400
29const FH: i64 = 240
30const WORDS: i64 = 512
31const WIN_CYCLE: i64 = 12
32const WIN_PARTS: i64 = 60
33const F_TICK:i64=0
34const F_SEC: i64=1
35const F_CYC: i64=2
36const F_OXY: i64=3
37const F_HULL:i64=4
38const F_PARTS:i64=5
39const F_SCAV:i64=6
40const F_SKILL:i64=7
41const F_DEEP:i64=8
42const F_WIN: i64=9
43const F_LOSE:i64=10
44const F_RNG: i64=11
45const F_PX: i64=12
46const F_PY: i64=13
47const F_CUR: i64=14 // current wreck tier
48const F_HDR: i64=24
49const O_HUD: i64=32

functions

50func g_hud(g: *i64) -> *i64 { return (g as i64 + O_HUD*8) as *i64 }
called by 2: de_newde_tick
51func d_rng(g: *i64) -> i64
called by 1: de_tick
58func sec_x(i: i64) -> i64 { return 44 + i*76 }
59func sec_y(i: i64) -> i64 { if i%2==0 { return 84 } else { return 150 } }
61func de_new(g: *i64, seed: i64) -> i64
called by 2: de_runmain calls 4: sec_xsec_ygh_initg_hud
74func loot_weights(wts: *i64) -> i64 { wts[0]=520; wts[1]=280; wts[2]=120; wts[3]=60; wts[4]=20; return 0 }
called by 1: de_tick
77func de_tick(g: *i64, policy: i64) -> i64
119func de_render(g: *i64, fb: *i64) -> i64
155func de_fbck(fb: *i64) -> i64 { return wh_fbck(fb, FW*FH) }
called by 1: de_run calls 1: wh_fbck
156func de_quality(fb: *i64) -> i64
called by 1: main calls 3: sys_mmapgc_scoregc_quality
161func de_png(fb: *i64, path: *u8) -> i64
called by 1: main calls 2: sys_mmapnx_png_write_rgb
168func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
169func wn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
179func de_run(g: *i64, seed: i64, policy: i64, fb: *i64) -> i64
192func main() -> i64