1 gameplay conditions effects and events
forgejo-actions edited this page 2026-07-06 16:45:10 +00:00

Gameplay Conditions, Effects, And Events

What This Reference Covers

Gameplay conditions, effects, and runtime event ids are the shared vocabulary used by quests, dialogue, NPC state, NPC services, scene triggers, preview tools, bake validation, and server authority. The shared semantic kernel lives in crates/world-domain/src/gameplay_semantics.rs; the app adapter in src/gameplay_semantics.rs maps authored surfaces onto that kernel; src/runtime_events.rs turns authored string event ids into typed runtime contracts.

Use this page when a content change needs multiple systems to agree on the same gate, reward, unlock, or event id.

Shared Condition Grammar

Shared authored condition tokens use compact strings:

  • quest_flag:<flag_id>
  • inventory:<item_id>>=<count>, inventory_item:<item_id>>=<count>, or inventory_count:<item_id>>=<count>
  • party_tag:<tag>
  • faction_rep:<faction_id>>=<value> or faction_reputation:<faction_id>>=<value>
  • scene_var:<key>=<value> or scene_variable:<key>=<value>
  • unlock_seen:<unlock_id> or unlock:<unlock_id>
  • runtime_event_seen:<event_id>, runtime_event:<event_id>, or event_seen:<event_id>
  • all(...), any(...), and not(...) for grouping; grouped children may be separated by commas or semicolons.

These map to the shared condition kinds: quest flag, inventory count, party tag, faction reputation, scene variable, unlock seen, runtime event seen, all, any, and not.

Some authoring surfaces also accept runtime-local condition tokens. Scene triggers support the broadest set, including time, weather, dwell, actor/context/scene tags, synchronized interaction, and presets. Dialogue branches, NPC state variants, quest objectives, and NPC service gates should prefer shared conditions when preview and authoritative behavior must match.

Effect Families

Shared gameplay effects mutate the same state model that shared conditions read. Canonical effect families are:

  • Set scene variable.
  • Add or remove quest flag.
  • Add or remove party tag.
  • Apply inventory delta.
  • Apply faction reputation delta.
  • Mark unlock seen.
  • Mark runtime event seen.

Dialogue choices, quest rewards, NPC services, and trigger actions adapt their authored reward/effect payloads into these shared operations when possible. Legacy trigger reward tokens such as grant_item: and consume_item: lower into inventory deltas; currency-style legacy tokens are decoded for authoring compatibility but are not the core shared condition-state contract.

Effect application is deterministic: inventory counts saturate at zero and zero entries are removed; faction reputation deltas use saturating arithmetic and remove zero entries. Author content should not depend on negative inventory counts or transient zero-valued records.

Runtime Event IDs

Runtime event ids are string-authored but typed at validation time. Reserved typed prefixes must parse as their owning contract:

  • Dialogue and subtitles: dialogue:, subtitle:, dialogue_ref:, subtitle_ref:, queued/sequence/branch dialogue reference prefixes, dialogue_npc:, dialogue.stop, subtitle.stop, dialogue_state_profile:, and dialogue_state_reset:.
  • NPC service: npc_service:<npc_id>|<service_id>.
  • Scene trigger and quest hooks: trigger:<trigger_id> and quest_hook:<quest_id>|<hook_id>|<phase>.
  • Sound: sound.<playback>.<category>.<cue>.
  • Cutscene: cutscene:<cutscene_id>|....
  • Scripted namespaces: event., quest., combat., system., or a raw id for legacy/scripted integrations.

Malformed ids using reserved typed prefixes are errors, not scripted fallbacks. Empty ids are errors. Placeholder ids such as event.placeholder and cutscene.start are blocked before export/playtest. Unregistered scripted events warn unless they intentionally use the development escape hatch dev.* or dev:.

Validation Ownership

The shared kernel owns the meaning of shared condition and effect families. The app adapter owns which authored surfaces are allowed to use which tokens, and whether a token is represented by the shared kernel or by a scene-runtime fallback. Runtime event validation owns event-id syntax, typed target parsing, dialogue/NPC-service/cutscene resolution when catalogs are supplied, and placeholder blocking.

Scene trigger action validation prepares trigger actions into runtime command contracts before validating event ids. Scene document validation supplies the available dialogue, NPC service, cutscene, and scripted runtime event catalogs so diagnostics can point at missing targets rather than only malformed strings.

Preview Vs Authoritative Behavior

Preview can evaluate shared conditions and apply shared effect projections from local condition state. That makes it reliable for quest flags, inventory counts, party tags, faction reputation, scene variables, unlocks, and runtime-event-seen gates.

Authority-only commands still need authoritative runtime testing. Transitions, NPC dialogue starts, service application, encounter spawns, and durable server-owned rewards may be preview-visible, but the server decides final acceptance and persistence. When preview and online behavior disagree, first check whether the authored gate/effect is shared-kernel or runtime-local, then check whether the command family is preview, shared, or authority-owned.

Examples

Use all(quest_flag:quests.guide.completed; inventory:items.mill_token>=1) when a gate should require both a quest completion flag and an item count. Use event_seen:quest.guide_shortcut.complete when content should wait for a known runtime event to be recorded.

For an NPC dialogue trigger, prefer a typed event/action such as dialogue_npc:guide|interact over a raw scripted event. Validation can then prove that the dialogue route and NPC topic exist.