Sign In Register

How can we help you today?

Start a new topic

Save Data and use cases

Hello all,


I am a newbie with GameSparks, and I am not really good at English. So I just want to ask the question in here and hopefully get some simple answers. 


I am looking at different way to save players' data and trying to figure out which type/method would be the best. And thinking of example use cases on it.


So far I have found we can save data under gamespark player e.g. scriptData and privateData


What sort of use I can do with scriptData? Like player's level? or what item player has?

Can player's friend have access to scriptData? Like I want to check what level my friend is on the game?


What about privateData? I can't think of any use cases for it. 


What about using Collection? What is the advantage of using it? I notice there are runtime collection and meta data collection. I read from tutorial that meta data collection data will stay as when game being published. Does it mean I can't use runtime collection data to store player's data because it will get reset when game being published? Does it mean every update that i make?


Sorry for my bad English, but I think I don't fully understand the concept of each.


 Hey Derek,

So i'll explain the different use-cases for each of the ways you asked and their advantages/disadvantages..


  • Player scriptData
    This is stored directly on the player doc. GameSparks uses a restricted collection to store player data like auth-tokens, VGs, currency, etc and part of the API that you use to access this allows you to get/set data here. You can store whatever data you want here, but there is a limit to the size you can store here (16mb). The data stored here can only get/set so you can search the data without loading it into memory first which means you can (for example) search for an item in the player's inventory, and then get the item back; you'd have to get all items first and then the one you need.
    So, this is appropriate for small player-profile related things like level (as you mentioned), account status, xp, etc. Basically, anything that doesnt need a complex object or list.
  • Player privateData
    Private data works the same as scriptData but it will not be returned to the client (unless you write some code specifically to do so), so we would recommend this for things like the player's email or payment status, or anything private related to the app like external auth-tokens.
  • Custom RuntimeCollection
    For complex player information like inventory, units, transactions, characters, etc we highly reccomend using custom runtime collections.
    These are used for any player-related data that changes regularly when the game is live. You can see some examples below of how to set them up.
    Creating custom collections for player data lets you set your own fields as you like, index them for efficiency based on the data you need most frequently from the DB and create custom queries to access that data.
    Any player-data that you have that is more complex than a few key-value pairs should go in a runtime collection.

    Inventory -> https://docs.gamesparks.com/tutorials/database-access-and-cloud-storage/saving-and-loading-player-inventory-data.html
    Custom Friends list -> https://docs.gamesparks.com/tutorials/social-features/creating-custom-friends-lists.html

    RuntimeCollection are *not* overwritten when you publish a new snapshot to live, metacollections are however.
  • MetaCollections
    MetaCollections are static when the game is live. That means you can read/write to them on preview, but when the game is live, you can only read from them. These are used for static game-data like item descriptions, game-settings, game-states, events or live-ops configurations, etc.
    There is an example below of how these meta-collections are used with custom management screens to run sales events from the server.
    https://docs.gamesparks.com/tutorials/live-game-operations/live-ops-for-weekly-events.html

Please let me know if that makes sense, and we'd be happy to answer anymore questions.
Thanks,
Sean


Hello,


Thanks for your reply. I think this is more clear.


Can I just ask? Can Player script data can be access from other player? Like if I want to see other player's or friend's level while playing the game.

Login to post a comment