Sign In Register

How can we help you today?

Start a new topic
Answered

scriptData, privateData or Custom

 Hi,


In the documentation when reading about scriptData and privateData there is mentions that we should only use this storage for a small amount of data.


"These two mechanisms are perfect for when you have a small amount of data that is associated with a player:"


so what is a small amount of data? And is the impact the same for scriptData as for privateData?


Right now we have not used these two types and instead are only using custom runtime collections for our playerdata. But i see that we can simplify things if we could move to only using privateData and or scriptData.


Some clarification in this mather would be good.


Thanks,

Kristofer


Best Answer

Hi Kristofer,


It depends on what kind of data you need to store. ScriptData and PrivateData are stored on the player object and accessed through SparkPlayer calls. ScriptData will be viewable in certain responses. For example the GetTeamRequest and ListGameFriendsRequest. Both of these requests return info about the players team mates and game friends respectively. Any scriptData stored on those players will be included in these responses. PrivateData will never be displayed unless it is explicitly called in a script. So for example if you wanted to store an email for a player you may want to store it in privateData so it's never exposed to other players.


If you're storing large amounts of data for players it would be better to use a runtime collection and use mongo operations to make updates to these documents. We have some documentation on this here. Data stored in collections will be easier to query in your scripts. So if you have a collection that contained a "playerLevel" value for each player it would be much easier to run a query against that value to find players above a certain level. If you have any further questions just let us know.


Regards,

Liam


Answer

Hi Kristofer,


It depends on what kind of data you need to store. ScriptData and PrivateData are stored on the player object and accessed through SparkPlayer calls. ScriptData will be viewable in certain responses. For example the GetTeamRequest and ListGameFriendsRequest. Both of these requests return info about the players team mates and game friends respectively. Any scriptData stored on those players will be included in these responses. PrivateData will never be displayed unless it is explicitly called in a script. So for example if you wanted to store an email for a player you may want to store it in privateData so it's never exposed to other players.


If you're storing large amounts of data for players it would be better to use a runtime collection and use mongo operations to make updates to these documents. We have some documentation on this here. Data stored in collections will be easier to query in your scripts. So if you have a collection that contained a "playerLevel" value for each player it would be much easier to run a query against that value to find players above a certain level. If you have any further questions just let us know.


Regards,

Liam

Thanks Liam, we will continue using runtime collection for our playerdata.

Regards,
Kristofer

 

Login to post a comment