v0.1 ⌊ALPHA⌉
On this page
  1. How it works
  2. Implementations
  3. History
  4. Variants and combinations
  5. Related
  6. References
  7. Sources

In most incremental games, each purchase multiplies the next price by a fixed factor r: after n purchases the price is b⋅rn. Income grows linearly with the count owned, so purchases speed up, then slow down. r sets when the turn comes and how steep it is. In 2016, Anthony Pecorella of Kongregate called exponential costs against linear or polynomial production the typical idle-game design, a seesaw between production and costs1.

#How it works

Let b be the base price (the first one) and r>1 the growth constant. With n owned, the next one costs

price(n)=b⋅rn

On a log axis, the price is a straight line: b sets its height, and r sets its slope. The price doubles every ln⁡2/ln⁡r purchases: 4.96 at r=1.15, 10.2 at 1.07, and 3.1 at 1.252.

#Buying several at once

Buying k more with a owned sums a geometric series:

cost(a,k)=b⋅ra⋅rk−1r−1

At r=1.15, “buy 10” costs 20.30× the next single price3 whatever the count owned: (r10−1)/(r−1). Inverting it gives the most you can buy with c, ⌊logr⁡(c(r−1)/(b⋅ra)+1)⌋4.

#Why the growth constant sets the pace

Let each one owned earn p per second, as each building type does in Cookie Clicker before upgrades5. With n owned and nothing saved, the next one takes

wait(n)=b⋅rnp⋅nwait(n+1)wait(n)=r⋅nn+1

The ratio is below 1 while n<1/(r−1), then above 1, tending to r6:

  • Waits shrink until about n=1/(r−1): 6.7 at r=1.15, 14.3 at 1.07, and 4 at 1.256.
  • Then each wait is about r times the last, doubling every ln⁡2/ln⁡r purchases like the price6,2.

For Cookie Clicker’s Grandma (base price 100 cookies7, 1 cookie/s8), the wait is 115 s for the 2nd, 38 s at its low for the 8th, and 36 minutes for the 51st9. In Pecorella’s account, multipliers keep production close until the wait “gets prohibitively long”, the point to prestige10.

With linear costs b+s⋅n and income p⋅n, the wait tends to s/p and never runs away.

Interactive: bench (needs JavaScript)

Price of the next one and the wait for it, one item from each game against your own curve (drag its numbers). Hover to read values; open the workbench to compare more.

#Implementations

The web version (2.058) uses one constant for all 20 buildings: each one owned multiplies the next price by 1.1511. The next price is ⌈basePrice⋅1.15owned−free⌉12. Free buildings (Starter kit, Starter kitchen) come off the exponent13. Discounts such as ×0.99 apply before the rounding, lowering the line but not its slope14.

var price=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,this.amount-this.free));
Cookie Clicker main.js v2.058 · main.js L8090–809512

Only the Cursor keeps its written base price of 1515. The rest come from a formula on the building’s index16: 100, 1,100, 12,000, 130,000, and so on7. A sibling formula sets base production8.

The store shows bulk prices (1, 10, or 10017) as the exact geometric sum, rounded up once3. The purchase buys one at a time, each rounded up, ignoring the total. Ten Grandmas from zero show 2,031 but cost 2,035, and one cookie short still buys nine18. Selling pays 25% of the next price, about 15% more than its label19.

#Antimatter Dimensions

In Antimatter Dimensions, each of the eight dimensions keeps one price for 10 purchases, then multiplies it by its tier’s factor20. Factors run from 10³ to 10¹⁵, about ×2.0 per purchase for tier 1 and ×32 for tier 821. Starting prices run from 10 to 10²⁴22.

Once a price passes Number.MAX_VALUE ≈ 1.8 × 10³⁰⁸23, the shared ExponentialCostScaling class grows the ratio between sets by another factor of 1024 each set. With e sets past the threshold, the price is B⋅Cn⋅Se(e+1)/2, quadratic in log space25. For the 1st Dimension, the extra scaling starts after 103 sets, or 1,030 bought23.

The same amount unlocks Infinity, the first prestige reset26. The Break Infinity upgrade “Reduce post-infinity Antimatter Dimension cost multiplier scaling” lowers S to 327. Tickspeed upgrades use the same class at ×10 per purchase28.

“Buy until 10” is exact, because the price is flat within a set29. Max-buy charges only the most expensive set it buys, about 0.1% under the true sum30 at ×1,000 per set. A code comment says it “assumes you only have to pay for the most expensive thing”30. Over a long run, the true sum approaches r/(r−1) times the last price: 1.001 at ×1,000 (Antimatter Dimensions) and 7.7 at ×1.15 (Cookie Clicker)31.

#AdVenture Capitalist

Pecorella gives the Lemonade Stand as 3.738⋅1.07owned32 at 1.67 per second each. At r=1.07, the shortest wait comes with 15 stands owned6. The game’s code isn’t public.

#A Dark Room: linear, with a cap

A Dark Room prices huts at 100+50n wood33 and traps at 10+10n wood34. The build action refuses past the maximum, so the cap, not the price, ends each run35. Housing is 4 villagers per hut36.

#History

Cookie Clicker launched on 8 August 201337. Its earliest capture, five days later, set each new price to ⌈price×1.1⌉38. The rounding compounded, so the 51st Cursor cost 2,283, not 15 × 1.1⁵⁰ ≈ 1,76138. By v1.035, captured 10 September 2013, the rule was base×1.15n through one Game.priceIncrease39.

A Dark Room, announced two months before Cookie Clicker40, used linear prices. Antimatter Dimensions (201641) used steps of 10 and a super-exponential stage.

#Variants and combinations

  • Stepped: Antimatter Dimensions.
  • Super-exponential past a threshold: Antimatter Dimensions’ post-Infinity scaling.
  • Linear with a cap: A Dark Room.
  • Bulk buying: the exact sum (Cookie Clicker’s label) or only the last price (Antimatter Dimensions’ max-buy).
  • Discounts: Cookie Clicker.
  • Prestige: restarts the curve; production multipliers carry across10.

References

  1. ^Pecorella calls idle games a seesaw between production and costs, typically with exponential costs (costbase×(rategrowth)owned) against linear or polynomial production. T2Pecorella 2016
  2. ^ abA price that grows by a factor of r per purchase doubles every ln⁡2/ln⁡r purchases. T4Cookie Clicker main.js v2.058 · main.js L7972Pecorella 2016probe probes/idle-costs/growth-math.mjs
  3. ^ abThe shown bulk price (getSumPrice) is the geometric sum b⋅ra⋅(rk−1)/(r−1), discounted and rounded up once: 20.30× the next single price for 10, and 7.83 million× for 100. T4Cookie Clicker main.js v2.058 · main.js L8096–8105Pecorella 2016 · “BONUS CONTENT!”Cookie Clicker Wiki, “Building” · Building Pricesprobe probes/idle-costs/cookie-clicker.mjs
  4. ^For a plain exponential (base b, rate r, and k owned), Pecorella gives the most you can buy with c currency as ⌊logr⁡(c(r−1)/(b⋅rk)+1)⌋. T2Pecorella 2016 · “BONUS CONTENT!”
  5. ^Each type's production is amount * storedCps, summed into cookies per second, so before upgrades income grows linearly with count. T3Cookie Clicker main.js v2.058 · main.js L5276–5285
  6. ^ abcdWith income linear in the count, waits shrink until n=1/(r−1) owned, then each is about r times the last. T4Cookie Clicker main.js v2.058 · main.js L5276–5285, L7972probe probes/idle-costs/growth-math.mjs
  7. ^ abBase prices (the first one's price) are Cursor 15, Grandma 100, Farm 1,100, Mine 12,000, Factory 130,000, Bank 1.4 million, and so on up to You at 5.4 × 10²⁶. T4Cookie Clicker main.js v2.058 · main.js L8979, L8024–8031Cookie Clicker Wiki, “Building” · buildings table, “Base Cost” columnprobe probes/idle-costs/cookie-clicker.mjs
  8. ^ abBase production before upgrades is 0.1 cookies/s for the Cursor, set in its own production function, and ⌈10⋅nn/2+2⌉/10 to two significant figures for building n: Grandma 1, Farm 8, Mine 47, Factory 260, and so on up to You at 5.1 × 10¹⁴. T4Cookie Clicker main.js v2.058 · main.js L8018–8022, L9104–9109, L9001, L8912–8916probe probes/idle-costs/cookie-clicker.mjs
  9. ^On Grandma income alone, the wait for the next Grandma is 115 s for the 2nd, a low of 38 s for the 8th, and 36 minutes for the 51st. T4Cookie Clicker main.js v2.058 · main.js L8090–8095, L5276–5285probe probes/idle-costs/cookie-clicker.mjs
  10. ^ abIn Pecorella's account, production first outruns costs, multipliers keep it close, and a prohibitive wait for the next generator marks the time to prestige. T2Pecorella 2016
  11. ^One global constant, Game.priceIncrease = 1.15, multiplies a building's price for each one already owned. T4Cookie Clicker main.js v2.058 · main.js L7972Cookie Clicker Wiki, “Building” · Building Pricesprobe probes/idle-costs/cookie-clicker.mjs
  12. ^ abA building's next price is ⌈basePrice×1.15max⁡(0,owned−free)⌉, with discounts applied before rounding. T4Cookie Clicker main.js v2.058 · main.js L8090–8095Cookie Clicker Wiki, “Building” · Building Pricesprobe probes/idle-costs/cookie-clicker.mjs
  13. ^Free buildings (Starter kit: 10 Cursors; Starter kitchen: 5 Grandmas) come off the exponent, so the next one costs the base price. T4Cookie Clicker main.js v2.058 · main.js L8266–8275, L3828–3829probe probes/idle-costs/cookie-clicker.mjs
  14. ^Discounts from upgrades, auras, buffs, and gods multiply the price by constants such as 0.99 or 0.95, lowering the curve without changing its 1.15 slope. T3Cookie Clicker main.js v2.058 · main.js L8792–8814
  15. ^Only the Cursor keeps its Game.Object constructor price; the formula overwrites the rest (the Farm's 500 becomes 1,100). T4Cookie Clicker main.js v2.058 · main.js L8003–8034, L9104probe probes/idle-costs/cookie-clicker.mjs
  16. ^Every building after the Cursor gets its base price from one formula on its index n: (n+9+5max⁡(0,n−5)1.75)×10n×max⁡(1,n−14), rounded to two significant figures. T4Cookie Clicker main.js v2.058 · main.js L8024–8031probe probes/idle-costs/cookie-clicker.mjs
  17. ^Bulk options are 1, 10, and 100; “All” works only in sell mode and means 100 in buy mode. T3Cookie Clicker main.js v2.058 · main.js L8816–8825
  18. ^buy() charges each unit's rounded-up price in turn and ignores the shown total: 10 Grandmas from zero cost 2,035, not 2,031, and 2,030 cookies still buy 9. T4Cookie Clicker main.js v2.058 · main.js L8125–8152, L8898–8901probe probes/idle-costs/cookie-clicker.mjs
  19. ^Each sale pays 25% of the next one's price, rounded down, about 15% more than the label: selling 1 of 10 Grandmas shows 88 and pays 101. T4Cookie Clicker main.js v2.058 · main.js L8156–8176, L8106–8123, L1620–1628probe probes/idle-costs/cookie-clicker.mjs
  20. ^A dimension's price is calculateCost(⌊bought/10⌋+costBumps): flat for each set of 10, then a jump; costBumps moves only in Normal Challenge 9 and Infinity Challenge 5. T4IvarK/AntimatterDimensionsSourceCode · src/core/dimensions/antimatter-dimension.js L359–364, L544–566probe probes/idle-costs/antimatter-dimensions.mjs
  21. ^After every 10 bought, tiers 1–8 multiply their price by 10³, 10⁴, 10⁵, 10⁶, 10⁸, 10¹⁰, 10¹², and 10¹⁵, about 2.0× to 32× per purchase. T4IvarK/AntimatterDimensionsSourceCode · src/core/dimensions/antimatter-dimension.js L339probe probes/idle-costs/antimatter-dimensions.mjs
  22. ^The eight Antimatter Dimensions start at 10, 100, 10⁴, 10⁶, 10⁹, 10¹³, 10¹⁸, and 10²⁴ antimatter. T4IvarK/AntimatterDimensionsSourceCode · src/core/dimensions/antimatter-dimension.js L337probe probes/idle-costs/antimatter-dimensions.mjs
  23. ^ abThe threshold, Number.MAX_VALUE (≈ 1.8 × 10³⁰⁸), becomes ⌈(log⁡threshold−log⁡B)/log⁡C⌉ sets: 103 (1,030 bought) for the 1st Dimension, and 19 for the 8th. T4IvarK/AntimatterDimensionsSourceCode · src/core/dimensions/antimatter-dimension.js L350–357, src/core/math.js L347–349probe probes/idle-costs/antimatter-dimensions.mjs
  24. ^The post-threshold factor S, Player.dimensionMultDecrease, is 10 minus the effects of the Break Infinity upgrade dimCostMult and Eternity Challenge 6's reward. T4IvarK/AntimatterDimensionsSourceCode · src/core/cache.js L65–68, src/core/dimensions/antimatter-dimension.js L354probe probes/idle-costs/antimatter-dimensions.mjs
  25. ^ExponentialCostScaling.calculateCost(n) returns B⋅Cn, times Se(e+1)/2 once n exceeds purchasesBeforeScaling by e, so the ratio between steps grows by S each step. T4IvarK/AntimatterDimensionsSourceCode · src/core/math.js L377–385probe probes/idle-costs/antimatter-dimensions.mjs
  26. ^Outside challenges, a Big Crunch (Infinity, the first prestige reset) unlocks when this Infinity's peak antimatter reaches Decimal.NUMBER_MAX_VALUE, the cost threshold's ≈ 1.8 × 10³⁰⁸. T3IvarK/AntimatterDimensionsSourceCode · src/core/player.js L942–947
  27. ^The dimCostMult upgrade (“Reduce post-infinity Antimatter Dimension cost multiplier scaling”) lowers S by 1 per purchase, at most 7 times, to 3 before Eternity Challenge 6; it costs 107×5,000purchases Infinity Points. T4IvarK/AntimatterDimensionsSourceCode · src/core/secret-formula/infinity/break-infinity-upgrades.js L116–128, L3–9, src/core/break-infinity-upgrades.js L21–36probe probes/idle-costs/antimatter-dimensions.mjs
  28. ^Tickspeed upgrades use the same class per purchase, not per 10: with n bought, the next costs 1,000×10n antimatter up to the Number.MAX_VALUE threshold (306 purchases), and past it their own factor, Player.tickSpeedMultDecrease (10 without upgrades), applies. T4IvarK/AntimatterDimensionsSourceCode · src/core/tickspeed.js L154–161, L150–152, src/core/cache.js L60–63probe probes/idle-costs/antimatter-dimensions.mjs
  29. ^“Buy until 10” charges price × purchases left in the set (costUntil10), exact since the price is flat within a set. T3IvarK/AntimatterDimensionsSourceCode · src/core/dimensions/antimatter-dimension.js L388–390, L227–242
  30. ^ abMax-buy (getMaxBought) counts the whole sets affordable but charges only the most expensive set × 10, about 0.1% under the sum at ×1,000 per set. T4IvarK/AntimatterDimensionsSourceCode · src/core/math.js L387–429, src/core/dimensions/antimatter-dimension.js L320–331probe probes/idle-costs/antimatter-dimensions.mjs
  31. ^A long bulk purchase whose price grows by a factor of r per item costs about r/(r−1) times its last price. T4Cookie Clicker main.js v2.058 · main.js L8096–8105IvarK/AntimatterDimensionsSourceCode · src/core/math.js L387–429probe probes/idle-costs/growth-math.mjs
  32. ^Pecorella, crediting the AdCap wiki, gives AdVenture Capitalist's Lemonade Stand growth 1.07, base cost 4, and 1.67/s each; with the first free, the price is 3.738×1.07owned. T2Pecorella 2016
  33. ^A hut costs 100+50n wood, with n already built, up to 20 huts (11,500 wood for all 20). T4doublespeakgames/adarkroom · script/room.js L43–58probe probes/idle-costs/a-dark-room.mjs
  34. ^A trap costs 10+10n wood, and at most 10 can be built. T4doublespeakgames/adarkroom · script/room.js L13–28probe probes/idle-costs/a-dark-room.mjs
  35. ^The build action does nothing at the item's maximum count, so the cap, not the price, ends each building's run. T3doublespeakgames/adarkroom · script/room.js L1025–1027
  36. ^Each hut adds room for 4 villagers; the maximum population is huts × 4. T3doublespeakgames/adarkroom · script/outside.js L177–179, L11
  37. ^The changelog dates the launch to 8 August 2013; Orteil says he made the original “in a couple hours, for laughs”. T2Cookie Clicker main.js v2.058 · main.js L2020–2021
  38. ^ abcThe original (13 August 2013 capture) set each new price to ⌈price×1.1⌉, compounding the rounding: the 51st Cursor cost 2,283, not the unrounded 1,761. T4Cookie Clicker, 13 Aug 2013 capture · index.html L503–512probe probes/idle-costs/cookie-clicker.mjs
  39. ^By v1.035 (captured 10 September 2013), the price was basePrice×1.15amount via the same Game.priceIncrease, still unrounded. T3Cookie Clicker main.js v1.035 · main.js L1836, L1871–1876
  40. ^doublespeak games announced A Dark Room as “a minimalist text adventure” in a blog post dated 10 June 2013. T2Townsend 2013
  41. ^The About screen says Finnish developer Hevipelle began the game as a solo project in 2016, later expanded by a large team. T2IvarK/AntimatterDimensionsSourceCode · src/components/modals/InformationModal.vue L23–24
  42. ^The changelog's 24 August 2013 “big update!”, which “revamped the whole game (new graphics, new game mechanics)”, falls between the 1.1 and 1.15 captures. T2Cookie Clicker main.js v2.058 · main.js L2014–2015

Sources

Code

Primary

Secondary