code wiki / _hdl_build / nx_coc_engine.nx
nx_coc_engine.nx
buildroot/runtime/_hdl_build/nx_coc_engine.nx
about
nx_coc_engine.nx -- M1 MILESTONE: a Corruption-of-Champions-class TEXT-RPG ENGINE emitted by COMPOSING
certified parts. This is the recombinator claim made concrete for the adult-emitter program: a playable
branching text RPG with stats, transformation, adult-gated wardrobe, and persistence -- ZERO new game
logic, only composition of parts each certified-to-exceed ONCE (game_parts.tsv doctrine).
PLOT nx_plotgen (pg_gen) -- generates a SOLVABLE branching narrative graph
EXECUTION nx_story_vm (sv_choose) -- runs the graph as a data-driven state machine
STATS nx_rpgstats (rs_*) -- XP curve, level, saturating HP, skill
BODY nx_wardrobe_state (ws_*) -- clothing/exposure/TRANSFORMATION, ADULT-GATED by construction
SAVE nx_gamesave (gs_save) -- atomic bit-exact persistence
SELF-PROVING (self-gating like nx_frontier_engine): P1 winnable, P2 LOSABLE (a CoC-class game MUST be
losable or it is hollow), P3 deterministic, P4 save/load transparent, P5 ADULT-GATE HOLDS THROUGH THE
WHOLE LOOP (a minor can never reach an exposed wardrobe state, and an ADULT on the same seed DOES -- the
gate is real AND targeted), P6 solvable (the generated plot has a reachable ending).
HONEST SCOPE: this is the ENGINE (state machine + stats + transformation + adult-gating + persistence).
Narrative PROSE slots into the story-graph nodes as a later LLM-authored rung (nx_story_vm's design).
Emits a JSON proof line so agents/workflows can emit-and-prove an M1 game on demand (MCP tool).
license_tier: ORIGINAL expect_exit: 0
dependencies 6 imports · 0 importers
imports: nx_syscalls.nxnx_gamesave.nxnx_rpgstats.nxnx_story_vm.nxnx_plotgen.nxnx_wardrobe_state.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
| 27 | const CE_MAGIC_20260724: i64 = 20260724 |
| 28 | const CE_MAGIC_424242: i64 = 424242 |
| 29 | const CE_MAGIC_4096: i64 = 4096 |
| 31 | const CE_NODES: i64 = 12 |
| 32 | const CE_LEN: i64 = 16 // save vector: [0]node [1]flags [2]hp [3]xp [4]level [5]cycle [6..15]wardrobe(10) |
| 33 | const CE_MAXHP: i64 = 100 |
| 34 | const CE_TARGET: i64 = 3 // win requires level >= this |
| 35 | const CE_HAZ_PCT: i64 = 45 // chance a node is a hazard |
| 36 | const CE_HEAL: i64 = 8 // cautious recovers between nodes |
| 37 | const CE_TOLL: i64 = 22 // reckless pays a detour toll in HP |
| 38 | const CE_XPBASE: i64 = 100 |
| 39 | const CE_XPQUAD: i64 = 20 |
| 40 | const CE_M63: i64 = 0x7FFFFFFFFFFFFFFF |
| 41 | const CE_FNV: i64 = 1099511628211 |
| 42 | const CE_MIXA: i64 = 2654435761 |
| 43 | const CE_MIXB: i64 = 1274126177 |
functions
| 45 | func ce_hash(node: i64, seed: i64) -> i64 called by 1: ce_run |
| 54 | func ce_run(V: *i64, res: *i64, seed: i64, policy: i64, age: i64) -> i64 |
| 126 | func jc(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a } called by 1: main |
| 127 | func jn(o: *u8, at: i64, v: i64) -> i64 |
| 138 | func main() -> i64 |