# Onboarding

> Le standard de l'onboarding : le guide qu'un nouveau joueur suit sur les premières quêtes ; chaque champ, chaque règle, chaque version.

Le fichier d'onboarding est le guide qu'un nouveau joueur suit : une liste de temps, chacun quelques répliques du narrateur, une quête que le guide accompagne, ou une visite de la carte. Un univers livre son propre guide, avec ses mots ; une variante du guide change le ton pour les gens à qui elle s'adresse.

| | |
|---|---|
| **Standard** | `alta.onboarding/0.2` |
| **Fichier** | `onboarding.json` (dans un dossier d'univers), ou `onboarding.<variante>.json` |
| **Le créer** | `alta new onboarding my-guide` |
| **Le vérifier** | `alta lint my-guide` |
| **Schéma JSON** | [alta.onboarding.schema.json](https://github.com/altasystem-ai/alta/blob/main/docs/standards/schemas/alta.onboarding.schema.json) |

## Exemple minimal

Le plus petit guide qui passe `alta lint` : un temps, une réplique.

```json [onboarding.json]
{
  "schema": "alta.onboarding/0.2",
  "narrator": "daemon",
  "beats": [
    {
      "id": "hello",
      "kind": "say",
      "say": {
        "en": "Welcome. This world is your machine.",
        "fr": "Bienvenue. Ce monde, c'est ta machine."
      }
    }
  ]
}
```

## Champs

*Référence en anglais : les descriptions des champs sont celles du schéma JSON, que ton éditeur affiche aussi.*

### Guide

Le fichier lui-même.

| Field | Type | Required | Description |
|---|---|---|---|
| `schema` | enum | yes | The standard: `alta.onboarding/0.2` (0.1 is still read). |
| `narrator` | string | no | Who speaks, by agent role. |
| `beats` | beat[] | yes | The beats, in order, at least one. |
| `cutscenes` | map of object | no | Short scenes the guide plays, by id. |
| `cutscenes.<id>.title` | text | yes | The scene's title. |
| `cutscenes.<id>.recap` | text[] | yes | The scene in a few lines, shown when it is skipped. |
| `cutscenes.<id>.video` | string | no | A video to play: a path served by the game (`/…`) or an `https://` address. |

### Temps

`kind` dit ce qu'est le temps : `say` parle, `quest` accompagne une quête étape par étape (`steps` dit ce que le narrateur dit à chacune), `tour` fait visiter la carte (`stops`).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The beat's id, unique in the file; the player's place in the guide is saved under it. |
| `kind` | enum | yes | `say` (lines), `quest` (the guide follows a quest) or `tour` (it walks the map). |
| `say` | text | text[] | no | What the narrator says: one text, or several in turn. |
| `quest` | string | no | The quest the beat follows, by uid. Required on a `quest` beat. |
| `auto` | enum | no | A proof the game gives by itself: `app-open` (the app is open) or `hosted` (the world runs hosted). |
| `steps` | map of object | no | What the guide says and does on each step of its quest, by step id. |
| `steps.<id>.say` | text | no | What the narrator says on this step. |
| `steps.<id>.sayDone` | text | no | What the narrator says once it is done. |
| `steps.<id>.input` | object | no | A field the guide shows on this step; the answer is kept. |
| `steps.<id>.input.saves` | string | yes | Where the answer is kept. |
| `steps.<id>.input.placeholder` | text | no | The grey text in the empty field. |
| `steps.<id>.input.ask` | text | no | The question above the field. |
| `steps.<id>.setup` | string | no | The id of a setup plan the step shows. |
| `steps.<id>.cutscene` | string | no | A scene to play on this step, by id (from the cinematics). |
| `stops` | object[] | no | The stops of a `tour` beat, at least one. |
| `stops.walk` | string | yes | Where the avatar walks, by entity id. |
| `stops.say` | text | no | What the narrator says there. |
| `stops.tick` | string | no | A step of the beat's quest this stop completes, by step id. |
| `done` | text | no | What the narrator says when the beat is over. |
| `track` | string | no | The quest the journal tracks after this beat, by uid. |
| `wait` | enum | no | `done`: wait for the quest to be done; `started`: go on once it is started. |

## Règles et erreurs

Chaque règle que `alta lint` applique à un guide, avec sa section sur la [page des erreurs](https://docs.altasystem.ai/fr/reference/errors#standard-onboarding).

## Exemple complet

<details class="alta-full-example">
<summary>Le guide d'un univers : des répliques, une quête suivie pas à pas, une visite et une scène</summary>

```json [onboarding.json]
{
  "schema": "alta.onboarding/0.2",
  "narrator": "daemon",
  "beats": [
    {
      "id": "hello",
      "kind": "say",
      "say": [
        {
          "en": "Hush. You found the hollow.",
          "fr": "Chut. Tu as trouvé le creux."
        },
        {
          "en": "Every thread here is woven on your own machine.",
          "fr": "Chaque fil ici est tissé sur ta propre machine."
        },
        {
          "en": "Let's count the threads you already brought.",
          "fr": "Comptons les fils que tu as déjà apportés."
        }
      ]
    },
    {
      "id": "get",
      "kind": "quest",
      "quest": "core.get",
      "auto": "app-open",
      "say": {
        "en": "You carried Alta home.",
        "fr": "Tu as porté Alta jusque chez toi."
      }
    },
    {
      "id": "install",
      "kind": "quest",
      "quest": "core.install",
      "auto": "app-open",
      "say": {
        "en": "You gave it a corner of the hollow.",
        "fr": "Tu lui as donné un coin du creux."
      }
    },
    {
      "id": "launch",
      "kind": "quest",
      "quest": "core.launch",
      "auto": "app-open",
      "say": {
        "en": "And you lit the lantern.",
        "fr": "Et tu as allumé la lanterne."
      }
    },
    {
      "id": "wake",
      "kind": "quest",
      "quest": "core.wake",
      "say": {
        "en": "Now wake the Old Moth. It needs a name and a mind.",
        "fr": "Maintenant, réveille la Vieille Phalène. Il lui faut un nom et un esprit."
      },
      "steps": {
        "film": {
          "say": {
            "en": "First, the tale of the hollow.",
            "fr": "D'abord, le récit du creux."
          },
          "cutscene": "trailer"
        },
        "name": {
          "say": {
            "en": "What will you call me?",
            "fr": "Comment vas-tu m'appeler ?"
          },
          "sayDone": {
            "en": "{name}. I'll keep it.",
            "fr": "{name}. Je le garde."
          },
          "input": {
            "saves": "answers.wake.name",
            "placeholder": {
              "en": "A name",
              "fr": "Un prénom"
            }
          }
        },
        "mind": {
          "say": {
            "en": "Choose how I think.",
            "fr": "Choisis comment je pense."
          }
        },
        "signin-claude": {
          "say": {
            "en": "Open the gate to that mind.",
            "fr": "Ouvre le portail de cet esprit."
          }
        },
        "signin-codex": {
          "say": {
            "en": "Open the gate to that mind.",
            "fr": "Ouvre le portail de cet esprit."
          }
        }
      },
      "done": {
        "en": "I'm awake. Thank you.",
        "fr": "Je suis réveillée. Merci."
      }
    },
    {
      "id": "team",
      "kind": "tour",
      "quest": "core.team",
      "stops": [
        {
          "walk": "agent:architect",
          "say": {
            "en": "The Pattern Fox draws what you need.",
            "fr": "Le Renard des Motifs dessine ce qu'il te faut."
          },
          "tick": "architect-builds-what"
        },
        {
          "walk": "agent:operator",
          "say": {
            "en": "The Shuttle Wren keeps the day turning.",
            "fr": "Le Troglodyte Navette fait tourner la journée."
          },
          "tick": "operator-runs-your"
        },
        {
          "walk": "agent:reviewer",
          "say": {
            "en": "The Knot Owl tests every knot.",
            "fr": "La Chouette des Nœuds éprouve chaque nœud."
          },
          "tick": "reviewer-checks-every"
        },
        {
          "walk": "agent:guardian",
          "say": {
            "en": "The Badger Warden keeps the chests.",
            "fr": "Le Blaireau Gardien veille sur les coffres."
          },
          "tick": "guardian-secrets-and"
        }
      ],
      "done": {
        "en": "That's your circle of weavers.",
        "fr": "Voilà ton cercle de tisserands."
      }
    },
    {
      "id": "next",
      "kind": "say",
      "say": {
        "en": "Next, teach me your voice.",
        "fr": "Ensuite, apprends-moi ta voix."
      },
      "track": "core.voice"
    }
  ]
}
```

</details>

## Versions

| Version | Ce qu'elle ajoute | Lue par le jeu |
|---|---|---|
| `alta.onboarding/0.2` | Sur une étape : `setup` et `cutscene` ; sur un temps : `auto` (une preuve que le jeu donne seul) et `wait` | actuelle |
| `alta.onboarding/0.1` | Temps, répliques, quêtes et visites | oui, telle quelle |

Un champ 0.2 dans un fichier qui dit 0.1 est refusé ([`onboarding.v2-field`](https://docs.altasystem.ai/reference/errors#onboarding-v2-field)).

## Guides qui l'utilisent

- [Créer une variante d'onboarding](https://docs.altasystem.ai/fr/guides/onboarding/variant)
- [Créer un univers](https://docs.altasystem.ai/fr/guides/universes/create)
