nx_arc.nx
buildroot/runtime/nx_arc.nx
about
nx_arc.nx -- canonical arc + arc-stage substrate.
Arcs are the "events" of the day-as-a-movie metaphor (per cardinal
feedback-arc-and-moment-are-king-cinematographer-pattern). Each arc
is a sequence of stages; each stage has pools of allowed locations,
outfits, poses, expressions, and camera angles from which moments
are drawn.
nx_moment_resolve.nx (next brick) consumes Arc + ArcStage and emits
a fully-populated *DirectorsNote (from nx_directors_note.nx).
=== Flat-array layout pattern (per nx_canon_proportions) ============
To keep struct shapes fixed-size and avoid variable-length field
pointers (which trip the substrate's <=8-arg codegen lesson), this
primitive uses TWO flat i64 buffers attached to Arc:
arc.stages : flat array, NX_ARC_STAGE_FIELDS i64 per stage
arc.pools : flat array of pool ID values; stages reference
their pools via (offset, len) indices into this buffer
This is the same shape nx_canon_proportions uses for its 30-entry
canon table (5 i64 per entry, accessed via nx_canon_get).
=== Composition =====================================================
nx_directors_note.nx -- ArcSource sealed-enum is re-exported here
so the same value can flow into a
DirectorsNote.source_tag
nx_tier.nx -- nx_int alias
nx_string_ops.nx -- (when caller wants to attach string names)
genealogy_id: propp_morphology + campbell_monomyth + lindenmayer_systems +
syd_field_three_act_structure
lineage_id: nx_arc_v1
dependencies 2 imports · 5 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_arc_test.nxnx_director_pipeline.nxnx_director_pipeline_test.nxnx_moment_resolve.nxnx_moment_resolve_test.nx
structs
| 134 | struct Arc |
consts
| 51 | const NX_AS_AUTHORED: nx_int = 0 // hand-curated arc in DB |
| 52 | const NX_AS_DYNAMIC: nx_int = 1 // LLM-generated from chat |
| 53 | const NX_AS_GENERATED: nx_int = 2 // story-engine pre-generated |
| 54 | const NX_AS_COMPANION: nx_int = 3 // companion authored her own arc |
| 55 | const NX_AS_N_SOURCES: nx_int = 4 |
| 68 | const NX_AW_UNAWARE: nx_int = 0 // doesn't know she's seen |
| 69 | const NX_AW_PEEKING: nx_int = 1 // hint of awareness |
| 70 | const NX_AW_AWARE: nx_int = 2 // knows but acting natural |
| 71 | const NX_AW_EYE_CONTACT: nx_int = 3 // looking at camera/viewer |
| 72 | const NX_AW_DIRECT_ENGAGEMENT: nx_int = 4 // actively addressing |
| 73 | const NX_AW_N_LEVELS: nx_int = 5 |
| 88 | const NX_ET_NEUTRAL: nx_int = 0 |
| 89 | const NX_ET_TENDER: nx_int = 1 |
| 90 | const NX_ET_PLAYFUL: nx_int = 2 |
| 91 | const NX_ET_INTENSE: nx_int = 3 |
| 92 | const NX_ET_LONGING: nx_int = 4 |
| 93 | const NX_ET_TRIUMPHANT: nx_int = 5 |
| 94 | const NX_ET_REVERENT: nx_int = 6 |
| 95 | const NX_ET_DOMESTIC: nx_int = 7 // mundane chores, cooking, etc. |
| 96 | const NX_ET_ANTICIPATORY: nx_int = 8 |
| 97 | const NX_ET_AFTERGLOW: nx_int = 9 |
| 98 | const NX_ET_N_TONES: nx_int = 10 |
| 111 | const NX_AST_F_STAGE_NUMBER: nx_int = 0 |
| 112 | const NX_AST_F_AWARENESS: nx_int = 1 |
| 113 | const NX_AST_F_EMOTIONAL_TONE: nx_int = 2 |
| 114 | const NX_AST_F_MIN_AROUSAL_Q10: nx_int = 3 |
| 115 | const NX_AST_F_MAX_AROUSAL_Q10: nx_int = 4 |
| 116 | const NX_AST_F_IMAGES_BEFORE_ADVANCE: nx_int = 5 |
| 117 | const NX_AST_F_LOCATION_POOL_OFF: nx_int = 6 // offset into arc.pools |
| 118 | const NX_AST_F_LOCATION_POOL_LEN: nx_int = 7 |
| 119 | const NX_AST_F_OUTFIT_POOL_OFF: nx_int = 8 |
| 120 | const NX_AST_F_OUTFIT_POOL_LEN: nx_int = 9 |
| 121 | const NX_AST_F_POSE_POOL_OFF: nx_int = 10 |
| 122 | const NX_AST_F_POSE_POOL_LEN: nx_int = 11 |
| 123 | const NX_AST_F_EXPRESSION_POOL_OFF: nx_int = 12 |
| 124 | const NX_AST_F_EXPRESSION_POOL_LEN: nx_int = 13 |
| 125 | const NX_AST_F_CAMERA_POOL_OFF: nx_int = 14 |
| 126 | const NX_AST_F_CAMERA_POOL_LEN: nx_int = 15 |
| 127 | const NX_ARC_STAGE_FIELDS: nx_int = 16 |
| 144 | const NX_ARC_BYTES: nx_int = 56 // 7 fields * 8 |
| 248 | const NX_ARC_POOL_LOCATION: nx_int = 0 |
| 249 | const NX_ARC_POOL_OUTFIT: nx_int = 1 |
| 250 | const NX_ARC_POOL_POSE: nx_int = 2 |
| 251 | const NX_ARC_POOL_EXPRESSION: nx_int = 3 |
| 252 | const NX_ARC_POOL_CAMERA: nx_int = 4 |
| 253 | const NX_ARC_POOL_N_KINDS: nx_int = 5 |
functions
| 57 | func nx_as_source_is_valid(s: nx_int) -> nx_int called by 1: main |
| 75 | func nx_aw_level_is_valid(a: nx_int) -> nx_int called by 1: main |
| 100 | func nx_et_tone_is_valid(t: nx_int) -> nx_int called by 1: main |
| 151 | func nx_arc_alloc(arc_id: nx_int, n_stages: nx_int, |
| 192 | func nx_arc_stage_get(arc: *Arc, stage_idx: nx_int, field: nx_int) -> nx_int |
| 200 | func nx_arc_stage_set(arc: *Arc, stage_idx: nx_int, field: nx_int, value: nx_int) -> nx_int |
| 215 | func nx_arc_pool_get(arc: *Arc, idx: nx_int) -> nx_int |
| 221 | func nx_arc_pool_set(arc: *Arc, idx: nx_int, value: nx_int) -> nx_int |
| 230 | func nx_arc_stage_set_basic(arc: *Arc, stage_idx: nx_int, |
| 255 | func nx_arc_pool_kind_is_valid(k: nx_int) -> nx_int |
| 261 | func nx_arc_stage_set_pool(arc: *Arc, stage_idx: nx_int, |
| 296 | func nx_arc_stage_get_pool(arc: *Arc, stage_idx: nx_int, pool_kind: nx_int, |