# Account cloud saves · 1.0.0

For published experiences using the arcade SDK. The parent page handles player sign-in;
your experience receives only its own save data. Guest and standalone play still need a local save.
No account token, private key, inventory receipt or other experience's progress is exposed.

Use the player's existing arcade.fun account. Do not require a separate game signup, password,
Google flow or wallet connection inside the experience. The platform's account control handles
Google, linked wallets and cloud progress together. A save response requiring sign-in is not
permission to collect credentials; keep the local copy and direct the player to the platform UI.
Server-owned multiplayer saves need an operator-reviewed, game-scoped launch integration like
Realm Reborn's one-use entry. A client-supplied player ID or connected wallet is not authentication.

```js
import {cloudStore} from './plugins/cloud-saves.js';
const cloud = cloudStore('main', () => ({version:1, coins:0}));
const loaded = await cloud.load(); // before starting simulation
if (loaded.ok) resume(loaded.data);
else resumeLocal();

saveLocal(state); // keep this even when the network fails
const saved = await cloud.save(state);
if (!saved.ok && saved.conflict) {
  // Pause at a safe boundary, export both copies, ask which one to continue.
  // Merge/migrate only fields your simulation understands.
  const chosen = await chooseSave(state, saved.value);
  cloud.useRevision(saved.revision);
  await cloud.save(chosen);
}
```

`arcade.saves.load(slot)` returns `{ok, value, revision, updated}`. A new slot has
`value:null, revision:0`. `arcade.saves.save(slot,value,revision)` requires that revision;
a stale write returns `{ok:false, conflict:true, value, revision, reason}` and changes nothing.
`arcade.saves.backups(slot)` returns up to five previous revisions, subject to the account's
backup space. Restore by explicitly saving a selected backup against the **current** revision.

Use a stable slot per save lineage and include your own schema version. Experience versions
share a namespace; different experiences and Studio drafts do not. Draft previews and standalone
builds cannot use the published parent bridge. Copying this module does not create a server,
merge two accounts or sync an old local-save module automatically.

Limits: valid JSON, 1 MB per slot, 100 slots and 5 MB current saves per player across experiences;
10 MB total historical backups. Keep writes occasional (e.g. every 15 seconds and at milestones),
retry transient failures with backoff, and show local/pending/conflict status. A parent request
times out after 15 seconds. Never replace a running simulation from a background response.

All saves are player-controlled cosmetic/game state. They cannot prove a paid entitlement,
leaderboard result, prize eligibility, token balance or financial transaction.
