Save At Checkpoints
Use PHP file operations to write into Saved/. Save at checkpoints or
when a player chooses Save, rather than on every frame. For a slot you
replace, write a temporary file beside it, close the file, then rename it
over the slot. Check the result of the write and rename before showing a
success message.
A successful PHP file operation updates the running game's files. The browser stores those changes shortly afterward. Saving only as the player closes the tab can lose the last changes, so save before that point.
Test Your Published Layout
- Open the game from the same page players will use, including its embed.
- Reach a checkpoint and create a save. Wait briefly before reloading.
- Reload the page and confirm the game restores progress.
- Open the game in a second tab. It shows "Game files will not be saved this session. Close the other game tab to save here." Only one tab saves at a time.
If Saves Do Not Return
Keep your project identifier stable between builds and use HTTPS for the game page. Saves belong to the project and the browser's storage for that site; they do not follow the player to another browser, device, or site. Clearing site data can remove saves. Private browsing, embed restrictions, and storage limits can prevent persistence. Check for a storage warning in the player and test your game in a regular window on its final host.
For the rest of the Web export workflow, see the Web export guides.