Track total score from all users

0 votes
Hi, in my game I have gold currency and I want to track total gold all users have. Is there a way to do this? Thanks
asked Feb 29, 2016 in iOS by victorshablyko (11 points)

1 Answer

0 votes

Hi Victor,

Yes, you can manage this by editing the user scores like whenever user earn new gold currency, you can fetch the previous details from the server and update the records based on their previous score + new score. Please have a look at this link for the code snippet to understand, how you can edit the user score and let me know if it helps.   

 

Regards,

Himanshu Sharma

answered Feb 29, 2016 by hs00105 (2,005 points)
Thanks, I thought about it, but what if 2 and more users will edit same score at the same time? Is it safe?
Hi Victor,

Could you please elaborate this more, because as I am able to understand your scenario there will be one case where one user can update his score from multiple device at the same time.  Otherwise, there is no issue of calling edit score method multiple times through API.

Let me know if you have any other concern,

regards,
Himanshu Sharma
No, I want to track current total gold from all users at the same time
Hi Victor,

In that case, you need to save user score inside storage service. You can call insertJSONDocument from Storage API and save user score for all time and query back in your app according to your requirement. Please have  a look at this link(http://api.shephertz.com/tutorial/Saving-App-Data/?index=storage-data) to get started with Storage service and let me know if you require any help from my side.

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com