Cookie Clicker

Cookie Clicker

228 ratings
Chips Per Second
3
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
151.589 KB
12 Jun, 2022 @ 7:47am
23 Sep, 2024 @ 9:57am
8 Change Notes ( view )

Subscribe to download
Chips Per Second

In 1 collection by Quazillionaire
Quazillionaire's QoL Qollection
5 items
Description
Adds a display of how many heavenly chips you are gaining per second. The number is formatted according to the user's "Short Numbers" setting.

This mod does not disable Steam achievements.



Feedback, suggestions, and bug reports are all much appreciated.

Check out my other mods here.
Popular Discussions View All (1)
1
2
5 May, 2024 @ 11:13am
Revised Version of Chips Per Second (1.4)
z
42 Comments
Quazillionaire  [author] 20 Sep, 2024 @ 2:14pm 
hey @z , I assure you the issue is not whether or not your code is good or functional, I'm sure it is. I've just been busy, I moved a couple months ago, my job changed, and my spare time for personal projects has been minimal. I still have the discussion post you made bookmarked, and I'll set aside some time this weekend to integrate your work into the mod. Thanks again for the helpful contribution.
z  [author] 19 Sep, 2024 @ 8:29pm 
@Quazillionaire, it's now been five months since I made my posts and released my corrected version of Chips per Second. I have run it for hundreds of hours in all sorts of situations, and I have never seen even the tiniest bug. I have Cookie Monster installed, and the number reported by my version of the mod always exactly matches that reported in the last line of the popup produced by Cookie Monster when hovering the cursor over the Legacy button. The algorithm I use for determining this number is also much simpler (and more reliable) than the original algorithm, as it simply reports the difference between the current prestige level and the prestige level from one second previously.
z  [author] 19 Sep, 2024 @ 8:29pm 
[continued]
As a professional software engineer with decades of experience, I can assure you that this mod now works as well as possible given the intrinsic limitations of JavaScript floating point and the algorithm that Orteil uses to calculate new prestige. The perfect match of this mod's output with that of Cookie Monster, which was derived independently, is strong evidence of this. Do you want to update your mod with my revised version, which I've linked to in the post below? Otherwise, I'd like to simply publish a fork of your mod containing my changes. Please let me know what you'd like to do.
z  [author] 28 Apr, 2024 @ 10:06am 
I have now finished my work on the mod, thoroughly tested it, documented it, and made it available. You can find the full documentation for my changes in the Discussion Revised Version of Chips Per Second (1.4). For future reference, this Discussion can also be reached via the Discussions tab at the top of this page.

If you haven't read the following three posts of mine, you can skip them, as they are included in the new Discussions thread.
z  [author] 27 Apr, 2024 @ 8:56am 
After still more research, I have finally pinned down the problem definitively, and I have designed and mostly implemented a fix for it. I expect to have the whole thing finished within a few days.

It turns out that this was not a precision problem after all. In fact, the zero result for chips per second is completely correct! The fact that the mod would flash out of existence whenever the CPS was zero through me off a bit, but it was easy to see why it was doing that, and I fixed it.

The reason that zero is the proper result in many cases has to do with the ubiquitous presence of exponential growth throughout Cookie Clicker, combined with the fact that the rate of exponential growth varies greatly depending on what quantities are being examined.
z  [author] 27 Apr, 2024 @ 8:56am 
[continued]
if you look at the Wiki section Calculating Heavenly Chips, [cookieclicker.fandom.com] you see at the line that starts "Heavenly Chips = " that to find out how many heavenly chips you get from a certain number of cookies, you divide the number of cookies by a trillion and then take the cube root of that result. (This is explained slightly differently earlier on the Wiki page.) The cube root function is the killer here, especially as the number of cookies always includes all the cookies you have ever baked, even across ascensions.
z  [author] 27 Apr, 2024 @ 8:55am 
[continued]
What is happening here is that as the total number of heavenly chips rises, a given amount of cookies will produce fewer heavenly chips. This is easily noticeable. At some point, the number of CPS falls below one, and so it is reported as zero. If you have Cookie Monster installed, you can verify this by looking at the bottom of the tooltip that appears when you hover the cursor over the Legacy info.

The mod was also calculating the number of cookies somewhat incorrectly, and I have fixed this.

Once my work on the mod is finished and ready for release, I'll post a brief notice here and point to a thread in the Discussions area, where I will explain the details.
Quazillionaire  [author] 22 Apr, 2024 @ 12:07pm 
@z Good catch, and I appreciate you sleuthing that out. I unfortunately don't have a lot of time at the moment to spend fixing it, but if it tickles your fancy you'd be welcome to make a pull request (https://github.com/quazillionaire/cookie-clicker-mods) . Otherwise, I will make a note and dig into it eventually. Thanks!
z  [author] 22 Apr, 2024 @ 10:13am 
A little more research has shown that the most likely problem is that this mod is falling victim to the limitations of JavaScript floating number precision. This would explain why this problem appears later in the game, as cookie numbers get much bigger and the difference between various numbers in the game increases.

JavaScript numbers start to break when their absolute value exceeds about 9 quadrillion. Not only are numbers of this size not uncommon in Cookie Clicker, but this seems to roughly correspond to the range where this mod stops working. Further research is necessary, and I will see what I can find. If this is indeed the problem, there are workarounds.

Edit: Sure enough, that's the problem. One number adds a number that is 15 orders of magnitude smaller than it, and then subtracts the first number from the second. The result is (incorrectly) computed to be zero, and so nothing is displayed.
z  [author] 17 Apr, 2024 @ 1:59am 
I noticed that this mod works in the early stages of the game, but then the box and its contents start flickering on and off sometime when the number of chips is in the millions, and shortly after that, the box and its contents disappear for good.

I've taken a brief look at the code, and I found that when the box does not appear, the crucial routine chipsPerSec() always returns zero. This is clearly incorrect. I've recently learned a bit about how prestige works, so I'll take a look soon and see if I can find a quick fix. (From a quick look, the current code for chipsPerSec() does not look correct.) I'll try to get back with a fix soon.