The Difference Between a "Toy" and a "Game" is Persistence.

If a player closes your game and loses their progress, they never come back. If a player closes your game and comes back to a popup saying "You earned $1,000,000 while you were sleeping!", they are hooked for life.

Coding a robust Save System that handles localStorage, time-deltas, and offline math is tedious and prone to bugs (like time-zone cheating).

I built the Offline Progress Manager to solve this. It is a drop-in engine that handles the saving, the loading, and the "Welcome Back" math for you.

📦 What is included?

  • The Core Engine (OfflineManager.js): A robust script that manages the save loop and time calculations.
  • The "Welcome Back" Modal: A built-in, dark-mode UI popup that tells the player how long they were gone and what they earned.
  • Secure Saving: Uses Base64 encoding to obfuscate save files, preventing players from easily editing their money values in the browser console.
  • The Demo: A working example showing money generating in real-time and offline.

🔧 How it works: The engine runs silently in the background. You just tell it what to save and how much the player earns per second.

<span class="ng-tns-c1137244013-545">JavaScript</span><b class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1137244013-545 mat-unthemed ng-star-inserted"><span class="mat-mdc-button-persistent-ripple mdc-icon-button__ripple"></span><span class="mat-focus-indicator"></span><span class="mat-mdc-button-touch-target"></span></b>

<b class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1137244013-545 mat-unthemed ng-star-inserted"><br><pre>const manager = new OfflineManager({ gameId: 'my_rpg_save_v1', // Unique ID so saves don't clash ratePerSecond: 100, // Player earns $100/sec // 1. Save Logic (Runs every 30s) onSave: () => { return { gold: playerGold, level: playerLevel }; }, // 2. Load Logic (Runs on startup) onSync: (data) => { playerGold = data.gold; playerLevel = data.level; }, // 3. Offline Logic (Runs if player was away > 1 min) onOfflineReward: (seconds, earnings) => { console.log(`Player was gone for ${seconds} seconds.`); playerGold += earnings; } });</pre><br></b>

<b class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1137244013-545 mat-unthemed ng-star-inserted"></b>

🚀 Features:

  • Auto-Save: Automatically saves to LocalStorage every 30 seconds (configurable).
  • Time-Delta Math: accurately calculates the difference between Date.now() on close and re-open.
  • Smart Formatting: The UI automatically formats time into "Hours/Minutes/Seconds" (e.g., 2h 45m).
  • No Dependencies: Pure JavaScript. Works with any HTML5 game framework.

Perfect for:

  • Idle / Tycoon Games.
  • Farming Sims (Crops grow while offline).
  • RPGs (Regenerate health/energy while away).

Stop writing localStorage.setItem from scratch. Get a professional Save & Offline system running in minutes.

Purchase

Buy Now$4.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $4.99 USD. You will get access to the following files:

Web_Demo_Playable.zip 3.2 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.