2 scenario sandbox and timeline inspector
forgejo-actions edited this page 2026-07-13 19:45:35 +00:00

Scenario Sandbox And Timeline Inspector

What This System Is

The Scenario Sandbox executes a quest, world event, or named encounter through the canonical shared state machines without starting a game server. It complements the content dependency graph: graph validation proves that authored references connect, while the sandbox proves that the connected content advances, completes, and produces the expected facts at runtime.

Scenario fixtures are versioned JSON assets. They contain a root content id, deterministic initial facts and clock, automation policy, and post-run assertions. The same fixture can run from the editor or as a focused regression test.

How Authors Use It

  1. Open Simulation & Debug in the viewport.
  2. Enter a quest, world-event, or encounter id in Content chain root. Leave it empty to use the default authored world event.
  3. Select Run Scenario Sandbox.
  4. Use Step Timeline, Fast-forward, or the timeline slider to inspect actions and state diffs.
  5. Select Reset Sandbox to return the inspector to the seeded entry.
  6. Select Copy Fixture JSON to copy the generated versioned fixture for review, or Save Fixture to persist it under assets/gameplay/scenario_fixtures.
  7. Select Run All Scenarios to execute every registered regression fixture.

The result banner and Event Console report dependency failures, runtime errors, and failed assertions together.

Rules And Invariants

Sandbox execution is deterministic, bounded by fixture policy, and should not mutate editor or gameplay state. It validates orchestration, facts, assertions, and state machines, not rendering, navigation, audio playback, or live service behavior.

Runtime Semantics

The executor uses the shared QuestStateMachineState, WorldEventDirectorState, and EncounterDirectorState reducers. It does not maintain editor-only lifecycle rules.

When enabled by the fixture automation policy, the executor:

  • satisfies positive root availability and objective conditions;
  • acknowledges dialogue actions and emits their authored acknowledgement events;
  • materializes every named encounter wave with deterministic actor ids;
  • gates automated completion through registered deterministic combat-balance fixtures when simulate_combat is enabled;
  • records defeat-all completion through the encounter director;
  • applies canonical world-event effects and quest reward effects;
  • advances the deterministic clock to authored minimum phase and wave delays;
  • stops at a bounded timeline step limit if content cannot converge.

Music and NPC presentation actions are recorded in the timeline but do not start presentation systems. The sandbox validates gameplay state orchestration, not rendering, audio playback, navigation, or combat balance.

Timeline And State Diffs

Every action records its deterministic timestamp, action kind, summary, and stable before/after changes. Diff paths cover:

  • gameplay facts, inventory, reputation, unlocks, and runtime events;
  • quest lifecycle and active step;
  • world-event status and phase;
  • encounter status, wave index, and wave status.

Assertions appear after the runtime timeline and include their final-state evidence.

Fixture Contract

The current fixture schema version is 1. A fixture includes:

  • id, label, and root_id;
  • seed facts, scope id, and clock;
  • automation controls and a hard step limit;
  • typed assertions for quest state, event completion, encounter completion, facts, timeline content, and runtime errors.

The shipped Slime Infestation fixture is located at assets/gameplay/scenario_fixtures/slime_infestation.json and validates the warning dialogue, both multi-wave encounters, final effects, and event completion.

Examples

The Slime Infestation fixture validates the warning dialogue, both multi-wave encounters, final effects, and event completion. If the timeline reaches a waiting phase forever, inspect missing acknowledgement events or unsatisfied completion facts.

Validation And Debugging

Run the focused suite with:

cargo test -p aether scenario_sandbox --lib

Registered fixtures are also available through Run All Scenarios. New persistent fixtures must be added to the fixture registry and must pass dependency preflight before their runtime result is considered successful.