The three rules
- Every click gives visible progress. The number the player watches must move on every interaction — integer increments, not accumulated floats.
- Upgrades come one decision at a time. Two or three buttons, visible and affordable-or-almost-affordable. Ten choices at once is a UI problem, not a game.
- Costs curve up exponentially; income curves up linearly per purchase. Each upgrade costs ~×2.2 the last but improves output by a flat amount. The player is always saving for the next one, and the next one is always worth it.
A working clicker
Three upgrades, a cost curve, and integers everywhere. Paste into index.html in Studio and Run:
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Sparks</title>
<style>body{margin:0;font-family:system-ui;background:#1a2129;color:#e9edf5;
display:grid;place-items:center;min-height:100vh;text-align:center}
button{font:inherit;cursor:pointer;border:0;border-radius:12px}
#core{width:190px;height:190px;border-radius:50%;font-size:1.1rem;font-weight:700;
background:radial-gradient(circle at 32% 30%, #ff9a4d, #ff5c35 60%, #c53f1d);
box-shadow:0 10px 34px rgba(255,92,53,.35);color:#fff}
.shop{margin-top:20px;display:grid;gap:10px}
.buy{background:#252b34;color:#e9edf5;padding:11px 16px;font-weight:600;width:300px}
.buy small{display:block;font-weight:400;color:#a2a8b6;margin-top:2px}
.buy:disabled{opacity:.45;cursor:default}</style></head>
<body><div>
<p id="n" style="font-size:3rem;margin:0">0</p>
<p id="rate" style="color:#a2a8b6;margin-top:0"></p>
<button id="core">tap</button>
<div class="shop">
<button class="buy" id="u1"></button>
<button class="buy" id="u2"></button>
<button class="buy" id="u3"></button>
</div></div>
<script>
var s = { n: 0, perClick: 1, perSec: 0, clickLvl: 0, autoLvl: 0, x2Lvl: 0 };
// cost = base × 2.1^level, income from a purchase is flat (+ per level)
var ups = {
u1: { name: 'Steady hand', base: 15, lvl: 'clickLvl', give: function () { s.perClick += 1; } },
u2: { name: 'Automator', base: 60, lvl: 'autoLvl', give: function () { s.perSec += 1; } },
u3: { name: 'Big sparks', base: 250, lvl: 'x2Lvl', give: function () { s.perClick *= 2; } }
};
var fmt = function (v) { return Math.floor(v).toLocaleString(); };
function cost(u) { return Math.floor(u.base * Math.pow(2.1, s[u.lvl])); }
function render() {
n.textContent = fmt(s.n);
rate.textContent = '+' + fmt(s.perClick) + '/click · +' + fmt(s.perSec) + '/sec';
for (var k in ups) {
var u = ups[k], c = cost(u);
document.getElementById(k).innerHTML = u.name + ' lv' + s[u.lvl] +
'<small>cost ' + fmt(c) + '</small>';
document.getElementById(k).disabled = s.n < c;
}
}
core.onclick = function () { s.n += s.perClick; render(); };
for (var k2 in ups) (function (k) {
document.getElementById(k).onclick = function () {
var u = ups[k], c = cost(u);
if (s.n < c) return;
s.n -= c; s[u.lvl]++; u.give(); render();
};
})(k2);
setInterval(function () { // income tick — 0.1 × 10 keeps n integer
if (s.perSec) { s.n += s.perSec / 10; n.textContent = fmt(s.n); }
for (var k in ups) document.getElementById(k).disabled = s.n < cost(ups[k]);
}, 100);
render();
</script></body></html>
Why the curve is ×2.1 and not ×2
With ×2 growth, every upgrade feels mandatory — the player can predict everything and the spreadsheet stops being exciting. With ×2.2–×2.4, upgrades start feeling expensive, and the right answer sometimes is "keep clicking instead" — a real decision. Tune 2.1 by feel: too harsh and progress stalls, too soft and prestige disappears.
Integers everywhere
Floating point is fine internally, but the displayed number must be an integer who grows in visible jumps — that's why the auto-tick adds perSec / 10 ten times a second while the display shows Math.floor. If the number ticks 1 → 1 → 1 → 2 forever it feels dead; if it pumps in visible steps it feels alive.
What hook actually is
Real clickers drop the "wait several minutes for the next upgrade" window down to seconds when starting, then stretch it. Player psychology and mod hacks aside, the balance come mostly from budgeting:
- Fresh player: next upgrade within 20–40 clicks.
- Mid-game: 1–2 minutes per purchase, arriving steadily.
- Wall: when the pace stretches, add a new income multiplier type (combo clicks, offline income, prestige loops) rather than inflating costs.
When the loop holds, wire it to CudicSave so a player's sparks survive a page reload, then Publish — and drop the link in a Help post if balancing fights back.
Got a final score? One line makes it a leaderboard: after each run call <script src="/cudic-scores.js"></script> + CudicScores.submit(score). The server keeps every signed-in player's best (a replay never lowers it), and the game page shows the top 10 — docs.
Need a soundtrack? Make the beat in the Music Lab, then in Studio open the Music tab and pick any track (yours or other people's). Drop <script src="/cudic-music.js"></script> in your game and CudicMusic.play('<trackId>') — it loops until you call CudicMusic.stop().