How can I share data across places

Hello there!

My upcoming fantasy game is multi place so how can I share data between places?

3 Likes

By default, DataStores carry over to different places inside a single game.

4 Likes

If you’re asking how to share data between multiple different Experiences then I’m afraid you’ll be rather disheartened to know that this is impossible:


  • Datastores, which are the proper way to save/store non-volatile data for Roblox Experiences is strictly locked to that Experience (although accessible to all sub-places,) due to multiple security implications.

  • MemoryStoreService, or MemoryStore is a way to profile items into a rapid response volatile queue, useful mainly for preventing data duplication glitches by granting developers a high speed queue that could be used like a stack (First in → Last out)

But in the case of just multiple sub-places in one parent Experience, you can use both of these with shared data.

EDIT: In response to @steven4547466:
Yes, but also no… This requires excessive use of the HTTPService, more-so if you’re syncing.
That was the “Yes” part, let me explain why I also say “no.”
This is an external dependency on an already somewhat problematic platform (referring to the frequent issues and random downtimes we all experience,) which is an awful idea in my personal opinion; then there’s the resulting issues of potential edge-case data loss:
Scenario as follows:
Player Joins Server → Database Is Down → Data Is Empty → Player Goes to Leave → Database Comes Online → Server Sends Write Request → Write Request Is Empty → Database Wipes Player’s Data

Once again, edge-case? Yes. Possible? Provably. Possible to prevent with checks? Yes, but still unreliable.

This is a rant at this point, I’m gonna go play some games and procrastinate.

4 Likes

Sharing data between experiences is not impossible. Using an external database and HTTPService it’s pretty easy to do. But they were probably asking for just regular multi-place data sharing.

1 Like

Has anyone forgotten about MessagingService?

2 Likes

Not excessive just do what ProfileService does, grab their data on join and maybe sync all active profiles on the server every now and then in one batch request, sync it when they leave and when the game closes. Multiple concurrent connections to an sql database is pretty easy to manage.

DataStores have proven to be unreliable in the past themselves as well. Roblox itself isn’t reliable either, I mean every week we’re getting major outages (http://status.roblox.com/pages/history/59db90dbcdeb2f04dadcf16d). The same edge case you defined is possible using data stores as well, albeit maybe less likely. But I’ve been operating multiple databases for the past year with basically no downtime, only for server upgrades or maintenance.

The very simple check is to see if the server responds at all, if it doesn’t notify the player that the database is down. Will this affect your game? Yeah, no one will be able to play it if the database goes down, but it’s still very possible to prevent overwrites with very simple checks. If the server times out it’s down so don’t let them play.

The other way around would be worse when the database goes down while in game. But that has an somewhat easy solution as well. If the data fails to save, fallback to a datastore and routinely check this datastore for unsync’d data. Do this data check before retrieving a new profile from the database. This would only ever have a problem if a very specific scenario happens:

Player joins the server → Database is up and profile retrieved → Stuff happens, database goes down → Player leaves and their data is saved to the datastore → Player joins game 2 which uses the same system and database is up → Their profile is the one they had before because it was unable to sync on the first game.

Is this possible? Yes. Is it probable? No. It’s very unlikely this situation would occur. And if you really want this is possible to prevent to using a locking system. If their profile is retrieved then lock it. This is exactly what ProfileService does. They’d have to wait for it to sync then be released to join.

It’s not that hard to make a reliable external database with profile locking to prevent data overwriting.

Games inside universes can share data using MessagingService and DataStores. If you mean sharing info between universes, your only solution is to send HTTP requests to external services.

1 Like