Cloud Saves Without Nagging

Saves can now follow the player between phone and browser through a Google sign-in. The interesting part was not the storage but the rules – never lose progress silently, never pester players to log in.

After losing a browser save myself, cloud saves moved to the top of the list. The goal: play on the phone in the morning, continue in the browser at lunch, and never lose a resort to a new phone or a cleared browser.

The building blocks

The game already used Firebase for analytics, so the choice was natural: Google sign-in with Firebase Authentication and the save as one document in Firestore. On Android, the native Google account dialog hands its token to the same JavaScript SDK the browser uses, so both platforms share one code path.

The local save stays the one the game runs on. The cloud is a copy that is uploaded every minute when something changed, when the app goes to the background and after a purchase, and checked at startup and when the app becomes visible again.

Never lose progress silently

Syncing is easy. Syncing without ever destroying progress is the real work. Every upload is a transaction that says which revision it builds on; if the cloud has moved on in the meantime, the upload is refused, and the game decides what to do. The server rules check ownership, structure and that the revision goes up by exactly one.

The decision logic is a pure, tested function with a few outcomes: nothing to do, upload, download, or conflict. A conflict means progress on both sides. The game then shows both saves side by side (regions, phases, play time, last played) and lets the player choose. It never guesses.

One subtle case came up soon after. If you play on the phone, close it, and open the browser half an hour later, the browser's old save has also "changed": it earned offline money while loading. Was that a conflict? No. The game now distinguishes playing (buying, building, hiring) from earning. Only decisions count as progress. A device that merely earned takes the newer cloud save with a short "loaded from cloud" message, and the offline time since that save is credited properly.

Restoring a save also had a funny side effect at first: loading a big save on a new device played every unlock sound at once, because the sound system saw dozens of "new" unlocks. While a save is being replaced, event-driven systems like sounds and analytics now ignore that change.

No login wall

The UI rules were stricter than the technical ones:

The story card (added a week later) comes once the family area is finished and presents the cloud save as a way to keep the resort safe. It has a Google button and "not now". There is no reward for signing in; that would be pushing.

Ads on the web

The same days brought rewarded ads to the browser version through Google's H5 Games Ads: the same behaviour as on Android (the player taps "watch", a video plays, the reward is granted), no banners, no automatic ad placements. On Android, rewarded ads are now preloaded so they start instantly when tapped, and reloaded before they expire. If no ad is available, the player gets one short notice instead of a spinner that never ends.

cloud savefirebasesyncux

Try the game

Ski Resort Empire is free to play in the browser and on Android.