code wiki / _hdl_build / nx_game_breed.nx
nx_game_breed.nx
buildroot/runtime/_hdl_build/nx_game_breed.nx
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
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
| 31 | const BRD_SP_STRIDE: i64 = 8 |
| 51 | const BRD_BEAT_STRIDE: i64 = 4 |
| 52 | const BEAT_WIN: i64 = 1 |
| 53 | const BEAT_DEFEAT: i64 = 2 // the player lost (losable, by design) |
| 54 | const BEAT_DOMINATE: i64 = 3 // margin cleared the bar |
| 55 | const BEAT_SUBMIT: i64 = 4 // the beaten one yields and joins |
| 56 | const BEAT_RESIST: i64 = 5 // won but NOT dominantly; she breaks away |
| 57 | const BEAT_MATE: i64 = 6 |
| 58 | const BEAT_BIRTH: i64 = 7 |
| 157 | const BRD_MUT: i64 = 2 // max mutation distance per gene (the provable bound) |
functions
| 32 | func brd_species_default(tbl: *i64) -> i64 |
| 47 | func brd_sp_type(tbl: *i64, s: i64) -> i64 { return tbl[s*BRD_SP_STRIDE + 0] } |
| 48 | func brd_sp_submitbar(tbl: *i64, s: i64) -> i64 { return tbl[s*BRD_SP_STRIDE + 5] } called by 1: brd_duel |
| 59 | func brd_beats(bt: *i64) -> i64 { return bt[0] } |
| 60 | func brd_beat_push(bt: *i64, cap: i64, tick: i64, kind: i64, a: i64, b: i64) -> i64 |
| 70 | func brd_beat_kind(bt: *i64, i: i64) -> i64 { return bt[1 + i*BRD_BEAT_STRIDE + 1] } |
| 74 | func brd_to_creature(ros: *i64, h: i64, tbl: *i64, c: *i64, name: *u8) -> i64 |
| 90 | func brd_margin(win_hp: i64, win_maxhp: i64, win_lvl: i64, lose_lvl: i64) -> i64 called by 1: brd_duel |
| 99 | func brd_duel(rosA: *i64, hA: i64, rosB: *i64, hB: i64, tbl: *i64, seed: i64, called by 2: ba_duel_wildmain calls 8: sys_mmapbrd_to_creaturecb_battlebrd_marginbrd_beat_pushcomp_vec+2 |
| 132 | func brd_capture(dst: *i64, src: *i64, h: i64) -> i64 |
| 158 | func brd_rng(s: *i64) -> i64 called by 1: brd_gene |
| 166 | func brd_gene(ga: i64, gb: i64, s: *i64) -> i64 |
| 173 | func brd_cross_species(spA: i64, spB: i64, domA: i64) -> i64 called by 1: brd_breed_info |
| 187 | func brd_breed_info(ros: *i64, hA: i64, hB: i64, domA: i64, seed: i64, |
| 226 | func brd_breed(ros: *i64, hA: i64, hB: i64, domA: i64, seed: i64, |
| 233 | func brd_inherit_ok(ros: *i64, ch: i64, hA: i64, hB: i64) -> i64 |