Brendan Vanous
started a topic on Wed, 03 June 2015 at 6:07 PM
Question from a developer:
Is there currently a way to gift currency or items to all players that have an account in the game?
Brendan Vanous
started a topic on Wed, 03 June 2015 at 6:07 PM
Question from a developer:
Is there currently a way to gift currency or items to all players that have an account in the game?
Best Answer
Brendan Vanous said on Wed, 03 June 2015 at 6:07 PM
Yes, there are a few ways you can do this:
Gifting new players with Virtual Currency
This is the easiest. Just set the Initial Deposit to the amount you want the player to get, either using the Admin API call or the Game Manager (Economy->Currencies). That amount will be granted to all players of your game once, either when they first create an account or, if you already have players, the next time they sign in.
Granting existing players Virtual Currency
Titles that don't need to be concerned about players cheating their VC balances (if, for example, your game has no player competition of any kind - including leaderboards - and your monetization is based on ad revenue) can set the "Allow Client to Add Virtual Currency" option in their title's Settings->General options in the Game Manager, and then use the AddUserVirtualCurrency call.
If, like most titles, turning on that option isn't a viable solution, you'll need to use a server-authoritative method to do this. For individual players, you can use the Admin API call to grant items to specified users, but for all players you'll need to use Cloud Script, as described in the next section.
Granting players Inventory Items and Virtual Currency securely
Granting items or VC to all players in your game (or a subset, based on statistics or other flags) is simple. Define an Update handler (function) in Cloud Script, which is called on player sign-in. If the intent is to grant all players some item(s) or VC, have a flag which is used to check this, which is set in User Read-Only or User Internal Data. Grant the VC (using AddUserVirtualCurrency) and/or item(s) (using GrantItemsToUser), and then set the flag once this is complete. Bear in mind that you should always check for any error conditions - if you need to add both, you should un-do the grant operation from the first if the second fails for some reason, and you shouldn't set the flag until the grant operation is complete. The next time the user signs in, since the flag is already set this operation will be skipped.
Brendan
1 Comment
Brendan Vanous said on Wed, 03 June 2015 at 6:07 PM
Yes, there are a few ways you can do this:
Gifting new players with Virtual Currency
This is the easiest. Just set the Initial Deposit to the amount you want the player to get, either using the Admin API call or the Game Manager (Economy->Currencies). That amount will be granted to all players of your game once, either when they first create an account or, if you already have players, the next time they sign in.
Granting existing players Virtual Currency
Titles that don't need to be concerned about players cheating their VC balances (if, for example, your game has no player competition of any kind - including leaderboards - and your monetization is based on ad revenue) can set the "Allow Client to Add Virtual Currency" option in their title's Settings->General options in the Game Manager, and then use the AddUserVirtualCurrency call.
If, like most titles, turning on that option isn't a viable solution, you'll need to use a server-authoritative method to do this. For individual players, you can use the Admin API call to grant items to specified users, but for all players you'll need to use Cloud Script, as described in the next section.
Granting players Inventory Items and Virtual Currency securely
Granting items or VC to all players in your game (or a subset, based on statistics or other flags) is simple. Define an Update handler (function) in Cloud Script, which is called on player sign-in. If the intent is to grant all players some item(s) or VC, have a flag which is used to check this, which is set in User Read-Only or User Internal Data. Grant the VC (using AddUserVirtualCurrency) and/or item(s) (using GrantItemsToUser), and then set the flag once this is complete. Bear in mind that you should always check for any error conditions - if you need to add both, you should un-do the grant operation from the first if the second fails for some reason, and you shouldn't set the flag until the grant operation is complete. The next time the user signs in, since the flag is already set this operation will be skipped.
Brendan
No one has followed this question yet.