Incremental, idle and clicker games. The click → generators → upgrades → prestige loop, exponential cost curves vs growing income, buy x1 / x10 / max, multipliers and milestones, offline progress from timestamps, big-number formatting and when to use a big-number library, prestige resets with permanent bonuses, pacing goals so something unlocks every few minutes, battery-friendly rendering, sav...
Download skill (.zip) Files on GitHubIdle game development
Core: numbers go up, decisions make them go up faster, and resets make them go up faster still.
Starter template
A playable starter for the game-scaffolding template is in assets/starter/. Clicking, five generators with exponential costs, buy x1/x10/max, milestone doubling, prestige, offline progress from a saved timestamp, big-number formatting, autosave, and a goal.
python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter
Controls: Tap everything. Keys: Space clicks, 1-5 buy, B buy mode, R prestige. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js.
Buying, max-buy math, prestige, offline earnings and number formatting were tested.
Loop
Click for currency → buy generators (income/s) → buy upgrades (multipliers) → hit a wall → prestige (reset for a permanent multiplier) → faster second run → new layer.
Growing the starter (tested modules)
import { Wallet, cost, maxAffordable, totalCost } from "./core/economy.js";
const GEN = [
{ id: "lemonade", base: 4, growth: 1.07, income: 1.67 },
{ id: "newspaper", base: 60, growth: 1.15, income: 20 },
{ id: "carwash", base: 720, growth: 1.14, income: 90 },
];
const owned = { lemonade: 1, newspaper: 0, carwash: 0 };
const price = (g) => cost.exponential(g.base, g.growth)(owned[g.id]);
const incomePerSec = () => GEN.reduce((s, g) => s + owned[g.id] * g.income * mult(g), 0);
// tick: wallet.earn("cash", incomePerSec() * dt) buy max: maxAffordable(cost.exponential(g.base, g.growth), owned[g.id], wallet.get("cash"))
- Milestones: at 25 / 50 / 100 owned, ×2 that generator (big satisfying jumps).
- Offline progress: save
lastSeen; on load,earned = incomePerSec() × min(elapsed, 8 h) × offlineRate (0.5), shown in a “While you were away” popup. Never simulate while hidden (game-battery-optimization). - Prestige:
prestigePoints = floor(sqrt(lifetimeEarnings / 1e6)), each +2% income forever. Offer it when the next point takes ~longer than the run so far.
Numbers
Format with suffixes: 1.23K, 45.6M, 7.89B, … then scientific (1.23e18). JavaScript numbers are exact to ~9e15 and work up to
1e308: fine for most idle games. Beyond that, use break_infinity.js / break_eternity.js.
const fmt = (n) => n < 1000 ? n.toFixed(n < 10 ? 1 : 0) : n < 1e15 ? (n / 10 ** (3 * Math.floor(Math.log10(n) / 3))).toFixed(2) + ["", "K", "M", "B", "T", "Qa"][Math.floor(Math.log10(n) / 3)] : n.toExponential(2);
Pacing
Something new unlocks every 30 s at first, every few minutes later. Simulate a run with game-economy simulateEconomy and look at
“idle minutes” (nothing affordable). Always show the next goal and how long until you can afford it.
UX
Big satisfying click target with particles and number popups, buy buttons that show cost and the income gain, dimmed with time-to-afford when too expensive, x1 / x10 / max toggle. Render on demand / 30 fps (game-battery-optimization). Save every 10–30 s and on hide; export/import save text for safety.
Pitfalls
Walls with nothing to do, income formulas that overflow into Infinity, offline gains that break balance, and saves lost on
updates (game-save-migration).