clickercookie / clickercookie.github.io

A totally original game about clicking a cookie
GNU General Public License v3.0
3 stars 1 forks source link

Saving System v4 #18

Open FifthTundraG opened 8 months ago

FifthTundraG commented 8 months ago

Welp, here we are. I said I wouldn't do it, but when it comes to saving it seems I will never be satisfied.

Now for the data section. Data is going to be stored in an array of values, each index will be a different variable value. A great example of this is the very early version of the saving system from 0.5, except for this time instead of basing it on newlines it will be stored as an array.

Ultimately, for me, this was a necessary change, and even though I know it will take an extremely long time to implement, I feel its addition is integral for Clicker Cookie to have an actual easy-to-work-with codebase, which right now it certainly does not.

FifthTundraG commented 7 months ago

Here's my new idea for how it should be done to make it a little more user-friendly and (maybe) help with save data for modding.

{
    "header": {
        "version":"0.6"
        "versionBranch":"main",
        "format":"4"
    },
    "data": {
            "core.cookies": 1542332,
            "core.cookiesPerSecond": 4838,
            // so on, so forth
    },
    "modData" {
            // this can be figured out later down the line
    }
}

The new data's keys, like "core.cookies", will be manually inputted, for example: save.data["core.cookies"] = core.cookies, for every variable being saved.

modData may or may not be used in the final draft, it depends on how nicely it works without any workarounds.