Player Statistics
The BrainCloudPlayerStatistics service is used for all user-scoped statistics operations, including Player Experience (XP).
User Stats must be pre-defined from the Statistics Rules - User Statistics page of the brainCloud portal. If instead you need to create them dynamically at runtime, you can enable the Generate User Statistic Rule Enabled setting on the Advanced Settings page of your app in the brainCloud portal.
API Summary
The following operations are for user statistics:
- ReadAllUserStats - returns the complete list of user stats
- ReadUserStatsSubset - returns a specified stats to the client
- ReadUserStatsForCategory - returns the specified category of stats to the client
- IncrementUserStats - perform increment/decrement operations on the statistics
- ProcessStatistics - perform operations on the statistics according to the stats grammar.
- ResetAllUserStats - resets all user statistics to their initial values (as defined by their rules). Useful for debugging.
The following operations are specific to the XP system:
- IncrementExperiencePoints – award XP to the user
- GetNextExperienceLevel – returns information about the next experience level, including associated rewards
- SetExperiencePoints - used to specifically set XP (useful for debugging). Does not generate any associated rewards for levelling-up
📄️ GetNextExperienceLevel
Returns JSON representing the next experience level for the user.
📄️ IncrementExperiencePoints
Increments the user's experience. If the player goes up a level, the new level details will be returned along with a list of rewards.
📄️ IncrementUserStats
Atomically increment (or decrement) user statistics. User statistics are defined through the portal.
📄️ ProcessStatistics
Apply a set of operations to the specified statistics. User (player) Statistics are defined through the portal.
📄️ ReadAllUserStats
Read all available user statistics.
📄️ ReadUserStatsForCategory
Method retrieves the user statistics for the given category.
📄️ ReadUserStatsSubset
Reads a subset of user statistics.
📄️ ResetAllUserStats
Reset all of the statistics for this user back to their initial value.
📄️ SetExperiencePoints
Sets the user's experience to an absolute value. Note that this is simply a set and will not reward the player if their level changes as a result.