code wiki / (root) / nx_campaign.nx

nx_campaign.nx

buildroot/runtime/nx_campaign.nx

8259 B212 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_campaign.nx -- WRITING arc, rung W-CAMP-1: the D&D CAMPAIGN structure model. Operator intent 2026-08-04: generate dnd campaigns -- the campaign/GM mode the writing-hub census lists as a GAP. A campaign script is a HEADER (setting/party/ quest) + SESSION -> ENCOUNTER blocks, each encounter a small key:value record (kind/time/location/npcs/goal/transit). This organ counts sessions+encounters, validates the record set, emits the per-encounter GM BRIEF the generation seat expands + the image-prompt seed (same image-gen ingestion as manga/scene), and makes the CAMPAIGN-CONTINUITY law MECHANICAL per feedback-arcs-as-dnd-campaign-multiverse-continuity: - time moves monotonically forward (cg_time_check counts regressions); - a location change without a transit beat is a teleport (cg_transit_check). The campaign TEXT is operator/lane DATA (the seam: engine structures, seat authors). DRY: markers via nx_manga mg_line_is/mg_count; fields via the nx_scenario whole-key parser on encounter byte sub-ranges. Pure integer, NO syscalls, caller owns buffers (the nx_note shape). license_tier: ORIGINAL module: nishi-core.write.campaign depends: nishi-core.write.manga nishi-core.write.scenario capability: WRITE_CAMPAIGN

dependencies 2 imports · 2 importers

nx_manga.nx nx_scenario.nx nx_campaign.nx nx_campaign_gate.nx nx_writer_run.nx

imports: nx_manga.nxnx_scenario.nx

imported by: nx_campaign_gate.nxnx_writer_run.nx

structs

none

consts

none

functions

24func cg_streq(a: *u8, b: *u8) -> i64
35func cg_header_end(buf: *u8, n: i64) -> i64
44func cg_count_sessions(buf: *u8, n: i64) -> i64 { return mg_count(buf, n, "SESSION\x00" as *u8) }
called by 2: mainwr_do_campaign calls 1: mg_count
45func cg_count_encounters(buf: *u8, n: i64) -> i64 { return mg_count(buf, n, "ENCOUNTER\x00" as *u8) }
48func cg_enc_start(buf: *u8, n: i64, idx: i64) -> i64
66func cg_enc_end(buf: *u8, n: i64, start: i64) -> i64
87func cg_validate(buf: *u8, n: i64) -> i64
107func cg_field_int(buf: *u8, n: i64, key: *u8) -> i64
called by 1: cg_time_check calls 1: sc_find_field
130func cg_time_check(buf: *u8, n: i64) -> i64
152func cg_transit_check(buf: *u8, n: i64, sa: *u8, sb: *u8, cap: i64) -> i64
179func cg_emit_brief(buf: *u8, n: i64, idx: i64, out: *u8, cap: i64) -> i64
200func cg_emit_img(buf: *u8, n: i64, idx: i64, out: *u8, cap: i64) -> i64