code wiki / _hdl_build / nx_game_breed.nx

nx_game_breed.nx

buildroot/runtime/_hdl_build/nx_game_breed.nx

13231 B249 linesdepth 4pulls 9 transitivereach 6 importersview sourcekind librarytopic game
docsdependenciesstructsconstsfunctions

about

nx_game_breed.nx -- the BREEDERS mechanic (ws=game-interact rung 3; operator-named first target; the Palworld capture loop reshaped: weaken -> WIN -> DOMINATE -> the defeated one SUBMITS and joins you -> BREED -> unique offspring). Composes the certified parts and adds ONLY the missing verbs: nx_creature_battle = the fight (deterministic, typed, transcripted) nx_game_companion = the ownership substrate (unique genes, investment, persistence) nx_rpgstats = stat derivation (saturating, order-independent) DESIGN LAWS HONORED: - DOMINANCE IS EARNED, NOT ROLLED: the margin is computed from the battle's real outcome (winner's remaining HP + level advantage). A scraped-by win does not dominate; a crushing one does. - SUBMISSION IS THE LOSER'S CHOICE, DATA-DRIVEN: each species carries a submit_bar (permil) -- a proud species must be beaten decisively. Rows are DATA; tuning never touches logic. - THE ONE YOU DOMINATED IS THE ONE YOU OWN: capture copies the EXACT gene vector (species+4 IVs), never re-rolls -- the endowment law from nx_game_companion carried through. - INHERITANCE IS REAL: every offspring gene comes from a parent's same slot +/- a bounded mutation (BRD_MUT), provable in-gate. No inheritance = no breeding game, just a slot machine. - SCENE BEATS ARE DATA: the engine emits (tick,beat,who,with) rows -- WIN/DOMINATE/SUBMIT/MATE/ BIRTH/DEFEAT. The presentation layer (VN/renderer) turns beats into scenes; adult content lives in content packs, never in mechanics. (Beat ring idiom shared with nx_game_agent events; extract to a common lib on the third consumer per migrate-on-touch.) All integer, deterministic. LIB, no main. license_tier: ORIGINAL

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_game_companion.nx nx_creature_battle.nx nx_game_genetics.nx nx_game_breed.nx nx_breeder_arena.nx nx_game_breed_gate.nx nx_game_taming.nx

imports: nx_syscalls.nxnx_game_companion.nxnx_creature_battle.nxnx_game_genetics.nx

imported by: nx_breeder_arena.nxnx_game_breed_gate.nxnx_game_taming.nx

structs

none

consts

31const BRD_SP_STRIDE: i64 = 8
51const BRD_BEAT_STRIDE: i64 = 4
52const BEAT_WIN: i64 = 1
53const BEAT_DEFEAT: i64 = 2 // the player lost (losable, by design)
54const BEAT_DOMINATE: i64 = 3 // margin cleared the bar
55const BEAT_SUBMIT: i64 = 4 // the beaten one yields and joins
56const BEAT_RESIST: i64 = 5 // won but NOT dominantly; she breaks away
57const BEAT_MATE: i64 = 6
58const BEAT_BIRTH: i64 = 7
157const BRD_MUT: i64 = 2 // max mutation distance per gene (the provable bound)

functions

32func brd_species_default(tbl: *i64) -> i64
called by 3: ba_runmainmain
47func brd_sp_type(tbl: *i64, s: i64) -> i64 { return tbl[s*BRD_SP_STRIDE + 0] }
48func brd_sp_submitbar(tbl: *i64, s: i64) -> i64 { return tbl[s*BRD_SP_STRIDE + 5] }
called by 1: brd_duel
59func brd_beats(bt: *i64) -> i64 { return bt[0] }
called by 2: mainmain
60func brd_beat_push(bt: *i64, cap: i64, tick: i64, kind: i64, a: i64, b: i64) -> i64
70func brd_beat_kind(bt: *i64, i: i64) -> i64 { return bt[1 + i*BRD_BEAT_STRIDE + 1] }
called by 2: mainmain
74func brd_to_creature(ros: *i64, h: i64, tbl: *i64, c: *i64, name: *u8) -> i64
90func brd_margin(win_hp: i64, win_maxhp: i64, win_lvl: i64, lose_lvl: i64) -> i64
called by 1: brd_duel
99func brd_duel(rosA: *i64, hA: i64, rosB: *i64, hB: i64, tbl: *i64, seed: i64,
132func brd_capture(dst: *i64, src: *i64, h: i64) -> i64
158func brd_rng(s: *i64) -> i64
called by 1: brd_gene
166func brd_gene(ga: i64, gb: i64, s: *i64) -> i64
called by 1: brd_breed_info calls 1: brd_rng
173func brd_cross_species(spA: i64, spB: i64, domA: i64) -> i64
called by 1: brd_breed_info
187func brd_breed_info(ros: *i64, hA: i64, hB: i64, domA: i64, seed: i64,
226func brd_breed(ros: *i64, hA: i64, hB: i64, domA: i64, seed: i64,
called by 2: ba_tickmain calls 2: sys_mmapbrd_breed_info
233func brd_inherit_ok(ros: *i64, ch: i64, hA: i64, hB: i64) -> i64
called by 1: main calls 1: en_get