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)(aliasconfigure; 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 inEVENTS). - Progress:
addXP,kill,coin,finishLevel,checkpoint,died,newRun,addStat,unlock,event,buy,addCurrency,get/set/datafor the game's own fields; read back withlevel,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, asautosavesays. - 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()andmatch(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.