How to Add Offline Earnings (Idle Game Math)

Intermediate 7 min Economy & Data

Welcome-back payouts computed from elapsed time with caps and anti-abuse.

Skip the typing

Generate the whole system, every file wired up. Free during beta.

Build it for me

How it works, step by step

  1. 1

    On profile load compute elapsed = now - lastSeen (stored server-side).

  2. 2

    Rate = f(upgrades) from a shared module; payout = min(elapsed * rate, CAP_HOURS * rate).

  3. 3

    Show a welcome modal with the breakdown and a Collect button.

  4. 4

    Clamp absurd elapsed values (clock tampering is irrelevant since timestamps are server-side).

  5. 5

    Update lastSeen continuously via the autosave loop, not just on leave.

Concepts you'll use

  • Server timestamps
  • Rate × capped-time math
  • Continuous lastSeen refresh

Mistakes that cost you players

  • Trusting device clocks lets players set dates years ahead.
  • Uncapped rates make AFK-vacation players break your economy.

Every script above — written, placed & wired in ~30 seconds

Build it free 🔥

no card · full access in beta

Keep building

All topics