中
Chapter 23. The Character State Machine

Part V — Continuity Engineering: Character, Space, Action

Chapter 23. The Character State Machine#

In this chapter
23.1 Continuity is state inheritance23.2 State snapshots23.3 Events modify state23.4 Left and right hands are a frequent failure source23.5 Emotion has an entry, a peak and an exit23.6 Knowledge state stops characters "having read the script"23.7 Relationship state propagates too23.8 Time jumps and state compression23.9 Priority when states conflict23.10 Send the model only the relevant state23.11 State lint23.12 SOP for the state machine23.13 Fault tree23.14 Checklist, exercises and deliverables23.15 Field semantics matter more than field count23.16 Event sourcing, rollback and branching23.17 Project fact, character belief and audience knowledge23.18 The full life of one state, from script to finished cutA note on sources

23.1 Continuity is state inheritance#

"Remember she is wearing the grey suit" is not a system. Each shot reads the previous shot's exit state on entry, executes its events, and produces a new exit state. Unless an event modifies it, state should be inherited automatically.

Character state includes at minimum: identity version, wardrobe and overlays, hair and makeup, injuries, emotion, posture, left and right hands, props, screen position, eyeline target, knowledge and relationships. Not all of it is visible in every shot; the facts persist regardless.

Figure 23-1 Character state advancing in parallel through a scene

Figure 23-1 Within one scene, wardrobe, props, emotion and knowledge are four parallel tracks that change at different rates. The shot shows only a person; the system must know when the pen was lost, when the emotion broke, and when the secret was understood.

Read the diagram both vertically and horizontally. Vertically, confirm the four kinds of state are compatible at one moment. Horizontally, confirm each kind of state changed only through an explicit event. A character leaving frame does not clear her state — the next scene still inherits the secret she now knows and the pen she has not recovered.

23.2 State snapshots#

character_state:
  shot: E001_S08
  character: CH_LINYUN
  identity: CH_LINYUN_FACE@v03
  wardrobe: WD_LINYUN_GREY_SUIT@v02
  appearance:
    hair: neat_center_part
    makeup: office_neutral
    injury: none
  body:
    position: boardroom_door_zone
    orientation: facing_table_east
    posture: upright
  hands:
    left: holding_PROP_OLD_PEN
    right: touching_PROP_AUTHORIZATION_on_table
  screen:
    position: left_third
    eyeline: CH_LINWEI_right
  emotion:
    in: restrained
    out: controlled_dominance
  knowledge:
    gained: the chair has verified the signature on the authorization

State fields use enumerations or asset IDs, which reduces the amount of approximate free text.

23.3 Events modify state#

State changes only through explicit events: pick up, put down, hand over, injure, change clothes, learn, enter, leave. Each event records the old value, the new value and the shot that evidences it.

state_event:
  id: EVT_E001_S09_AUTH_PICKUP
  entity: CH_LINYUN
  field: hands.right
  from: touching_PROP_AUTHORIZATION_on_table
  to: holding_PROP_AUTHORIZATION_chest_height
  visible_in: E001_S09

If the next shot shows a phone in her right hand with no event putting the document down and picking the phone up, the continuity check should raise an error.

23.4 Left and right hands are a frequent failure source#

Mirroring, reverse angles and generation randomness all swap hands. Define left and right in the character's world coordinates, never by their position in frame. Mirror-flipping footage moves the mole, the buttons and any text together, so composition alone is not a sufficient check.

Record grip, orientation and visibility for interactions with key props. A simple shot may mark the hand as off screen, and the state still has to be inherited.

23.5 Emotion has an entry, a peak and an exit#

Writing only "angry" per shot produces jumps in performance. Record emotion_in, the trigger, the peak, and emotion_out. The next shot starts from the previous exit intensity unless there is a time jump or a regulating action.

emotion_transition:
  in: controlled_anger_2
  trigger: the father's name appears on the screen
  peak: shock_4_suppressed
  regulation: stops turning the pen, inhales, does not look at Zhou Lan
  out: fear_and_focus_3

Emotional continuity does not mean an unchanging expression. It means change with a trigger and a process of regulation.

23.6 Knowledge state stops characters "having read the script"#

A character can only act on information she has actually acquired. Update knows after a reveal. For lies, record separately what the character believes and what is true.

In E001 Lin Yun only knows her father's name appears on an account; she does not know he is alive. Having her declare that her father is alive is a knowledge continuity error, however continuous the picture is.

23.7 Relationship state propagates too#

Trust, debt, forms of address and public relationships update after significant events. A character may keep using the same title on the surface while their behavior reflects the change.

After E003 proves Chen Mo did not delete the record, Lin Yun's trust moves from 1 to 2. She need not embrace him immediately, and the next scene should not continue in exactly the same hostile register.

23.8 Time jumps and state compression#

Crossing to another day does not clear state. Injuries, knowledge, relationships and possessions persist; wardrobe, hair and location may change through a costume change or a movement event. Establish time-jump rules: which fields hold automatically, which must reset, and which need a visible explanation.

The next day can reasonably justify different clothes. It cannot justify a wound disappearing or a secret being forgotten.

23.9 Priority when states conflict#

When the script, the assets, the shot list and an approved cut disagree, one authority must be established. Usually the fact ledger and the most recent approved change rank highest. If finished footage conflicts with the facts, either fix the footage or approve a story change — an error must not quietly become the truth.

The state resolver reports conflicts. It does not guess.

23.10 Send the model only the relevant state#

Full project state is large. Generating E001_S09 needs the character's currently visible state, the history relevant to this action, and the handoff to the next shot. It does not need the season's secrets. A context compiler extracts the minimum slice from total state.

Excess state dilutes the important constraints, and can even pull a future injury or costume into the present shot.

23.11 State lint#

Automated checks can find: props appearing or vanishing; left and right hands swapping; wardrobe version changing with no event; injuries out of range; a character present after leaving; knowledge arriving early; time running backwards; emotional intensity jumping with no trigger; and screen position conflicting with the established axis.

Lint reports factual inconsistency. It does not judge whether a character "should be sadder." Emotional plausibility still needs performance review.

23.12 SOP for the state machine#

First, build each scene's character entry state. Second, inherit the previous shot's exit state. Third, modify only through state events. Fourth, record hands, props, position, eyeline and emotion. Fifth, update knowledge and relationships after reveals. Sixth, inherit across time by field rules. Seventh, compile the minimum relevant state for the model. Eighth, run lint and have the continuity owner resolve conflicts. Ninth, write approved shots' real state back.

23.13 Fault tree#

Symptom: the prop changes hands every shot. There is no left/right field, or footage was mirrored. Lock world-coordinate handedness and forbid unaudited flips.

Symptom: performance jumps from calm to collapse. Only a target emotion was given, with no entry and no trigger. Add the emotion transition.

Symptom: a character knows something not yet revealed. Knowledge state is unmanaged and the model received the whole season. Send only the currently known slice.

Symptom: the wound disappears after a location change. A change of place was wrongly treated as a state reset. Inherit by field.

Symptom: the script and the cut are each their own truth. There is no authority and no write-back. Establish approved state and a change process.

23.14 Checklist, exercises and deliverables#

Check that state has entry and exit; that changes are triggered by events; that hands are in world coordinates; that emotion is continuous; that knowledge updates on reveals; that inheritance across days is correct; that the model receives only relevant state; and that approved cuts are written back.

Exercise one: write complete state for a six-shot document handoff. Exercise two: find the knowledge-arriving-early errors in a passage of script. Exercise three: simulate inheritance of wardrobe, injury, relationship and props across a night. Exercise four: define the authority for five classes of state conflict.

Deliverables for this chapter: the character state snapshot, the state event log, emotion transitions, the knowledge ledger, relationship updates, state lint, and the shot state write-back record.

23.15 Field semantics matter more than field count#

The most common failure of a state table is not too few fields. It is different stations understanding the same field differently. Does location mean the scene name, a zone in the room, or a position in frame? Does emotion hold the internal state, the outward performance, or the director's target? Does wardrobe mean the costume set, or the current worn state including opened buttons, wetness and stains? Each field needs a type, units, an enumerated range, a default inheritance rule, write permissions and a source of evidence.

field_definition:
  name: prop_possession
  type: map[prop_id, possession_state]
  allowed: [not_present, visible_unheld, held_left, held_right, concealed, transferred]
  inheritance: carry_forward_until_event
  writers: [continuity_agent, approved_human_override]
  required_evidence: shot_or_script_event
  render_scope: only_visible_props

The state schema must distinguish unknown, not_applicable and not_visible. A right hand out of frame does not mean it is holding nothing. The audience not yet knowing whether the mother is alive does not mean the project fact is unknown. A wound not resolvable in a wide has not disappeared. Treating "not visible" as an empty value is a major source of props and injuries suddenly resetting.

23.16 Event sourcing, rollback and branching#

Do not repeatedly overwrite one "current state" and lose the history. The project stores an initial snapshot plus state events in order, and derives current state by replaying them. That lets you answer when Lin Yun obtained the phone, which shot handed the document to Zhou Lan, when the wound first appeared, and which later shots a given script revision affects.

Figure 23-2 A state event updates the current snapshot and invalidates dependent shots

Figure 23-2 An initial state passes through prop, position and emotion events to form the current snapshot. Once an upstream event changes, dependent shots referencing the old state cannot go on impersonating valid assets — they are marked stale, recompiled and re-verified.

The red shots in the diagram are not "badly rendered." Their basis has expired. However beautiful they look, they cannot simply be kept; they turn green again only when the change is proven not to affect them, or after approved adaptation and regression. This is precisely what separates a state system from folder management: a file existing does not mean the file is still valid.

Script revisions especially need branching. If E006 deletes the moment Lin Yun's phone is taken, every later phone_absent in the old branch should be invalidated; the system replays events from the deletion point and produces an impact list. Approved shots are never silently rewritten — they are marked as having an expired basis, and the producer decides between redoing, changing the story, or granting an exception.

Rollback is not deletion of history. An erroneous event keeps its state, its reason and its replacement event, so that a postmortem can determine why an agent produced the error. An agentic system that sees only the final snapshot cannot learn which rule failed; keeping the event chain is what locates whether the fault was in the input facts, the parsing, the generation or the human approval.

23.17 Project fact, character belief and audience knowledge#

Knowledge has at least three layers: what is true in the project, what the character believes, and what the audience currently knows. All three can differ at one moment. The project fact is that Lin Yun's father is alive. Lin Yun knows only that his name appears on an account. The audience may have seen a blurred figure, and therefore suspects without confirmation. Writers, performers and the edit depend on different layers, and merging them into one knows list produces performances that leak the plot.

Lies need a source and a confidence level. Lin Wei claims the father is dead; Lin Yun may provisionally accept it while doubting — which is not a simple true or false. Character behavior is driven by their belief state; the distribution of information in shots is driven by audience knowledge. The generation context sends only what the character can currently act on, rather than loading the project truth into a prompt and expecting the model to pretend not to know.

Each reveal produces two kinds of event. A fact-exposure event updates who — characters and audience — now knows what. A relationship-interpretation event updates how they now understand the speaker. The authorization being genuine does not only tell the room Lin Yun is entitled to be there; it makes Zhou Lan re-evaluate everything Lin Wei said earlier. That second layer determines the forms of address, distance and willingness to cooperate in the next scene.

23.18 The full life of one state, from script to finished cut#

Take "Lin Yun holds the authorization in her right hand." The script action creates an expected event. Shot design decides which shot completes it. The keyframe pack compiles the right hand and the document's orientation into visible constraints. Video generation produces candidates. Continuity review observes the actual result. On approval, the finished fact is written back as held_right. If a candidate actually holds it in the left hand, the system must not edit the expected state so the review passes; it produces a difference and routes it.

Only when the director approves a change of action is a new change event created, moving the expectation from right to left, and checking whether later handshakes, phone operation and composition are affected. That rule prevents "whatever the model generated becomes the story fact."

State packets also record their valid interval. The document is picked up at E001_S08 and set down at S14; later shots no longer inherit the holding state. A state with no ending event propagates like a memory leak. Every temporary state either has an explicit end condition or is overwritten by a new event.

A note on sources#

A fixed prompt can describe a character. Only a state machine can describe what the character has been through. This chapter structures the film-set continuity method so that agents and generation stations share the same facts about the same moment.