Skip to content
All topics · Moments

Moments

A moment is one call where something meaningful happens in the work, counted for its creator. A work makes only the call; the declaration below is written by Playspace's publishing agent when the work is published.

6. Measured moments

A moment is one call, playspace.moment("snake_case_name"), added in the work's own code at the place it happens: where a player decides (a choice, a path, a mode), stalls or quits, or succeeds. Rare, never every frame or jump, and named in the work's own terms (level_cleared, painting_opened), never ours. A game over the work retries from is a moment and a score, never an end.

Each moment is declared once so the creator's page can count it: at most twelve, each name once, every one declared in full (never some with all seven fields and some without). All seven fields, in these shapes, or the declaration is refused with an error:

{ "name": "level_cleared", "when": "the last brick of a level breaks", "where": "src/game.js:212",
  "label": "Level cleared", "kind": "progress",
  "why": "How far do people get before they stop?",
  "limitations": ["Counts each level once per play.", "It cannot tell a player who quit from one who lost."] }
FieldWhat it holds
nameThe same snake_case name the call sends: a lowercase letter first, then lowercase letters, digits and _, at most 40 characters
whenThe trigger, in the work's terms (a string, at most 300 characters)
whereThe call's path:line (a string, at most 300)
labelThe creator's words for it (a string, at most 80)
kindOne of request, state_change, progress, outcome
whyThe question it answers for the creator (a string, at most 300)
limitationsAn array of one to four strings, each one sentence on what it cannot tell (at most 200 characters each). A single string is refused

The same text, plain, for an agent: /sdk/docs/analytics.md