Rewards are an effective way to increase player retention and brand loyalty by recognizing your players achievements. Players who are rewarded for their progress will engage with your game even more, to make sure they get the most rewards possible. Rewards come in several different types, including items, new maps, badges, and more.
# How It Works
The Rewards service works by integrating with our Statistics and Achievement services to define the benchmarks players must clear to earn rewards, and with our Entitlement and Fulfillment services to grant players the rewards they’ve earned.
# Managing Rewards in the Admin Portal
# Create a New Reward Configuration
Before you can create a reward configuration, make sure you have created a related statistic or achievement configuration. This statistic or achievement will be connected to the reward configuration.
In the E-Commerce section of the Admin Portal, click the Rewards menu.
In the Rewards window, click the Add Configuration button.
Fill in the Add Rewards form:
- Input the Rewards Code as a unique identifier for your configuration. Your input must follow the formatting rules given.
- Input a Description of the reward.
- Select the Event Topic. This determines what service the reward is related to. You can choose either Achievement or Statistics.
- Input the maximum number of times the reward can be awarded in the Max Awarded field.
- Input the maximum number of times the reward that can be awarded to a single player in the Max Awarded Per User field.
When you’re done, click the Add button
# Add a Reward Condition
Open to the desired reward configuration by clicking View in the Action column.
Then, click the Add Reward Condition button.
Fill in the Add Reward Condition form:
Input the Event Name with a name that relates to this reward configuration, e.g. statItemUpdated for a statistic-based event or achievementUnlocked for an achievement.
Input the Condition Name with a contextual identifier for each condition.
Input the Condition of the rewarding process with JSON path format. See the examples below to learn how to define conditions for each event topic.
Event Topic: Statistics
For statistics, use this JSON path format.
$.[?(@.statCode == "input-your-stat-code" && @.latestValue == x)]
- Input the statCode for the statistic you’re using.
- Input the statistic value at which the reward will be granted as the latestValue.
Here’s an example where a player is rewarded for reaching 30 points for serverstat3.
$.[?(@.statCode == "serverstat3" && @.latestValue == 30)]
Event Topic: Achievements
For achievements, use this JSON path format.
$.[?(@.userAchievement != null && @.userAchievement.status == 2 && @.userAchievement.achievementCode == "input-your-achievement code")]
- Input !=null in the userAchievement field. This confirms that the achievement exists and is not zero.
- Define the userAchievement.status. This determines when the player will receive the reward. Input 1 if the player will receive the reward when the achievement is in progress or input 2 when the reward will be granted when the player receives the achievement.
- In the userAchievement.achievementCode, input the code for the achievement the reward is related to.
In this example, the player will receive a reward when they receive the achievement for killing 10 enemies.
$.[?(@.userAchievement != null && @.userAchievement.status == 2 && @.userAchievement.achievementCode == "kill-enemies-achievement")]
Select the Item you want to grant as a reward. Any items published in your store can be granted as a reward. In this case, 50 Blue Ammo will be granted to the player’s account.
Input the quantity of the item to be granted in the Qty field.
Click the Save button. You can add more items to the reward by repeating this procedure.
Your Rewards Condition will be added to the list.
# Export Reward Configurations
You can export a reward configuration in JSON format by following the steps below.
In the Rewards menu of the Admin Portal, open the dropdown menu next to the Add Configuration button. Then, click Export Configuration.
The download will be started. Once it’s finished, you can open the JSON file and see a list of your reward configs.
# Import Reward Configurations
In the Rewards menu of the Admin Portal, open the dropdown menu next to the Add Configuration button. Then, click Import Configuration.
Fill in the Import Configuration form that appears.
- Choose the File to Import. The file should be in JSON format.
- Select the Import Method.
- Choose Replace if you want to replace an old config with a new one. The new config must have the same key as the config you want to replace. If you have multiple configs in your file, any configs with unique keys will also be imported.
- Choose Leave Out if you want to add a new config without replacing any old configs. Using this method, any configs in your JSON file whose keys match existing configs will not be imported. Only configs with unique keys will be imported.
Click Import when you’re done.
Confirm the import configuration by typing IMPORT in the pop-up form below.
# Integrate the Rewards Service with the SDK
# Rewards Notification
Every time the rewards service successfully fulfills an item, the game client will receive a notification through the lobby service. The topic of the message sent to the game client is e-commerce/rewards. You can retrieve the notifications from the game by setting the delegate SetMessageNotifDelegate, and you can also pull the notifications in case the player missed any notifications when they are offline by using GetAllAsyncNotification. The payload of the SDK below will be in JSON format, and you will be able to serialize it to FAccelByteModelsFulfillmentResult.