Lesson 54 of 170

Keep faction consequences thin and explicit

Martinez AI Studios Academy

Define a deterministic consequence contract for one choice by separating state-derived responses from transition-triggered responses and assigning each effect to a named system.

785. Lesson identity

Module
2.9 — Faction systems
Lesson
Keep faction consequences thin and explicit
Academic type
Systems
Schema type
Text
Order
Lesson 2 in the module
Estimated time
30–40 minutes, including practice

786. Learning objective

After this lesson, you can create a deterministic faction-impact map for one choice or mission. The map will name the approved input, relationship mutation, complete threshold partition, response mode, allowed consumers, explicit non-effects, and owner of every response.

787. Why this matters

Reputation becomes difficult to reason about when every action silently changes quests, prices, dialogue, combat, access, and progression. A thin consequence system limits each choice to effects with a defined owner and a visible reason.

Determinism also depends on when a response occurs. A system that continuously reflects the current relationship classification behaves differently from one that reacts once when a threshold is crossed. If a contract does not distinguish those modes, loading a saved state, moving downward across a boundary, or receiving the same event twice can produce inconsistent results.

788. Prior knowledge

You should already have completed A faction owns relationships, not the whole world. You should be able to distinguish faction relationship state from the systems that consume it and describe a choice as an explicit event rather than a vague intention.

789. Core concept

A consequence contract is a bounded agreement between a producer of a faction-related event, the faction relationship system, and the systems permitted to respond.

A complete contract answers these questions:

  1. What happened? Name one approved event and its eligibility rule.
  2. Which relationship changes? Identify the faction and relationship value.
  3. How is the value calculated? State the initial value, exact delta, resulting value, valid domain, and clamping rule.
  4. How is the value classified? Provide a complete, ordered, non-overlapping band map.
  5. What response mode applies? Declare each response as state-derived or transition-triggered.
  6. Who owns the response? Assign every response to one named receiving system.
  7. What does not happen? Record explicit non-effects for unrelated systems.

The faction relationship system is the sole mutation authority. Producers submit approved events; they do not write reputation directly. Consumers may read a classification or receive a declared transition, but they may not mutate the relationship or invent uncontracted effects.

790. Numeric and boundary convention

For this lesson, reputation is a bounded integer in [-100, 100].

For an eligible event:

postValue = clamp(preValue + delta, -100, 100)

All band boundaries are inclusive and must partition every integer in the domain exactly once. For example:

Band Integer interval
Distrusted [-100, 29]
Neutral [30, 49]
Trusted [50, 100]

An event with preValue = 95 and delta = +10 produces postValue = 100, not 105. Classification occurs after clamping.

791. Two response modes

Every response in an impact map must declare one of these modes.

State-derived response

A state-derived response must agree with the current classification whenever the consuming system evaluates or reconciles state.

Example: vendor access is available while the relationship is Trusted. It becomes unavailable if the relationship later falls below Trusted. Loading a saved Trusted state also restores the access because the response is derived from current state.

Current classification = Trusted
→ Vendor access system exposes the Trusted category

Transition-triggered response

A transition-triggered response occurs once when an accepted mutation crosses a declared boundary in a declared direction.

Example: show a one-time notification when the value moves upward from below 50 to 50 or above.

Upward crossing of 50: preValue < 50 and postValue >= 50
Downward crossing of 50: preValue >= 50 and postValue < 50

A transition contract must state whether it responds to the upward crossing, downward crossing, or both. Remaining in the same band is not a crossing. Restoring a saved value classifies and reconciles state-derived responses but does not replay transition-triggered responses unless a separate restoration policy explicitly requires replay.

Do not describe one response as both continuously available in a band and issued only on a crossing. If both behaviors are needed, define two responses with separate owners or separate responsibilities—for example, persistent vendor access and a one-time notification.

792. Mental model

Use the bounded consequence chain:

Eligible approved event
    ↓
Faction-owned, clamped mutation
    ↓
Complete relationship classification
    ↓
Declared response mode
    ↓
Named response owner
    ↓
Bounded player-visible consequence

The input boundary prevents unauthorized mutation. The output boundary prevents unrelated systems from treating reputation as a global broadcast signal.

793. Concrete example

Suppose an eligible mission outcome returns cargo to the Dock Union.

Contract field Decision
Approved event CargoReturnedToDockUnion
Eligibility Accepted once for the mission outcome ID
Relationship Dock Union reputation
Domain Bounded integer [-100, 100]
Pre-state 45, Neutral
Delta +10
Post-state 55, Trusted
Complete bands Distrusted [-100,29]; Neutral [30,49]; Trusted [50,100]

The responses are deliberately separate:

Owner Response Mode Activation rule
Vendor access system Expose one additional category State-derived Available whenever current classification is Trusted
Notification system Show “Trusted status reached” once Transition-triggered Accepted mutation crosses upward from below 50 to 50 or above

Explicit non-effects:

  • the dialogue system does not add a branch automatically;
  • the combat system does not change hostility automatically;
  • the economy system does not change prices automatically; and
  • none of these consumers may mutate Dock Union reputation.

Deterministic examples

Case Pre-state Input Post-state Classification Allowed responses
Upward crossing 45 Neutral Eligible +10 55 Trusted Vendor category available; upward notification fires once
Downward crossing 55 Trusted Eligible -10 45 Neutral Vendor category unavailable; no upward notification
Unchanged band 35 Neutral Eligible +10 45 Neutral No Trusted access and no crossing notification
State restoration Saved value 55 Restore, not a mutation event 55 Trusted Vendor category reconciled as available; notification not replayed
Duplicate event 45 Neutral after original event ID was recorded Same event ID received again 45 Neutral Event is ineligible; no delta and no response

The duplicate example assumes the original event ID was already consumed before the shown pre-state was restored or reconstructed. The eligibility ledger, not the consumer, prevents a second mutation.

794. AI-native workflow

Use AI as a specification checker, not as the owner of design scope.

  1. Write the event, eligibility rule, domain, clamping rule, full band map, delta, response modes, and owners yourself.
  2. Ask AI to detect gaps, overlapping bands, ambiguous boundary directions, duplicate ownership, and uncontracted effects.
  3. Require it to test upward crossing, downward crossing, unchanged-band, restoration, and duplicate-event cases.
  4. Reject suggestions that add consequences merely because they appear plausible.
  5. Preserve the accepted contract as the source of truth during implementation or review.

A useful prompt is: “Audit this faction-impact map for incomplete state data, band gaps or overlaps, ambiguous response modes, unauthorized mutators, duplicate owners, and effects outside the contract. Test upward crossing, downward crossing, unchanged-band, restoration, and duplicate delivery. Do not propose new features.”

795. Common mistakes

  • Treating reputation as a signal every system may interpret independently.
  • Calling persistent access a threshold-crossing effect without explaining restoration or downward movement.
  • Declaring a threshold without its numeric type, inclusive boundaries, or clamping rule.
  • Listing only the relevant band instead of the complete partition.
  • Letting a consumer mutate reputation in response to its own output.
  • Assuming duplicate events, save restoration, or boundary direction will be handled implicitly.

796. Guided practice

Create a faction-impact map for one fictional mission outcome. It may mutate one faction relationship and define no more than two player-visible responses.

Complete the contract table:

Field Your decision
Approved event and event ID
Event eligibility or idempotency rule
Faction relationship affected
Sole mutation authority
Numeric type and valid domain
Clamping rule
Complete ordered threshold-band map
Initial value and classification
Exact delta
Resulting value and classification
Response owner 1
Player-visible response 1
Response mode 1 State-derived or transition-triggered
Activation or reconciliation rule 1
Response owner 2, if used
Player-visible response 2, if used
Response mode 2 State-derived or transition-triggered
Activation or reconciliation rule 2
Allowed read-only consumers
Prohibited mutators
Explicit non-effects

Then provide five test cases. Each case must record event eligibility, pre-state, input or restoration action, post-state, classification, response mode, and allowed responses:

  1. an eligible upward crossing of one selected boundary;
  2. an eligible downward crossing of that same boundary;
  3. a change that remains within one band;
  4. restoration directly into a saved classification; and
  5. duplicate delivery of the same event ID.

Testing the selected boundary in both directions is required. Do not substitute a crossing of either the lower or upper boundary without direction.

797. Validation / evidence

Your evidence is the completed impact map and all five test cases. It passes when:

  • one approved event is the only mutation input;
  • event eligibility and duplicate handling are explicit;
  • initial value, exact delta, clamped resulting value, and classifications are shown;
  • the complete band map covers every integer in [-100, 100] exactly once;
  • upward and downward crossing conditions are unambiguous;
  • every response declares a state-derived or transition-triggered mode;
  • restoration reconciles state-derived responses without accidentally replaying transitions;
  • the faction system remains the sole mutation authority;
  • each consequence has one named owner and all consumers are read-only;
  • all five cases produce deterministic results; and
  • at least one explicit non-effect prevents accidental global coupling.

798. Key takeaways

  • A consequence contract bounds both mutation inputs and permitted outputs.
  • State-derived responses reflect the current classification; transition-triggered responses occur on declared directional crossings.
  • Numeric domains, clamping, and complete band partitions make boundary behavior testable.
  • Named owners and explicit non-effects prevent hidden global coupling.
  • Restoration, downward movement, unchanged bands, and duplicate events must be specified rather than assumed.

799. Next lesson

Next: 2.10 — Living world. Carry forward the same discipline into changing world behavior: identify the state owner, authorized mutations, invariants, response modes, and systems permitted to consume the result.

800. Knowledge check

Answer these items for yourself before reading the answers.

What is the main purpose of a consequence contract?

  • A. To let every system interpret reputation independently
  • B. To define approved mutations, classifications, response modes, and response ownership
  • C. To replace all numeric relationship values with labels
  • D. To make every mission outcome affect every faction
Show answer and feedback

Answer: To define approved mutations, classifications, response modes, and response ownership

Why: A consequence contract bounds the accepted mutation and specifies how named systems may respond. It prevents reputation from becoming an uncontrolled global signal.

Reputation is an integer in [-100,100] with bands Distrusted [-100,29], Neutral [30,49], and Trusted [50,100]. An eligible event changes the value from 45 by +10. Which proposed contract is deterministic and properly bounded?

  • A. The vendor system derives Trusted access from post-state 55; the notification system fires once on the upward crossing of 50; dialogue and economy have no automatic response.
  • B. Every system may read raw reputation and choose a plausible effect after the event.
  • C. Vendor access is available only at the instant 50 is crossed, but it is also assumed to be available after restoring any Trusted save.
  • D. The mission mutates reputation to 55, and the vendor system may then increase it again to confirm access.
Show answer and feedback

Answer: The vendor system derives Trusted access from post-state 55; the notification system fires once on the upward crossing of 50; dialogue and economy have no automatic response.

Why: The accepted event produces post-state 55 and the Trusted classification. Persistent access is state-derived, while the one-time notification has a separate upward-transition rule and owner. Unrelated systems remain outside the contract.

A saved game restores reputation directly to 55, which is Trusted. The contract defines vendor access as state-derived and a “Trusted reached” notice as transition-triggered on an accepted upward crossing. What should happen?

  • A. Restore vendor access and replay the notice every time the save loads
  • B. Restore vendor access from the classification but do not replay the transition notice
  • C. Replay the notice but leave vendor access unavailable
  • D. Ignore the restored value until another mission changes it
Show answer and feedback

Answer: Restore vendor access from the classification but do not replay the transition notice

Why: Restoration reconciles responses derived from current state. It does not constitute an accepted upward mutation, so the transition-triggered notice is not replayed.

What should a contract specify if the same faction event may be delivered twice?

  • A. That consumers decide independently whether to apply it
  • B. That the delta repeats until the maximum value is reached
  • C. An explicit eligibility or idempotency rule tied to event identity
  • D. That duplicate delivery is outside the scope of deterministic behavior
Show answer and feedback

Answer: An explicit eligibility or idempotency rule tied to event identity

Why: An eligibility or idempotency rule determines whether a repeated event may mutate the relationship. Consumers should not make that decision independently.

Support