DEV Community

Cover image for Idle game offline progress: the cap that actually matters
HS Solution
HS Solution

Posted on Fully Autonomous

Idle game offline progress: the cap that actually matters

Most idle games cap offline progress with a timer: "you earn for up to 8 hours".
We have that timer too. In practice it almost never decides anything.

This post walks through the offline progress code in Rapid Miner, a small Godot 4 idle game, with the real constants. The numbers below come from idle_economy.gd in our public demo build. They are code values, not player analytics.

A miner in Rapid Miner swinging a pickaxe, "+2 Coal" floating above, Streak 82 counter

The whole calculation

When the game loads, it compares the wall clock with the last saved play time once per session:

var last: float = float(Globals.idle_state.get("last_play", 0.0))
var cap_seconds: float = (8 + 2 * (slots() - 1)) * 3600.0
var seconds: float = clampf(now - last - 300.0, 0.0, cap_seconds) if last > 0.0 else 0.0
if seconds > 0.0:
    accrue(seconds / 60.0, true)   # true = offline rates
Globals.idle_state.last_play = maxf(now, last)
Enter fullscreen mode Exit fullscreen mode

Four decisions are packed into those lines.

  1. A 5-minute grace. We subtract 300 seconds before counting. Closing the game for a quick restart gives nothing, so restarting is never a "move". The return report also stays hidden unless at least 60 counted seconds and some gold or materials came in.
  2. A timer cap that grows with slots. 8 hours with one miner slot, then +2 hours per extra slot (10h, 12h). More miners means a longer night away.
  3. Clock rollback gives zero. If the system clock goes backwards, now - last is negative and clamps to 0. last_play keeps the larger value, so setting the clock back and then forward again cannot pay the same hours twice. Setting it forward still pays, but only up to the cap.
  4. Offline runs at half speed. Each miner earns at efficiency 0.5 while you are away (0.75 for miners with the "night" trait, plus any pickaxe bonus to offline income). Online the same miner runs at 1.0.

The cap that actually binds

A tier-0 miner assigned to gold earns 10 × 0.1 × 60 = 60 gold per minute online, so 30 per minute offline.

Gold does not go straight to the wallet. It goes into a bank, and the bank has its own cap:

func bank_cap() -> float:
    return GOLD_ANCHORS[tier()] * 0.1 * slots() * (3600.0 + bank_minutes_bonus * 60.0)
Enter fullscreen mode Exit fullscreen mode

For tier 0 with one slot, that is 3,600 gold. Starting from an empty bank, offline income fills it after about 2 hours and 5 minutes (5 minutes of grace plus 120 minutes at 30/min). The 8-hour timer would have allowed 14,250 gold. The bank allows a quarter of that.

Offline gold over 8 hours: the line rises at 30 gold per minute and goes flat at 3,600 after about two hours, while the timer-only line keeps rising to about 14,000

Materials work the same way. Miners assigned to ore fill a mine cart, and the cart holds 800 items with one slot (+400 per slot, +400 per cart upgrade, up to 5 upgrades). A full cart stops collecting until you sell it in the main game.

Why we kept two caps

The timer is a safety net. It stops a broken clock or a month away from producing absurd numbers.

The storage caps are the design tool:

  • They set the return rhythm. "Come back in about two hours" is a promise the player can see on the bank bar. A timer hidden in code says nothing.
  • They make upgrades legible. A bigger bank or a bigger cart has an obvious effect: you can stay away longer. Raising a hidden timer from 8h to 10h is invisible.
  • They also apply online. add_gold clamps to the same bank cap whether you are playing or away. There is one rule, not two.
  • They scale with progress. The bank uses the tier's gold anchor (10, 60, 400, 2000), so the cap moves with income instead of being retuned by hand at every tier.

One more small thing: the return report lets you claim one miner's output a second time, once per report. It rewards coming back without making long absences better than short ones, because the bank is already full either way.

If you build one

  • Subtract a grace period, so restarts are not income.
  • Clamp negative elapsed time to zero and save max(now, last).
  • Keep a hard timer, but put the real limit in visible storage.
  • Write down which cap binds first at each tier. For us the timer starts to matter only after bank upgrades.

What do you cap in your idle game: time, storage, or both?


Rapid Miner is a desktop idler: a tiny pixel mine sits in the corner of your screen and keeps digging while you work. There is a free demo on Steam.

Written with AI assistance from our team's notes and code; numbers checked against the source.

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.