code wiki / _hdl_build / nx_wire_endlesssky_gate.nx

nx_wire_endlesssky_gate.nx

buildroot/runtime/_hdl_build/nx_wire_endlesssky_gate.nx

29437 B706 linesdepth 6pulls 19 transitivereach 0 importersview sourcekind gate/prooftopic wire
docsdependenciesstructsconstsfunctions

about

nx_wire_endlesssky_gate.nx -- TITLE WIRING #3: Endless Sky (space trading / adventure). An actual playable trading loop built ONLY from certified parts: nx_worldsim holds 5 factions (player-trader + 4 governments) whose economy CONSERVES wealth exactly (trades move credits, production is accounted); nx_plotgen generates mission graphs that the REAL nx_story_vm executes stepwise (branches taken when their flag-gates are satisfied, REFUSED when not); mission content round-trips through nx_gamesave as a durable content file; ship outfits apply as nx_rpgstats modifiers to cargo capacity and the trading skill ranks up through rs_skill_rank; the ambient theme renders through nx_gamemusic; the whole game state passes the GX-9 save/load transparency test. CAPS EXERCISED (bit = nx_gamebench capability index; measured mask = artifact payload[0]): bit 21 world-sim-factions bit 12 dialogue-tree-branching bit 19 scripting-content-format bit 9 rpg-stats-progression bit 16 audio-sfx-music bit 15 save-load-persistence bit 18 ui-menus-hud (nx_gamehud: every OUTFIT PURCHASE decided through a modal menu, returned id drives the buy) + bit 0 render-2d (nx_game_raster: live mission-map frame, pure fn of state). NOT exercised: none of the title's required vector remains unproven by this loop. FLAGSHIP (mutation target): CONSERVATION. Paying a mission reward by MINTING credits instead of transferring them from the government's treasury must drive the economy tooth RED (total grew beyond accounted production) while the game still plays to a win. DIALECT: no `else if`, no `||`, no multiline `else` (nx_cc parser desync -- see nx_wire_probe.nx aux2). license_tier: ORIGINAL expect_exit: 0

dependencies 11 imports · 0 importers

nx_syscalls.nx nx_gamehud.nx nx_game_raster.nx nx_frame_sanity.nx nx_wire_harness.nx nx_gamesave.nx nx_rpgstats.nx nx_worldsim.nx nx_plotgen.nx nx_gamemusic.nx nx_wire_endlesssky_gate.nx

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

imports: nx_syscalls.nxnx_gamehud.nxnx_game_raster.nxnx_frame_sanity.nxnx_wire_harness.nxnx_gamesave.nxnx_rpgstats.nxnx_worldsim.nxnx_plotgen.nxnx_gamemusic.nxnx_audio_wav.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 e_new e_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_pop ws_o_pop ↻ ws_clamp ws_set_terr ws_o_terr ↻ ws_clamp ↻ ws_total_res ws_nfac ↻ ws_o_res ↻ e_mseed pg_gen sys_mmap ↻ pg_bit pg_rng e_run_full e_tick e_ws ↻ ws_production ws_nfac ↻ ws_o_terr ↻ ws_tick ws_nfac ↻ ws_o_res ↻ ws_o_terr ↻

structs

none

consts

36const ES_NFAC: i64 = 5 // 0 = player-trader, 1..4 = governments
37const ES_RATE: i64 = 3 // production per territory per tick
38const ES_MAXT: i64 = 300
39const ES_MNODES: i64 = 12 // mission graph nodes
40const ES_MISSIONS_WIN: i64 = 3
41const ES_CREDITS_WIN: i64 = 1500
42const ES_CARGO_BASE: i64 = 40
43const ES_SKILL_TH: i64 = 8 // trades per skill rank
44const ES_SKILL_MAX: i64 = 5
45const ES_OUTFIT_MAX: i64 = 4
46const ES_OUTFIT_COST: i64 = 300
48const ES_HDRN: i64 = 24
49const ES_WSW: i64 = 52 // ws_words(5)
50const ES_NSV: i64 = 76 // 24 hdr + 52 worldsim words
51const ES_SCHEMA: i64 = 7309
52const ES_CONTENT_SCHEMA: i64 = 7319
53const ES_ART_SCHEMA: i64 = 7329
55const ES_T1W: i64 = 8
56const ES_T2W: i64 = 25
58const EW_O_WS: i64 = 24
59const EO_CHT: i64 = 80
60const EO_CHR: i64 = 128
61const EO_CHS: i64 = 176
62const EO_IEN: i64 = 224
63const EO_HUD: i64 = 240 // nx_gamehud arena APPENDED (transient UI; hud[63]=777 lazy-init marker
65const EG_WORDS: i64 = 304
66const ES_HUDINK: i64 = 30 // T11 experiential min ink (mission map is sparser than a 3D scene)
68const E_SEED: i64 = 0
69const E_TICK: i64 = 1
70const E_TRADES: i64 = 2
71const E_MDONE: i64 = 3
72const E_CUR: i64 = 4
73const E_FLAGS: i64 = 5
74const E_GATED: i64 = 6
75const E_BLOCKED: i64 = 7
76const E_OUTFITS: i64 = 8
77const E_WIN: i64 = 9
78const E_EXPADD: i64 = 10 // accumulated ACCOUNTED production
79const E_START: i64 = 11 // total wealth at game start
80const E_NMODS: i64 = 12
81const E_MODP: i64 = 13 // 4 pairs (kind,val) -> 13..20
82const E_STEPS: i64 = 21 // mission steps executed via sv_choose
83const E_RES1: i64 = 22
84const E_RES2: i64 = 23
235const ER2_W: i64 = 320
236const ER2_H: i64 = 180

functions

86func 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
87func wn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
96func ebit(i: i64) -> i64 { var v: i64=1; var k: i64=0; while k<i { v=v*2; k=k+1 } return v }
called by 1: main
97func eckv(ck: i64, v0: i64) -> i64
called by 2: e_ckmain
102func e_ws(e: *i64) -> *i64 { return (e as i64 + EW_O_WS*8) as *i64 }
103func e_mseed(e: *i64) -> i64 { return e[E_SEED]*31 + e[E_MDONE]*101 + 7 }
105func e_outfit_kind(i: i64) -> i64 { if i%2==0 { return 0 } return 1 }
called by 1: e_tick
106func e_outfit_val(i: i64) -> i64
called by 1: e_tick
112func e_new(e: *i64, seed: i64) -> i64
137func e_cargo(e: *i64) -> i64
called by 1: e_tick calls 1: rs_apply_mods
142func e_tick(e: *i64) -> i64
223func e_run_full(e: *i64) -> i64
called by 1: main calls 1: e_tick
237func e_render(e: *i64, fb: *i64) -> i64
264func e_fbck(fb: *i64) -> i64
called by 1: e_rchain calls 1: wh_fbck
268func e_rchain(seed: i64, ticks: i64, out: *i64) -> i64
293func e_serialize(e: *i64, S: *i64) -> i64
called by 1: main calls 1: e_ws
301func e_restore(e: *i64, S: *i64) -> i64
called by 1: main calls 3: e_wse_mseedpg_gen
317func e_ck(e: *i64) -> i64
called by 1: main calls 2: eckve_ws
327func e_song(sng: *i64, k: i64, a2: i64, b2: i64, c2: i64) -> i64
called by 1: e_render_theme
331func e_render_theme(smp: *i64, nsamp: i64) -> i64
called by 1: main calls 3: sys_mmape_songmus_render
360func main() -> i64