How do I share saves between games?

1 favourites
  • 7 posts
From the Asset Store
No Ad-Sharing, Fully Open Source, No Remote Control, Well maintained
  • I would like to save locally using LocalStorage, but be able to have a second project access it.

    Similar to how your experiences are transferred from games like TellTales The Walking Dead 1 & 2.

    Atm, I cannot choose where the save the localstorage, let alone share it between projects.

    I can upload the saves to a server, and download it... but that can quickly fill up a database, and I'd rather not do that.

    LocalStorage will suffice.

    Any tips?

  • Well, according to this:

    javascript.info/localstorage

    localStorage is per domain, but you can't access other site's localStorage.

    So I'd guess that means if the first game was on a website like:

    http://www.myawesomegame.com/game1/main.html

    and the second was on:

    http://www.myawesomegame.com/game2/main.html

    Then they would have the same localStorage. Would have to test, but I never upload games online so I don't know for sure.

    Now, I don't know how construct handles that internally. They could be somehow making it unique per game and not shared.

    You could do it manually with js to cut out the middle man to see what happens:

    // to set value
    localStorage.setItem('key1', 1337);
    
    // to get value
    localStorage.getItem('key1')

    Why can't it be that simple in Construct? They seem to prefer triggers.

  • Since it's something that happens rarely, you could let the player download a file on their computer with the data you need and then give the option to load it with the new game.

    It could be a JSON from an Array for example.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Since it's something that happens rarely, you could let the player download a file on their computer with the data you need and then give the option to load it with the new game.

    It could be a JSON from an Array for example.

    Unfortunately, for me, it's not something that happens rarely. I want to run a beta and a stable version.

    Being forced to have unique data for each version is more than disappointing, in my opinion.

    R0J0hound - I am currently doing it via a website in the form of:

    beta.myawesomegame.com and stable.myawesomegame.com and it's not working, sadly :(

    I also tried doing it manually, with At Start of Layout - localStorage.setItem('key1', 1337);

    And this did nothing either. I can still see my original localstorage.

    Shame. This seems to be a pretty significant restriction on something I feel people should have access to.

  • According to this:

    developer.mozilla.org/en-US/docs/Glossary/Origin

    Two pages share the same local storage if their origin is the same.

    So while beta.myawesomegame.com and stable.myawesomegame.com don't work since they are considered different origins, you should be able to do myawesomegame.com and myawesomegame.com/beta or something like that and it should work.

  • Good to know R0J0hound :-)

  • According to this:

    https://developer.mozilla.org/en-US/docs/Glossary/Origin

    Two pages share the same local storage if their origin is the same.

    So while beta.myawesomegame.com and stable.myawesomegame.com don't work since they are considered different origins, you should be able to do myawesomegame.com and myawesomegame.com/beta or something like that and it should work.

    Interesting, I'll give it a go :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)