Log inGet started
World

Save Point: Profiles, Levels and Unlocks Kit

README.md

save

The one interface game code uses. Every player gets their own profile (level, XP, unlocks, stats, meta currency and the game's own fields) that is still there when they leave and come back. Each machine works on its own player's profile only, in that player's own data store, and the game's calls are the same in every saving style.

  • Setup: setup(opts) (alias configure; mode, curve, curveTable, maxLevel, version, migrations, defaults, unlocks, xp, autosave, bankRate, namespace, screens, hud, kits, bridges, theme), config, on(event, fn) / off(handle) (event names in EVENTS).
  • Progress: addXP, kill, coin, finishLevel, checkpoint, died, newRun, addStat, unlock, event, buy, addCurrency, get / set / data for the game's own fields; read back with level, xp, xpToNext, totalXP, progress, currency, stat, stats, isUnlocked, unlocks, lastCheckpoint, view, profile.
  • Saving: save(reason), flush, reset, status / isReady, lastSaved, isDirty, migration, saveKey. Autosave runs on level up, unlock, checkpoint, finished level and on a timer, as autosave says.
  • Slots (slots style): slots, activeSlot, newGame(i), load(i), copy(from, to), delete(i).
  • Other players: isMine(player), grant(player, xp) for code that runs on every machine (takes effect only on that player's machine), players, cardOf(player).
  • Screens: setScreens, screens, setTheme, theme, showPanel / showUnlocks / showProfile / showSlots, hidePanel, panel, toast.
  • Catalogue: catalogue() and match(want) list and rank the styles, curves and screens.

Calls whose names start with _ are for the SaveHost component and tests. The first call in play spawns the host by itself, so a game never places it.