Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bonus income and PP calculations for farms and temples don't account for Synergy upgrades #1130

Open
hazardProgrammer opened this issue Nov 25, 2022 · 12 comments
Labels

Comments

@hazardProgrammer
Copy link

Bug description

The bonus income (and therefore payback period) calculations for farms and temples are incorrect and fail to account for the bonus to cortex production which would be caused from the synergy upgrade. The calculations for cortex bakers themselves appear to be correct.

To reproduce

Buy either cortex synergy upgrade, at least one cortex baker, and then check the bonus income for either farms or temples.
The actual bonus income is much lower than the actual increase in bonus income.
Note that this happens on my actual save, but also if I run the game on a private tab (by cheating in the relevant buildings)

Screenshot

No response

Save file

No response

Browser / Steam / Version

Browser, v. 2.048 (latest version of Cookie Clicker)

@hazardProgrammer
Copy link
Author

Actually, it appears that synergy upgrades as a whole aren't being counted for whatever reason. The bonus income for portals doesn't account for the increase in idleverse production that would result for whatever reason, though again the idleverse bonus income number is correct.

@hazardProgrammer
Copy link
Author

My suspicion is that, looking at the code, the relevant CPS calculations for synergies depend on the number of buildings in the game and not the simulation. However, I remember the calculations used to work, and I don't think that part of the code has changed in a meaningful way, so I'm not sure.

@DanielNoord
Copy link
Collaborator

Could it be that the Game's calculation changed in one the more recent updates?

@hazardProgrammer
Copy link
Author

Could it be that the Game's calculation changed in one the more recent updates?

Not entirely sure what is meant by this. I don't think synergy mechanics have changed if that's what you mean.

@hazardProgrammer
Copy link
Author

One more thing: grandma upgrades are correctly accounted for. Not sure about cursors.

@hazardProgrammer
Copy link
Author

I just tested the plugin (current version) on an archived, previous version of cookie clicker (on archive.org, before cortexes were added) and the calculations aren't correct. Now that I think about it, it could be the case that the calculation was similarly incorrect on older versions.
On a slightly unrelated note, if I want to fork the plugin and change a few things around to test, and then load it into Cookie Clicker, how would I go about doing this? I tried to do this but I don't think any of the direct changes to the code I made were reflected. Is anything "special" required?

@DanielNoord
Copy link
Collaborator

How are you loading the local version of your plugin?

@domoddball
Copy link
Contributor

domoddball commented Nov 30, 2022

i never tried in the browser version, but when i did the recent work to bring this mod up to date with the 2.048 cortex baker update, i was able to compile the updates locally and then load the local file into steam by having my main.js be the following
Game.LoadMod('F:/code/CookieMonster/dist/CookieMonsterDev.js');
and adjusted the path for compiled file location on my pc.

as an additional note, when i did the update, i did not notice any changes in in-game calculation code between the existing supported game version (2.031) and the newest update (2.048) outside of the code that added the new unshackled upgrade. Like hazardProgrammer mentioned, i did notice that the calculations were not quite perfect and that there was some discrepancy between predicted and real gains, but it was a small enough %, consistent with the existing version of the mod, and more then accurate enough for what i was using the mod for, that i elected not to chase down the root cause.

@hazardProgrammer
Copy link
Author

How are you loading the local version of your plugin?

It's not exactly local—I forked this github repo and changed a few files in the simulation folder, then hosted it on github pages as was done here and just loaded in the github pages URL. The mod does load, but my changes don't seem to be reflected, unless I have a severe misunderstanding of how the code is structured and nothing I'm changing is actually being used in the way I think it is.

@domoddball
Copy link
Contributor

"misunderstanding of how the code is structured and nothing I'm changing is actually being used in the way I think it is"

the mod doesn't actually use the majority of files when running, instead what happens is that when the repository is built/compiled, all files are combined, optimized, and flattened into the single file at dist/CookieMonster.js
this is the one and only file that is referenced and loaded by the bookmark
javascript: (function () { Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');}());

you need to compile your code in order for the changes to be reflected on mod load. instructions on that are in the readme section labeled "contributing".

@hazardProgrammer
Copy link
Author

Compiled my changes as per above constructions. It appears that replacing lines 25-6 in SimGetTieredCpsMult.js with

if (syn.buildingTie1.name === me.name) mult *= 1 + 0.05 * SimObjects[syn.buildingTie2.name].amount;
else if (syn.buildingTie2.name === me.name) mult *= 1 + 0.001 * SimObjects[syn.buildingTie1.name].amount;

produces the desired effect. I tested on my own save and the numbers match perfectly; I haven't done extensive testing, but I can't be bothered to as I'm confident that it works.

@DanielNoord
Copy link
Collaborator

Feel free to open a PR then! I'm not that involved with the game anymore, so if the code looks good and nothing crashes I'm more than open to merging it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants