code wiki / _hdl_build / nx_wire_endlesssky_gate.nx
nx_wire_endlesssky_gate.nx
buildroot/runtime/_hdl_build/nx_wire_endlesssky_gate.nx
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
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
structs
| none |
consts
| 36 | const ES_NFAC: i64 = 5 // 0 = player-trader, 1..4 = governments |
| 37 | const ES_RATE: i64 = 3 // production per territory per tick |
| 38 | const ES_MAXT: i64 = 300 |
| 39 | const ES_MNODES: i64 = 12 // mission graph nodes |
| 40 | const ES_MISSIONS_WIN: i64 = 3 |
| 41 | const ES_CREDITS_WIN: i64 = 1500 |
| 42 | const ES_CARGO_BASE: i64 = 40 |
| 43 | const ES_SKILL_TH: i64 = 8 // trades per skill rank |
| 44 | const ES_SKILL_MAX: i64 = 5 |
| 45 | const ES_OUTFIT_MAX: i64 = 4 |
| 46 | const ES_OUTFIT_COST: i64 = 300 |
| 48 | const ES_HDRN: i64 = 24 |
| 49 | const ES_WSW: i64 = 52 // ws_words(5) |
| 50 | const ES_NSV: i64 = 76 // 24 hdr + 52 worldsim words |
| 51 | const ES_SCHEMA: i64 = 7309 |
| 52 | const ES_CONTENT_SCHEMA: i64 = 7319 |
| 53 | const ES_ART_SCHEMA: i64 = 7329 |
| 55 | const ES_T1W: i64 = 8 |
| 56 | const ES_T2W: i64 = 25 |
| 58 | const EW_O_WS: i64 = 24 |
| 59 | const EO_CHT: i64 = 80 |
| 60 | const EO_CHR: i64 = 128 |
| 61 | const EO_CHS: i64 = 176 |
| 62 | const EO_IEN: i64 = 224 |
| 63 | const EO_HUD: i64 = 240 // nx_gamehud arena APPENDED (transient UI; hud[63]=777 lazy-init marker |
| 65 | const EG_WORDS: i64 = 304 |
| 66 | const ES_HUDINK: i64 = 30 // T11 experiential min ink (mission map is sparser than a 3D scene) |
| 68 | const E_SEED: i64 = 0 |
| 69 | const E_TICK: i64 = 1 |
| 70 | const E_TRADES: i64 = 2 |
| 71 | const E_MDONE: i64 = 3 |
| 72 | const E_CUR: i64 = 4 |
| 73 | const E_FLAGS: i64 = 5 |
| 74 | const E_GATED: i64 = 6 |
| 75 | const E_BLOCKED: i64 = 7 |
| 76 | const E_OUTFITS: i64 = 8 |
| 77 | const E_WIN: i64 = 9 |
| 78 | const E_EXPADD: i64 = 10 // accumulated ACCOUNTED production |
| 79 | const E_START: i64 = 11 // total wealth at game start |
| 80 | const E_NMODS: i64 = 12 |
| 81 | const E_MODP: i64 = 13 // 4 pairs (kind,val) -> 13..20 |
| 82 | const E_STEPS: i64 = 21 // mission steps executed via sv_choose |
| 83 | const E_RES1: i64 = 22 |
| 84 | const E_RES2: i64 = 23 |
| 235 | const ER2_W: i64 = 320 |
| 236 | const ER2_H: i64 = 180 |
functions
| 86 | func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 87 | func wn(v: i64) -> i64 |
| 96 | func 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 |
| 97 | func eckv(ck: i64, v0: i64) -> i64 |
| 102 | func e_ws(e: *i64) -> *i64 { return (e as i64 + EW_O_WS*8) as *i64 } |
| 103 | func e_mseed(e: *i64) -> i64 { return e[E_SEED]*31 + e[E_MDONE]*101 + 7 } |
| 105 | func e_outfit_kind(i: i64) -> i64 { if i%2==0 { return 0 } return 1 } called by 1: e_tick |
| 106 | func e_outfit_val(i: i64) -> i64 called by 1: e_tick |
| 112 | func e_new(e: *i64, seed: i64) -> i64 |
| 137 | func e_cargo(e: *i64) -> i64 |
| 142 | func e_tick(e: *i64) -> i64 called by 3: e_run_fulle_rchainmain calls 15: e_wsws_productionws_ticke_cargors_skill_rankws_trade+9 |
| 223 | func e_run_full(e: *i64) -> i64 |
| 237 | func e_render(e: *i64, fb: *i64) -> i64 |
| 264 | func e_fbck(fb: *i64) -> i64 |
| 268 | func e_rchain(seed: i64, ticks: i64, out: *i64) -> i64 |
| 293 | func e_serialize(e: *i64, S: *i64) -> i64 |
| 301 | func e_restore(e: *i64, S: *i64) -> i64 |
| 317 | func e_ck(e: *i64) -> i64 |
| 327 | func e_song(sng: *i64, k: i64, a2: i64, b2: i64, c2: i64) -> i64 called by 1: e_render_theme |
| 331 | func e_render_theme(smp: *i64, nsamp: i64) -> i64 |
| 360 | func main() -> i64 |