Skip to content

Stories, challenges and elements

The flow of a Toto game is defined by two levels of graphs:

  • A story graph connects challenges.
  • A challenge graph connects elements.

Both graphs have the same structure (RepoGraph):

{
"start": ["n1"],
"finishedOn": ["n3"],
"nodes": [
{ "id": "n1", "refId": "<element or challenge id>", "posX": 0, "posY": 0 },
{ "id": "n2", "refId": "<element or challenge id>", "posX": 0, "posY": 120 },
{ "id": "n3", "refId": "<element or challenge id>", "posX": 0, "posY": 240 }
],
"links": [
{ "source": "n1", "target": "n2" },
{ "source": "n2", "target": "n3" }
]
}
Field Meaning
nodes The entities in the graph. id is the id of the node (any unique string, e.g. a UUID), refId the id of the element (challenge graph) or challenge (story graph). posX/posY are only used to draw the graph in the authoring interface.
links Directed edges between node ids: target comes after source.
start Node ids that are released first.
finishedOn Node ids that finish the graph when they are processed.

These rules describe what the game engine does; they are the same for every story.

Start. When a session starts, the start challenges of the story graph begin and the start elements of each of these challenges are released.

Element processed → successors released. When a player processes an element (solves or skips a task, acknowledges an info, makes a choice, processes a dynamic element, collects a coin), all successors of that element in the challenge graph are released – except for choices and dynamic elements, which release only the chosen successor.

  • An element is released at most once per session. If two paths lead to the same element, it is released by whichever path reaches it first (there is no “wait for all parents”).
  • Released elements stay released. Unprocessed elements of a finished challenge are still playable.

Challenge finished. When an element listed in finishedOn of the challenge graph is processed, the challenge is finished and the start elements of all its successors in the story graph are released.

Story finished. The story is completed when an element in finishedOn of a challenge that is itself in finishedOn of the story graph is processed. The session then has to be ended by the player app (POST /v2/session/{id}/end); its status is Finished if the story was completed, otherwise Canceled.

A story is the playable unit. Besides its graph it has:

Field Meaning
content title, description, publicInfo (public landing page, e.g. duration and start point), procedures, files, logo – texts are lists of translations, see Content.
supportedLanguages ISO 639-3 codes the story is available in, e.g. ["eng", "deu"]. Players choose one of them.
associatedElements Element ids of coins that can be collected at any time during the story.
area, areaRestricted The play area (an area) and whether the player app should restrict playing to it.
multiplayer Allows other players to join a session (team play).
trigger Story triggers, see Triggers.

Players start a story with a voucher: a token with optional validity period, maximum number of uses, restriction to certain accounts and initial values for session variables.

A challenge groups the elements of one section. Besides its graph it has content (title, description, publicInfo, postDescription, files, logo), an optional area and triggers (OnChallengeRelease, OnChallengeFinish).

Challenges are reusable: different stories can use the same challenges in a different order, e.g. to send teams on different routes through the same places.

Elements are the units the player sees and interacts with. Their type defines how they are processed:

Type Processed when
Task the player solves it (or skips it, if allowed)
Info the player acknowledges it
Choice the player chooses one of the successors
Dynamic a script chooses one of the successors
Coin the player collects it with its secret (QR code); coins are not part of a challenge graph

See Element types and Solutions.