Share data across the games

0 favourites
  • 6 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • hi, everybody

    in my project a large amount of minigames. and because there are too many of them, project became heavy, and loading time is slow. so i decided to create a launcher. the problem is how to transfer variables across minigames. for example Music On/Off, users progress, ets.

    i googled that two pages share the same local storage if their origin (domain) is the same. but cant really make it happen...

    launcher

    minigame

    in google chrome i can see the "path" key is stored, but i can't reach it...

    here you can try the result https://youthful-turing-643bff.netlify.app/

    here is capx files. 0 - launcher, 1 - minigame https://dropmefiles.com/B1DEk

    any help will be appreciated

  • I believe you can only access local storage data from another game if it's on the same domain, and if it has the same app ID. (EDIT: turned out this is not true)

    If you need to use different app IDs in your minigames, then they'll not be able to share local storage. You will have to send data to services like Firebase, Playfab, or store it on your own web server.

  • I believe you can only access local storage data from another game if it's on the same domain, and if it has the same app ID.

    If you need to use different app IDs in your minigames, then they'll not be able to share local storage. You will have to send data to services like Firebase, Playfab, or store it on your own web server.

    thanks, i'll give it a shot

  • so, i think it's not the app ID should be changed, because i did, and it didn't work. i even changed the name of the minigame to louncher's name. not working.

    but i noticed in Chrome Dev Tool something. there is a postfix in c3-localstorage(you can see it on screenshot at my first post). so i changet it in data.json.

    and it works now. does anybody knows how to change it throu Construct, rather then directly in json?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Turned out I was wrong about the app ID. Seems like there is a "uniqueId" tag in .c3proj file, which is probably generated when you create a new project, and which works as a storage identifier.

    Try setting the same uniqueId for all your minigames and see if they can share Local Storage after that.

    It's odd that this feature is undocumented..

  • dop2000 this is a bit of a revelation! I'm building a similar setup to OP, currently passing URL params back and forth which is fine, but not exactly convenient.

    Ashley can you comment on this "hack"? Obviously undocumented features should be avoided at all costs, but are there any issues or caveats you foresee if one were to use this method to share data across apps?

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