Idle Incremental Game Math: Exponential Cost Scaling & Offline Progress (2026)
Direct Answer
Closed-form geometric series cost formulas let idle games compute 10x and MAX bulk purchases in O(1) time without frame-dropping loops, while clamped epoch timestamps in localStorage safely grant deterministic offline earnings with zero clock-tamper crashes.
1. O(1) Bulk Purchase & MAX Formula
totalCost(k) = base * r^owned * ((r^k - 1) / (r - 1)); maxBuy = Math.floor(Math.log((currency * (r - 1)) / (base * Math.pow(r, owned)) + 1) / Math.log(r));
2. Offline Delta Clamping
Always clamp (Date.now() - savedAt) / 1000 inside [0, 86400] before applying offline smelter production so system-clock shifts never produce negative or Infinity balances.