2 dynamic world state and scene phasing
forgejo-actions edited this page 2026-07-15 12:43:13 +00:00

Dynamic World State and Scene Phasing

What This System Is

Scene phases are data-driven overlays that transform a base scene in response to shared gameplay conditions. They let quests, world events, player choices, and persistent progression alter presentation and traversal without duplicating complete scene files.

How Authors Use It

Phases are authored in assets/gameplay/world_scene_phase_catalog.json. Each phase declares:

  • a stable ID and target scene;
  • a persistence scope (per_player, per_party, per_instance, or global);
  • shared gameplay conditions;
  • a priority and optional conflict group;
  • an ordered set of scene operations.

Supported operations enable, disable, or replace layers and placed entities; change collision and navigation regions; place or remove gameplay assemblies; and replace music, ambience, lighting, or weather profiles.

Rules And Invariants

The resolver evaluates every phase targeting the current scene. Within a conflict group, the eligible phase with the highest priority wins. Unrelated phases compose. When multiple active phases write the same target, the higher-priority operation wins. Equal-priority incompatible writes are rejected as ambiguous.

Resolution produces the complete final patch rather than a series of incremental mutations. A revisioned transition plan identifies activated and deactivated phases and carries the final active phase set and resolved patch. Runtime consumers can therefore apply collision, navigation, entities, assemblies, and environment changes as one atomic state swap.

Editor preview

Open Scene → Detailed Scene Tools → Scene Lighting → Dynamic Scene Phases. Toggle any combination of candidate phases to inspect:

  • conflict-group winners and suppressed phases;
  • the complete resolved patch;
  • the source phase for every final operation;
  • scope, priority, conditions, and phase documentation.

The preview is read-only and never mutates the authored scene.

Validation And Debugging

Server startup treats the phase catalog as required content. Structural validation rejects invalid conditions, duplicate IDs, empty operations, duplicate target writes, and ambiguous conflict priorities. Cross-catalog validation rejects unknown gameplay assemblies.

The authoring dependency graph records phase-to-scene and phase-to-assembly edges so content health and change-impact tools include dynamic world state.

Examples

The starter catalog includes village attack, rebuilt village, festival, and repaired cave bridge phases. Together they demonstrate global and player/party scope, conflict priority, environmental overrides, encounter and NPC visibility, traversal changes, and assembly placement.