Skip to content

Create a quest pack ​

You add a quest of your own to the game: who gives it, what it asks, how the game knows it is done, and what the player wins. A quest pack is a folder of JSON files; each file adds quests to a branch the game already has.

Before you begin 15 minutes

  1. Create the pack

    alta new quest-pack writes a folder with one file, quests.json, that already passes alta lint. Each file of the folder says which branch it adds to ("branch": "core" is the main story) and which version of the standard it follows (alta.quests/0.3).

    Terminal
    sh
    alta new quest-pack my-pack
  2. Describe the quest

    A quest has a short id and a uid that starts with its branch (core.tidy-downloads): the uid is unique in the whole game. act is the chapter it belongs to, giver the agent who gives it (daemon, architect, operator, reviewer or guardian). title and summary are what the player reads, in English and French.

    requires lists the quests (or skills) to finish first, and reward.xp is the experience at the end; in a campaign quest each step done gives 10 more points.

    my-pack/tidy.json
    json
    {
      "id": "tidy-downloads",
      "uid": "core.tidy-downloads",
      "act": 2,
      "giver": "guardian",
      "title": { "en": "Tidy the downloads", "fr": "Range les téléchargements" },
      "summary": {
        "en": "Choose a rule for old downloads and let it run each week.",
        "fr": "Choisis une règle pour les vieux téléchargements et laisse-la tourner chaque semaine."
      },
      "requires": ["core.backup"],
      "reward": { "xp": 50, "skills": ["core.tidy"] },
      "support": {
        "platforms": [
          { "os": "macos", "min": "14" },
          { "os": "linux" }
        ],
        "hosted": "limited",
        "notes": {
          "linux": {
            "en": "In a hosted world there is no downloads folder to tidy.",
            "fr": "Dans un monde hébergé, il n'y a pas de dossier de téléchargements à ranger."
          }
        }
      },
      "steps": [
        {
          "id": "rule",
          "kind": "choice",
          "title": {
            "en": "What happens to downloads older than 30 days?",
            "fr": "Que deviennent les téléchargements de plus de 30 jours ?"
          },
          "choices": [
            {
              "id": "archive",
              "label": {
                "en": "Move them to an archive folder",
                "fr": "Les ranger dans un dossier d'archives"
              }
            },
            {
              "id": "ask",
              "label": {
                "en": "Ask me each week",
                "fr": "Me demander chaque semaine"
              }
            }
          ],
          "saves": "answers.tidy.rule"
        },
        {
          "id": "archive-folder",
          "kind": "check",
          "title": {
            "en": "The archive folder exists",
            "fr": "Le dossier d'archives existe"
          },
          "when": { "answer": "answers.tidy.rule", "equals": "archive" },
          "check": { "type": "file", "path": "~/Downloads/Archive" }
        },
        {
          "id": "read-more",
          "kind": "link",
          "title": {
            "en": "Read how the rule works",
            "fr": "Lis comment marche la règle"
          },
          "open": {
            "macos": "https://docs.example.org/tidy/macos",
            "linux": "https://docs.example.org/tidy/linux"
          },
          "optional": true
        },
        {
          "id": "weekly",
          "kind": "action",
          "title": {
            "en": "Turn on the weekly tidy",
            "fr": "Active le rangement hebdomadaire"
          },
          "run": {
            "macos": {
              "do": "automation.enable",
              "args": { "key": "tidy-downloads" }
            },
            "linux": {
              "do": "automation.enable",
              "args": { "key": "tidy-downloads" }
            }
          },
          "check": {
            "type": "automation",
            "key": "tidy-downloads",
            "enabled": true
          }
        }
      ]
    }

    examples/quest-pack/core.fragment.json#/quests/0

  3. Give it steps

    A quest is a list of steps, each of one kind. Prefer the ones the machine proves: a step is done when its check passes, not when the player clicks.

    kindThe player seesDone when
    checka checkits check passes
    choicea choice (choices, saves)the answer is saved
    actiona button and a plan card (run)its check passes
    commanda command to copy (cmd)its check passes, or the player says so
    linkan https:// link (open)the player says so
    missionan agent to send (mission)the agent comes back
    manual"I did it"the player says so; human says why

    when shows a step only after a given answer.

    my-pack/tidy.json
    json
    {
      "id": "archive-folder",
      "kind": "check",
      "title": {
        "en": "The archive folder exists",
        "fr": "Le dossier d'archives existe"
      },
      "when": { "answer": "answers.tidy.rule", "equals": "archive" },
      "check": { "type": "file", "path": "~/Downloads/Archive" }
    }

    examples/quest-pack/core.fragment.json#/quests/0/steps/1

  4. Teach a skill

    A file can add skills to its branch: what the player gains. Name them in reward.skills of the quest that teaches them; agent is the agent the skill belongs to.

    my-pack/tidy.json
    json
    [
      {
        "id": "core.tidy",
        "title": { "en": "Tidy machine", "fr": "Machine rangée" },
        "agent": "guardian"
      }
    ]

    examples/quest-pack/core.fragment.json#/skills

  5. Check the pack

    Save the quest as my-pack/tidy.json, next to quests.json, and check the folder: every file is checked. A refused file prints the rule, where it is, and how to fix it, with a link to Errors.

    Terminal
    sh
    alta lint my-pack
    Output
    text
    ok   my-pack/quests.json (quests)
    ok   my-pack/tidy.json (quests)
    2 checked, 0 errors, 0 warnings

Try it

alta dev my-pack

Open the address it prints and press L: your quests are in the journal, with the others of their branch; the game runs in a demo, so nothing touches your machine.

Demo: nothing is written on your machine.

Pitfalls ​

DoAvoid
A uid that starts with the branch, unique in the gameTwo files with the same uid
A check on every step the machine can seeA quest that ends on clicks alone
title and summary in English and FrenchA text in one language only
Copy requires, giver and reward.skills from a quest that worksA typo in them

Known limits: alta lint does not yet verify that requires, act, giver and reward.skills name things that exist. A misspelled requires locks the quest forever without an error, so read those fields twice. A pack adds to a branch that exists; a branch of your own reaches players through a chart.

Go further ​

What's next

Alta OS is open source (MIT).