Docs ▸ Steam
Saves
Inside Gameshipper builds your game gets window.gameshipper.saves, which writes one JSON file per slot, a format Steam Auto-Cloud can sync. In a normal browser it's undefined, so use this helper to work in both:
const saves = window.gameshipper?.saves ?? {
save: async (slot, data) => localStorage.setItem(slot, JSON.stringify(data)),
load: async (slot) => JSON.parse(localStorage.getItem(slot) ?? 'null'),
list: async () => Object.keys(localStorage),
delete: async (slot) => localStorage.removeItem(slot),
};
await saves.save('slot1', { level: 3 });
const progress = await saves.load('slot1'); // null when there's no saveSlot names are 1 to 64 letters, numbers, - or _, and the data must be JSON-serializable. Saves live in the game's folder in the OS app data folder (~/Library/Application Support/<Name>/saves on a Mac, %APPDATA%\<Name>\saves on Windows, ~/.config/<Name>/saves on Linux).
In iOS and Android builds window.gameshipper.saves works the same way, on every page of the game: saves are stored with Capacitor Preferences (UserDefaults / SharedPreferences), which the OS never clears and device backups include. On phones window.steam is undefined and gameshipper.plugins is empty.