code wiki / _hdl_build / nx_game_emit.nx

nx_game_emit.nx

buildroot/runtime/_hdl_build/nx_game_emit.nx

11049 B290 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind orphan librarytopic game
docsdependenciesstructsconstsfunctions

about

nx_game_emit.nx -- the GAME EMITTER: a data game-spec in, a complete playable game module out, hands-off. This is the autonomous game-gen lever (operator's choice): feed specs -> get games. It reads a game-spec (difficulty/theme/title + the combat FSM transition table) and WRITES a per-game .nx module that fills the engine config + FSM table and calls eng_run (nx_game_engine_lib). The generated game is then built native by Nishi's own toolchain and proven playable by a playthrough gate. Spec grammar (one key per line): name _game_foo module name (-> runtime/_hdl_build/_game_foo.nx) title THE CRYPT HUD title (rest of line) walls 22 interior wall count enemy_base 2 enemies at depth 1 enemy_per_level 1 extra enemies per depth ehp_base 18 enemy hp at depth 1 ehp_per_level 4 extra enemy hp per depth loot 3 loot pickups per level dmg_base 8 player base damage dmg_rand 8 player random damage span fsm 6 6 combat FSM dims (nstates nevents; dungenc convention) row ... one transition-table row per state (nevents ints, -1=none) HONEST AUTHORSHIP: this emitter + the engine library are TUTOR-authored tooling. The GAMES it writes are emitter output (the autonomy). Usage: nx_game_emit <specpath>. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_game_emit.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

structs

none

consts

26const K_MAGIC_2048: i64 = 2048

functions

28func p_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: emit_assignemit_head calls 1: sys_write
29func p_c(fd: i64, c: i64) -> i64 { let b: *u8 = sys_mmap(8); b[0] = c as u8; sys_write(fd, b, 1); return 0 }
called by 1: p_wn calls 2: sys_mmapsys_write
30func p_wn(fd: i64, v: i64) -> i64
called by 1: emit_assign calls 3: p_csys_mmapsys_write
44func gcstr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: gfind
45func gmatch(buf: *u8, pos: i64, key: *u8) -> i64
called by 3: gfindgtablegneeds
50func gline_start(buf: *u8, pos: i64) -> i64
called by 3: gfindgtablegneeds
55func gfind(buf: *u8, len: i64, key: *u8) -> i64
called by 2: gintgstr calls 3: gcstr_lengline_startgmatch
68func gpint(buf: *u8, pos: i64) -> i64
called by 2: gintgtable
84func gint(buf: *u8, len: i64, key: *u8, dflt: i64) -> i64
calls 2: gfindgpint
90func gstr(buf: *u8, len: i64, key: *u8, out: *u8) -> i64
calls 1: gfind
109func gtable(buf: *u8, len: i64, tbl: *i64) -> i64
146func gneeds(buf: *u8, len: i64) -> i64
164func build_path(name: *u8, out: *u8) -> i64
178func emit_assign(fd: i64, idx: i64, val: i64) -> i64
calls 2: p_wp_wn
182func emit_head(fd: i64) -> i64
calls 2: p_wsys_mmap
190func emit_cfg(fd: i64, vals: *i64) -> i64
202func emit_needs(fd: i64, name: *u8, mask: i64) -> i64
209func emit_title(fd: i64, title: *u8) -> i64
213func emit_table(fd: i64, tbl: *i64, n: i64) -> i64
225func emit_tail(fd: i64, ns: i64, ne: i64) -> i64
234func main(argc: i64, argv: *i64) -> i64