Cookie Clicker Source

Posted on  by
Aug 30th, 2013
Never

Then, open your browser’s source inspector. Cookie Clicker 2 v1. Almost all require a bit of interaction with technical stuff. By Shaun Prescott. Cookie Clicker 2 it's a fun idle clicker game! Like all the Cookie Clicker games you have to click as fast as possible the cookie to produce more cookies.

The version of the tool seems to be 3.0 while the source and releasenotes are 1.0.0.2. I'll appreciate if you could update the source. Thank you in advance. Van Kooten posted a comment on discussion General Discussion. The version of the tool seems to be 3.0 while the source and releasenotes are 1.0.0.2. Alternatives to Cookie Clicker for Android, iPhone, Android Tablet, Web, iPad and more. Filter by license to discover only free or Open Source alternatives. This list contains a total of 25 apps similar to Cookie Clicker. List updated: 7/10/2020 6:55:00 PM.

Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
  1. If you go to Import Save, and paste the text in below, I've given you a pretty big head start:
  2. MS4wM3x8MTM3NzYzMDYwOTUzNnwxMTExMXw3NDgyOTcxOTA1OzQwODgyMDE5NzIxMTsxNzY0ODswOzEyMDYzODg1MTsyNDswOzA7MHwxNDgsODg4LDE4NzEyMDg5ODExOzEyMSwyNzUsMTc2NTYxODU7MTAxLDE2OCw0NjAwNDg3ODs4NSwxNDIsMjAxNjkwNjYzOzc3LDExOCw2NDY2NDYzMDg7NjYsMTAxLDE1MDQwNDY5NTc7NTcsODksNDUwMTE0ODE5NDs0OSw3MSw1Mzk0NzgxMjMxOTszNCw0MCwxMTc4MjYwOTQzOTQ7fDEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMDsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwwOzEsMDswLDA7MSwxOzEsMTsxLDE7MSwxOzEsMTsxLDE7MSwxOzAsMDswLDA7MCwwOzEsMTsxLDA7MSwwO3wxOzE7MTsxOzE7MTsxOzE7MTsxOzE7MTsxOzA7MDswOzE7MTsxOzE7MTsxOzE7MTswOzA7MDswOzA7MTsxOzE7MTsxOzE7MTsxOzE7MDswOzE7MTsxOzE7MTsxOzE7MTswOzE7MTswOzE7MTswOzE7MTswOzE7MDswOzE7MDswOzE7MDsxOzA7MDswOzA7MTsxOzE7MTswOzA7%21END%21
Please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!
< Cookie Clicker

This is a sub-page of Cookie Clicker.

This game has a quite a bit of interesting unused code. The source code for the game can be found here.

Note: all commented code will be marked in green to help distinguish what is used from what is not used.

  • 4Unused Stats
  • 8Dungeon Access
  • 9Ascension
  • 11Code Comments
    • 11.7News Ticker
  • 12CSS

Unfinished Mod Hooks

The game's source code contains an unfinished section intended to help people with creating plugins. This code is technically used, though the code does nothing if the game does not have plugins added.

Unused Challenge Mode

Cookie Clicker Source
This is what the mode would look like in the menu. This was made using browser console hacks and photo editing.

As of the legacy update, whenever the player ascends, they are presented with the option to enable challenge mode. Currently, the only available modes are challenge mode 0: 'None', which makes the game function normally, or challenge mode 1: 'Born again', which makes the game function like a hard reset, without actually being a hard reset.

Interestingly, the code for challenge modes contains code for challenge mode 3: 'Trigger finger', which is currently commented out. If the code for the other modes is removed, it looks like this:

This is what the text and icon would look like:

Trigger finger

Besides the code that sets the icon image and description, this mode is not programmed to do anything. By using browser console commands, it is possible to re-insert this mode. However, selecting the mode will cause the game to behave like 'None', besides the appearance of the mode in the stats tab. This effect will go away if the window is refreshed.

The heavenly upgrade the description refers to does not appear to exist in any fashion, though it may be related to one of these unused icons.

Wobbly Tooltip

Game.tooltip.wobble is a function meant to make an object's tooltip 'bounce-in' on appearance, rather than just becoming visible.

This function is always called by the tooltip handler, though it does not actually do anything. The if statement's parameter is always set to false, meaning the condition it checks for is never true. As a result of this, the code inside the statement is never executed, even when the function is called.

Unused Stats

The game has a few unused stats.

Background Type

Game.backgroundType is a stat intended to keep track of what background the player is using, but backgrounds have not been implemented yet. The game does not use this stat for any features in the game.

The stat is set to a default value of -1, though it changes to 0 almost immediately after. This is due to a line of code in the function for loading saves. If the game is being played in a version after the prototype, the game sets this stat (and a few others) to 0. This was likely done to prevent the game from loading invalid data.

Heavenly Cookies

Game.heavenlyCookies is a stat that was used to keep track of how many cookies have been baked from heavenly chips. In older versions of the game, the ascension screen would present the option to 'bake heavenly cookies'. The cookies would increase the player's prestige CpS by 1% (which was actually 10% due to a bug) for every 10 chips spent. This option was removed in later versions of the game, as it now increases the player's prestige CpS based on their prestige level.

The stat is set to a default value of 0, which gets reset back to 0again if the player performs a hard reset.

Missed Golden Cookies

Game.missedGoldenClicks is a stat that increments by 1 whenever the player fails to click on a golden/wrath cookie in time. This stat does work as intended, but the code for displaying it was commented out.

//' <span>(<b>Missed golden cookies :</b> '+Beautify(Game.missedGoldenClicks)+')</span></div>'+

According to the changelog, this was done because players reported it was 'messing with their OCD'.

If the game is modded to use this code, it would appear under the 'General' section, and would look something akin to this:

'(Game.missedGoldenClicks)' represents the variable number of missed golden cookies.

Autosave Button

Every 60 in-game seconds, the game checks to see if it should write a save or not. One of the things it checks is Game.prefs.autosave, which is always set to 1, so this check always passes. The stat cannot be changed through normal means.

Interestingly, the game contains commented code for an autosave button, located in the code for the options menu. This was likely removed because there would be very little reason to disable autosaving.

//'<div>'+Game.WriteButton('autosave','autosaveButton','Autosave ON','Autosave OFF')+'</div>'+

If the game is modded to use this code, it would appear below the 'Defocus' option, and would not have a description. The button would actually work as intended, by setting the autosave stat to 0.

Golden Cookie Buff

buff is an object is used to determine the properties of a golden cookie buff.

Interestingly, this object contains its own properties, which are normally unused. When the game's code sets a new golden cookie buff, it overwrites the properties in the object, replacing them with properties that are unique to the specific buff type.

If the game sets a new golden cookie buff that does not contain unique properties, it will use the properties in the unmodified buff object. All the golden cookie buffs in the game have their own properties, so this code is never executed. This suggests that the default buff code is intended to act as a fail-safe, in case something goes wrong with the game.

If the game is modded to create a new buff without custom properties, it would display as this in the tooltip:

This effect would last for zero seconds (causing the buff to end immediately after it starts).

Unused Upgrade Pool

.pool is an object property string that can contain any string data, though the game will only read it correctly if the string matches one of seven upgrade types. One of the upgrade pools is known as 'unused' (the literal name of the pool string). Upgrades with this pool will not show up in the stats menu if purchased, and will not count towards the player's total amount of upgrades. This was likely meant to be used for upgrades that were not fully programmed.

Ironically, none of the upgrades in the current version of the game use this pool. As such, the pool itself goes unused.

Dungeon Access

To do:
Describe the other 'special'-related code for context.

The game used to have a dungeon mode, which was removed in recent versions of the game, though the code for gaining access to these dungeons still exists. Interestingly, rather than commenting (or outright removing) the code, the developer used other methods of disabling access.

setSpecial

.setSpecial is an object method that was meant to be used for setting an object's 'special' function, which was only ever used for factory dungeons.

For some reason, the developer chose to disable this code by placing a return expression at the beginning of the function.

Because of the way JavaScript works, if the game reaches a return expression in a function, it will not read the rest of the function. Because of this, when the function is called, it will immediately return undefined. The rest of the code is never used, because the game stops reading the function after the expression is used.

unlockSpecial

.unlockSpecial is an object method that was meant to be used for unlocking dungeons.

For some reason, the developer chose to disable this code by modifying the if statement. The statement will not execute the code inside it unless two conditions are met at the same time:

  1. The player must not already own the specified object's 'special' functionality.
  2. the number 1 has to have the same value as the number 0.

Due to the rules of basic math, the second condition will never be considered true. Since BOTH conditions have to be met when the check occurs, the game will never use the code inside the statement if the function is ever called.

Ascension

The code that determines all the effects of ascension has a few lines that were commented out.

Achievements

This code would cause ascending to take away all the player's achievements. Thankfully, this was never used.

Golden cookies

//goldenClicks=0;

This code would cause ascending to reset the player's stat for clicking on golden cookies. This was in the game, but it was later taken out after the introduction of heavenly chips, because this would make certain golden cookie-related achievements even harder to obtain.

Missed golden cookies

//missedGoldenClicks=0;

This code would cause ascending to reset the player's stat for not clicking on golden cookies. This stat is already unused, but even if it wasn't, having this would make it easier for players to hide their shameful mistakesreset this statistic.

Options

//Game.DefaultPrefs();

This code would cause ascending to revert the player's options back to their default settings. This was probably removed to make ascending less of a problem for players with custom settings.

Sound Effects

The game has a number of unused sound effects. Out of all of these, the game only contains code for playing 'levelPrestige.mp3', which is commented out.

//PlaySound('snd/levelPrestige.mp3');//a bit too annoying

This was removed because the sound effect would be annoying to the player if they were to gain prestige levels very quickly.

Code Comments

The developer left a few... interesting notes in the source code.

Cookie Clicker's Cookies

In older versions of the game, the player's progress was stored using browser cookies. In light of this, the developer wrote a few comments poking fun at the irony.

However, as of the Valentine's Day update, the game's progress is now saved in local storage. Because of this, part of the text was removed, and a new set of comments were added.

Example Golden Cookie Buff

The code for setting golden cookie buffs contains a large comment, intended to function as instructions for modders to create their own buffs.

This comment contains example code for a custom buff, which would display as this in the tooltip:

The effect would last for 30 seconds by default.

Golden Cookie Chains

One of the buffs a golden cookie can grant is the 'Cookie chain', where golden cookies appear every few seconds, which give the player an increasingly large amount of cookies. The code for determining the amount of time a golden cookie appears on-screen during this buff contains this comment.

//this is hilarious

Apparently, the developer finds the concept of an increasingly shorter window of time to click on a golden cookie funny.

Wrinklers

Wrinklers are leech-like creatures that feed off the player's cookie production until the player pops them. Oddly, the code contains comments describing other strange aspects of these creatures.

  • Wrinklers: //cookie dough does weird things inside wrinkler digestive tracts
  • Shiny Wrinklers://shiny wrinklers are an elusive, profitable breed

Ruin the Fun

'Ruin the Fun' is a function that cannot be accessed without cheating. The code for this function contains a comment.

//booooo

Grandma Upgrades

In version 1.0375, the code contained some... strange comments between the lines of code for each grandma upgrade. The comments were removed in the following update for unknown reasons.

When the comments are isolated from the rest of the code, it looks like this:

  • Farmer grandmas: //I remember the first time I saw her, amidst the cookie crops.
  • Worker grandmas: //Her eyes like a burning furnace; my heart like a racing engine.
  • Miner grandmas: //It was as if she could pierce through me, burrow at my deepest.
  • Cosmic grandmas: //In that moment, the universe felt empty, save for just her and me.
  • Transmuted grandmas: //I could feel it growing in me. Changing me... making me something else, something better.
  • Altered grandmas: //There was no way she was of this world. Her very mind was... alien, pervasive; a distortion of the real thing.
  • Grandma's grandmas: //She was not what I had first assumed; she was from another time, another eon altogether.
  • Antigrandmas: //And with her hair... sparkling like starlight... she whispered something.
(Source: Cookie Clicker Wiki)

News Ticker

The game has a news ticker on the top of the screen, which shows fake news reports on events happening in the game's world.

Base 10

//somehow I got flak for this one

This comment is located after the code for a news report for obtaining the achievement Base 10, which reads 'News : cookie manufacturer completely forgoes common sense, lets OCD drive building decisions!' Apparently, the developer got flak for that one.

Rare News

//apologies to Will Wright

This comment is located in front of the code that is used to choose a 'special' news report 0.1% of the time.

Stop Playing

//only show this for 100 millions (it's funny for a moment)

This comment is located after the code for a news report, which simply reads 'it's time to stop playing'.

CSS

To do:
Finish this section. There's a lot more to cover.

The game uses a cascading style sheet to handle how everything in the game is rendered in the browser.

#tooltipAnchor

tooltipAnchor is a selector that handles the location of a tooltip when an applicable object is highlighted.

The code for this selector contains a commented-out property for tooltip transition. If the game is modded to use this code, the tooltip will slide from a previous highlighted object when a different object is highlighted, rather than appearing immediately at the cursor. This was probably removed because of the weird graphical glitches it causes, such as the tooltip appearing in the wrong location before sliding to the correct slot.

#ascendContent

ascendContent is a selector that handles the contents of the ascension screen.

The rule code for this selector contains a commented-out property for ascension screen transition. If the game is modded to use this code, dragging the ascension screen around will have a smoother transition. This was probably removed because of the weird graphical glitches it causes, such as the background layers keeping their rough transitioning.

.inset

To do:
Figure out what this unused selector does if modded-in.

inset is a selector that is used for the game's panel sections.

The rule code for this selector is entirely commented-out, and contains one property. This selector is called by the HTML document multiple times, but it has no effect.

Retrieved from 'https://tcrf.net/index.php?title=Cookie_Clicker/Unused_Code&oldid=790177'