code wiki / _hdl_build / nx_frontier_engine.nx

nx_frontier_engine.nx

buildroot/runtime/_hdl_build/nx_frontier_engine.nx

12388 B265 linesdepth 5pulls 15 transitivereach 0 importersview sourcekind tooltopic frontier
docsdependenciesstructsconstsfunctions

about

nx_frontier_engine.nx -- the SOVEREIGN engine behind the playable /world/frontier game: "Nishi Frontier" emitted by COMPOSING certified parts (the gamebench recombinator realized in NishiLang, not JS). A trader-explorer crossing a star map of faction stations -- find cargo (loot tiers), hold or SELL on a CONSERVED faction economy, level up, retire rich. A genre blend matching NO ingested reference title. The browser page is the last-mile playtest; THIS is the sovereign truth: it renders real PNG frames and PROVES the composition (conservation, determinism, save-load, experiential) so the same design is verified in the sovereign stack, not just the shim. Economics match the tuned live game exactly (hold-then-sell, sell = cargo*(50+lvl*12), win at 2400cr & level 5). Parts: nx_worldsim · nx_rpgstats · nx_loottable · nx_gamehud + nx_wire_harness · nx_game_raster · 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_worldsim.nx nx_rpgstats.nx nx_loottable.nx nx_gamehud.nx nx_game_raster.nx nx_wire_harness.nx nx_gamesave.nx nx_png_write.nx nx_game_art.nx nx_frontier_engine.nx

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

imports: nx_syscalls.nxnx_worldsim.nxnx_rpgstats.nxnx_loottable.nxnx_gamehud.nxnx_game_raster.nxnx_wire_harness.nxnx_gamesave.nxnx_png_write.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 fe_new rs_level_for_xp rs_xp_for_level rs_smul rs_sadd rs_clamp rs_derived_hp rs_sadd ↻ rs_smul ↻ rs_clamp ↻ stn_x stn_y g_ws ws_init ws_o_res ws_o_pop ws_nfac ws_o_terr ws_nfac ↻ ws_o_rel ws_nfac ↻ ws_set_res ws_o_res ↻ ws_set_terr ws_o_terr ↻ ws_clamp ws_set_pop ws_o_pop ↻ ws_clamp ↻ gh_init g_hud ws_total_res ws_nfac ↻ ws_o_res ↻ g_ws ↻ fe_render

structs

none

consts

22const F_MAGIC_1400: i64 = 1400
23const F_MAGIC_20260721: i64 = 20260721
24const F_MAGIC_1469598103: i64 = 1469598103
25const F_MAGIC_7401: i64 = 7401
27const NF: i64 = 5
28const FW: i64 = 400
29const FH: i64 = 240
30const WORDS: i64 = 512
31const F_TICK:i64=0
32const F_STN: i64=1
33const F_XP: i64=2
34const F_LVL: i64=3
35const F_HP: i64=4
36const F_CRED:i64=5
37const F_CARGO:i64=6
38const F_VIS: i64=7
39const F_SELLS:i64=8
40const F_FINDS:i64=9
41const F_WIN: i64=10
42const F_RNG: i64=11
43const F_PX: i64=12
44const F_PY: i64=13
45const F_HDR: i64=24
46const O_WS: i64=32 // ws_words(5)=56 -> 32..88
47const O_HUD: i64=96 // 96..160
48const XB: i64=20
49const XQ: i64=10
50const HPB: i64=12
51const HPC: i64=2
52const HPL: i64=3
53const CON: i64=14
54const WIN_CRED: i64=2400
55const WIN_LVL: i64=5

functions

57func g_ws(g: *i64) -> *i64 { return (g as i64 + O_WS*8) as *i64 }
58func g_hud(g: *i64) -> *i64 { return (g as i64 + O_HUD*8) as *i64 }
called by 2: fe_newfe_tick
59func g_rng(g: *i64) -> i64
called by 1: fe_tick
66func stn_x(i: i64) -> i64 { return 44 + i*76 }
67func stn_y(i: i64) -> i64 { if i%2==0 { return 84 } else { return 150 } }
69func sell_value(cargo: i64, lvl: i64) -> i64 { return cargo * (50 + lvl*12) }
called by 1: fe_tick
71func fe_new(g: *i64, seed: i64) -> i64
90func cargo_weights(wts: *i64) -> i64 { wts[0]=600; wts[1]=250; wts[2]=100; wts[3]=40; wts[4]=10; return 0 }
called by 1: fe_tick
92func fe_tick(g: *i64) -> i64
126func fe_render(g: *i64, fb: *i64) -> i64
169func fe_quality(fb: *i64) -> i64
called by 1: main calls 3: sys_mmapgc_scoregc_quality
174func fe_fbck(fb: *i64) -> i64 { return wh_fbck(fb, FW*FH) }
called by 1: main calls 1: wh_fbck
175func fe_png(fb: *i64, path: *u8) -> i64
called by 1: main calls 2: sys_mmapnx_png_write_rgb
189func 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
190func wn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
200func main() -> i64