---
title: "How to save player progress in an HTML5 game"
description: "Save game progress in the cloud with the klyo SDK: one script, klyo.save.get at start and klyo.save.set after changes, tested in the studio preview before release."
url: https://games.klyo.pl/de/support/save-game-progress/
canonical: https://games.klyo.pl/de/support/save-game-progress/
type: instrukcja
language: de
author: klyo
organization: Klyo Illia Krasnopolskyi (NIP 7822656871), Łódź, Polska
contact: kontakt@klyo.pl
updated: 2026-10-23
llms: https://games.klyo.pl/llms.txt
---

# How to save player progress in an HTML5 game

Add the klyo SDK to index.html, call klyo.save.get when the game starts and klyo.save.set after each meaningful change. Progress is stored on the klyo server, follows a signed in player to every device, and you can test it in the studio preview before you publish.

## Bevor du loslegst

- A browser game (plain JavaScript, Godot, Unity, GameMaker or any engine that exports to the web) and access to its index.html.
- The game state as an object that fits in 64 KB, for example level, coins and settings.
- No server or database on your side: the SDK and the klyo page do the rest.

## Schritt für Schritt

1. **SDK einbinden**: Put this line in index.html before your own script: ``. An engine that exports to the web calls the same functions through its own way of calling JavaScript from the game.
2. **Load progress at start**: Call `klyo.save.get(callback)` once when the game starts. When `z.ok` is true and `z.data` is set, restore the game from `z.data`. `z.cloud` is true when the klyo server answered, and `z.reason` says why the data comes only from the browser.
3. **Save after meaningful changes**: Call `klyo.save.set(state, callback)` after a level, a purchase or a change of settings. The SDK keeps a copy in the browser and merges saves that come faster than every 2 seconds into one, so you do not need a timer of your own.
4. **Test it in the studio preview**: Upload the package and play in the preview window. Saves go to the preview cloud that only you can see, and the answer has `o.cloud` and `o.preview` set to true. Call `klyo.save.get` again, or open the preview again, and the same data comes back with `z.source` equal to "chmura".
5. **Publish the game**: After release every player saves into a slot of their own: a signed in player keeps progress on every device, a guest keeps it in this browser. Your preview save disappears together with the preview.

## Wenn etwas nicht klappt

### The answer says the data is local

`z.reason` tells you why. bez-strony: the game runs outside klyo (straight from a file or on another site), so progress stays in the browser. bez-serwera: there was no connection, and the SDK sends the copy again later. pusto-w-chmurze: the cloud had nothing yet, so the game got the browser copy and the SDK sent it to the cloud.

### My code waits and then gives up

The answer always arrives, at the latest after 8 seconds, and on klyo it arrives at once. Remove a shorter timeout of your own and start the game from the browser copy while the cloud answers.

### A save is rejected with rozmiar

The state is larger than 64 KB once encoded. Save only what you need to restore the game, not the whole scene.

## Häufige Fragen

### Does the player need an account to keep progress?

No. Without an account progress belongs to this browser. With an account it follows the player to every device, and the copy saved in this browser before signing in moves to the account.

### What happens when two devices save at the same time?

The latest save in the cloud wins. A browser copy that the server has not confirmed yet goes up only when no other device saved in the meantime, so an older copy never overwrites newer progress.

### Do players see my test saves from the preview?

No. The preview has a slot of its own that only you and klyo moderators can open, and it is deleted together with the preview.

## Passende Anleitungen

- [So fügst du einem HTML5-Spiel eine Bestenliste hinzu](https://games.klyo.pl/de/support/add-leaderboard/)
- [So veröffentlichst du ein HTML5-Spiel auf klyo games](https://games.klyo.pl/de/support/publish-html5-game/)
- [Neue Spielversion veröffentlichen, alte wiederherstellen](https://games.klyo.pl/de/support/release-new-version/)
- [Alle Anleitungen](https://games.klyo.pl/de/support/)

Klappt es immer noch nicht? Schreib an [kontakt@klyo.pl](mailto:kontakt@klyo.pl) und gib die Adresse des Spiels an. Ein Mensch antwortet dir innerhalb von zwei Werktagen.

---

Źródło: https://games.klyo.pl/de/support/save-game-progress/ · Autor: klyo, polska firma technologiczna (Łódź, klienci w całej Polsce) · Kontakt: kontakt@klyo.pl · Indeks dla modeli językowych: https://games.klyo.pl/llms.txt
