I have been working with data saving lately and tested numerous methods such as using ProfileService and noticed an odd pattern, The part that saves data always concatenates the user id with something like “Player_” or “PLR”, And i got curious on why the code specifies players instead of just putting the user id itself alone, Are there any other common uses for them?
saving data
- My question was what data is commonly saved other than player data
- How did you even send that? It’s a third of the minimum length
loading data
i think matchmaking is one of them
or saving configuration if it changes per server
OR like a stock market if you had something of similar nature, thats about as far i can think of examples tho
I often use datastores to save non-player related data as well. This is because, as you may have noticed, when things like module scripts get really large, they create lag, and make editing a game harder and updates longer to submit. Also Roblox has a restriction where it doesn’t let you set a string property to something more than 200k characters, while datastores allow for roughly 4 million of characters to be stored.
Common use cases include:
- AI data - For example neural network structure, weights and biases of a trained AI model
- Real world data - For example data about countries, roads, networks.
- For caching API results
Another use case I once came across was a chunk based system for a town. Basically each player could create their own home on a specific tile on a map, and that home would be visible to other players as well, even when that player wasn’t in that server. For that scenario I needed two datastores, the player datastore that had all the data for their house, and a “neighbourhood” datastore that had the data of all houses to be loaded for a specific chunk(so I don’t have to fetch them one by one and cause insane throttling). In that scenario the key was the neighbourhood instead of the player house and the neighbourhood had minimal data about the houses(basically just what was needed to display them visually).
Another case I have encountered that required chunk-like keys was computation that was done using multiple servers. Basically the task was an easily parallel one, but the computations for it were heavy. So I had set up a system that cut the problem into chunks, and had each server do calculations for the older non updated chunk of the problem. I had also set up a lock system, so a server could tell “hey I’m computing that, don’t bother” to other servers.
In general such scenarios can occur when there is data sharing between players and one player isn’t the protagonist of the data. For example if you make a social network in-game, and you have a home feed in it, that recommends random posts that other players have made, you will need to have a system with different keys in place(for example page keys). For the simple reason that fetching the post of each player one by one is an ineffective way of loading things.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.