staticvariablejames / SpicedCookies

Mod for Cookie Clicker featuring several small changes to gameplay
GNU General Public License v3.0
6 stars 1 forks source link

Feature Request: Export Stock Data #1

Open ScriptForAll opened 3 years ago

ScriptForAll commented 3 years ago

Hi! I've been using some of your Insugar Trading and Spiced Cookies add-ons for a few weeks and let me tell you they're quite the helpful ones.

The idea is the following: implementing a "Extract this session's stock price history to File" option? "Session" being employed here meaning as "browsing session" and not "between ascensions".

This would be useful for those who want to take this stocks game to the next level since it would allow the user to make a post-analysis of the data (e.g. long-term graphs, averages)

However this feature raises a few questions, namely:

staticvariablejames commented 3 years ago

Currently, Spiced Cookies simply saves/restores the internal state of the minigame. Since Cookie Clicker itself only keeps 65 data points (1h 5min), the size of the save file does grow but the bloat due to stock data is limited to about 20kb. (This feature is responsible for the majority of the save file size if you are using the mod.) This is saved in JSON format, so you can clearly see it in the save file after base64-decoding it.

Exporting this browser session's stock price history would be a brittle feature. In order to protect it against closing the browser tab accidentally, the history would either have to be saved to web storage directly (thus making it incompatible with save game backup/restore) or added to the save file (thus bloating it up to hundreds of KB).

I don't think it fits Insugar Trading, as IT also does not compute e.g. the average for the past hour. Spiced Cookies is a better fit for that. I think that exporting it to CSV format is the best solution, as it is very easy to write a parser for it, and this data would never be imported back into the game, so JSON is not that attractive.

If you simply want to generate stock data (for, say, running machine learning algorithms on it), I implemented the stock algorithm in C++ here. And, of course, you can use the Insugar Trading datasets directly.

What is your use case?