Skip to main content
Version: 5.9.0

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:

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
  • SysResetExperiencePointsAndLevel - System call (cloud code only if from client) to reset the experience points for the session user to a given value. The user's experienceLevel will remain unchanged unless recalculateXPLevel is true, in which case the user's experienceLevel will also be reset to the applicable level (to be used with caution). If the XP points value to be reset is HIGHER than the user's current experiencePoints, an error is returned unless skipResetIfUserXPPointsAlreadyLower is true.
  • SysResetExperiencePointsAndLevelForUser - System call (cloud code only from client) to reset the experience points for the specified user to a given value. The user's experienceLevel will remain unchanged unless recalculateXPLevel is true, in which case the user's experienceLevel will also be reset to the applicable level (to be used with caution). If the XP points value to be reset is HIGHER than the user's current experiencePoints, an error is returned unless skipResetIfUserXPPointsAlreadyLower is true.

📄️ SysResetExperiencePointsAndLevel

System call (cloud code only if from client) to reset the experience points for the session user to a given value. The user's experienceLevel will remain unchanged unless recalculateXPLevel is true, in which case the user's experienceLevel will also be reset to the applicable level (to be used with caution). If the XP points value to be reset is HIGHER than the user's current experiencePoints, an error is returned unless skipResetIfUserXPPointsAlreadyLower is true.

📄️ SysResetExperiencePointsAndLevelForUser

System call (cloud code only from client) to reset the experience points for the specified user to a given value. The user's experienceLevel will remain unchanged unless recalculateXPLevel is true, in which case the user's experienceLevel will also be reset to the applicable level (to be used with caution). If the XP points value to be reset is HIGHER than the user's current experiencePoints, an error is returned unless skipResetIfUserXPPointsAlreadyLower is true.