Basically, I have a game where a user can earn a point (virtual currency #1). Once they earn a point it's entered into a pool that contains ALL user's points (virtual currency #2) that play the game. The user, in game, can view their amount of points and the total amount of points entered by all users. How can I make a Cloud Script that will add to the user's point's and automatically add to a pool of all user's points?
,
Basically, I have a game where a user earns a point (virtual currency). Those points are put into a pool that contains all user's points (another virtual currency) that play the game. In my game the user can view how many points they have and how many total points are entered by all users. How can I make a cloud script that adds virtual currency to the user and also automatically adds another virtual currency to ALL users?
Answer by Citrus Yan · May 11, 2020 at 08:55 AM
For adding currency to a single user, you can use the AddUserVirtualCurrency API in CloudScript to do that. However, in the second case, it’s possible that multiple players may be trying to read/write the same data at the same time, which might raise concurrency issues, therefore, you may need an external service such as Redis to track this.