Tournament
The TournamentService API allows apps to interact with brainCloud's Global Tournaments feature.
Tournaments allow developers to automatically reward players based on their performance in leaderboards. Rewards can be virtual currencies, XP, stats and more.
To create an instance of a Tournament, you first create a Tournament Template - and attach it to a Leaderboard via the Design Portal.
Once a Leaderboard has a Tournament attached its behavior changes (i.e., you need to join the tournament before you can post scores, etc.)
At the end of a Tournament cycle (i.e. period), players are sent a SYSTEM_TOURNAMENT_COMPLETE
event indicating that the tournament has completed. If there is a reward, the app should claim it.
SYSTEM_TOURNAMENT_COMPLETE
event
{
"eventData": {
"leaderboardId": "bronzeTourney",
"versionId": 40
},
"createdAt": 1485634987425,
"fromPlayerId": "",
"toPlayerId": "06d7b728-b797-41cc-a872-00a3188e151e",
"eventType": "SYSTEM_TOURNAMENT_COMPLETE",
"evId": "588cfdab9911cc728ee21eae"
}
For more information on Events, see the Events API.
Pro-tip: There are two fields, tRank and rank, in our tournament system. The former repesents the tournament ranking for the score (with tied tournament scores will be having the same tRank), the latter repesents the leaderboard ranking, it will be unique, so even tied scores will be given a different leaderboard rank (with the most recently posted "tied' score having a better rank).
Tournament Divisions
Tournaments with too many players can be less enticing to players because they have a smaller chance to win. Divisions solve this problem by arbitrarily breaking smaller groups - eg. 100 players each. We call each mini-competition a Division Instance.
Divisions Instances only exist for a single tournament period. Once the challenge period is complete, players are disbursed and will join new division instances as the next tournament cycle begins.
FYI - Division instances are essentially managed leaderboards, and are given special leaderboard ids to distinguish them. The ids, for example ^D^weekly^55
, include an incrementing sequence number that identity the instance.
Note - Divisions are not to be confused with Tiers. Tiers normally imply a ranking difference between players - eg. bronze, silver and gold. You can implement this notion in brainCloud using a separate division set (or simply leaderboards+tournaments) for each tier - the management of ranking players up/down is up to the developer. Ask us for implementation suggestions if you are interested.
API Summary
Tournaments
The following API calls are used for leaderboards with Tournaments attached:
- GetTournamentStatus - view the state of a tournament
- JoinTournament - join the specified tournament
- LeaveTournament - abandon the tournament
- PostTournamentScoreUTC - post a score to the tournament
- PostTournamentScoreWithResultsUTC - post a score to the tournament, and return the updated standings
- PostTournamentScoreOnBehalfOf - post another player's score to the tournament
- ViewCurrentReward - preview the expected reward for the player based on their current rank in the tournament.
- ViewReward - view the player's reward for a completed tournament.
- ClaimTournamentReward - claim the player's reward for a completed tournament.
Use the standard Leaderboard Service apis for retrieving player standings (i.e. GetGlobalLeaderboardPage
, GetGlobalLeaderboardView
, etc.)
Divisions
The following API calls are specific to Divisions:
- GetDivisionInfo - get info about the specified division set. Call instead of
GetTournamentStatus()
to retrieve the prize rules and scheduling status of a division. - JoinDivision - join a division set (will be assigned to an instance). Call instead of
JoinTournament()
. - LeaveDivisionInstance - leave a division instance. Call instead of
LeaveTournament()
. - GetMyDivisions - retrieves a list of the division instances that player is/has recently participated in
PostTournamentScoreUTC, ViewCurrentReward, ViewReward, and ClaimTournamentReward all work as expected for divisions.
System calls
- SysCreateTournamentTemplate - Creates a new tournament template.
- SysReadTournamentTemplate - Read a specific tournament template by tournament code and version.
- SysEditTournamentTemplate - Changes an existing tournament template.
- SysListTournamentTemplates - Lists all tournament templates.
- SysDeleteTournamentTemplate - Deletes the tournament template identified by the tournament code.
- SysCreateDivisionSetConfig - Creates a new division set configuration
- SysDeleteDivisionSetConfig - Deletes the division set configuration uniquely identified by the division set id, with optional, additional enforcement.
- SysEditDivisionSetConfig - Updates a division set configuration with specified changes.
- SysListDivisionSetConfigs - Lists all division set configurations for the app.
- SysReadDivisionSetConfig - Reads the current version of the division set configuration identified by the division set id.
📄️ ClaimTournamentReward
Processes any outstanding rewards for the player.
📄️ GetDivisionInfo
Essentially the same as GetTournamentStatus, but takes a division set id instead of a leaderboardId as its parameter.
📄️ GetMyDivisions
Returns a list of the player's recently active divisions, organized by simplified tournament state: ACTIVE, PENDING, CLAIMABLE, or COMPLETE.
📄️ GetTournamentStatus
Get tournament status associated with a leaderboard.
📄️ JoinDivision
Similar to JoinTournament, except that you specify the division set id instead of the leaderboard id.
📄️ JoinTournament
Join the specified tournament. Any entry fees will be automatically collected.
📄️ LeaveDivisionInstance
Similar to LeaveTournament, but for a division instance. The player's score will be removed, and the instance will no longer appear in the player's division list.
📄️ LeaveTournament
Removes player's score from tournament leaderboard
📄️ PostTournamentScoreOnBehalfOf
Post score to another user.
📄️ PostTournamentScoreUTC
Post the users score to the tournament leaderboard.
📄️ PostTournamentScoreWithResultsUTC
Post the users score to the tournament leaderboard, and returns updated standings.
📄️ SysCreateDivisionSetConfig
Creates a new division set configuration
📄️ SysCreateTournamentTemplate
Creates a new tournament template.
📄️ SysDeleteDivisionSetConfig
Deletes the division set configuration uniquely identified by the division set id, with optional, additional enforcement. NOTE: Does NOT delete any division set instance leaderboards that have currently been created, those will expire at the normal time. Does NOT prevent players from posting scores to a division set instance they are already a member of. WILL prevent new players for joining the deleted division set (JoinDivisionSet Tournament service API). WILL prevent users from querying the division info (GetDivisionInfo Tournament service API). WILL prevent Design Portal users from being able to view the rankings of the division set instance leaderboards for the deleted Division Set config.
📄️ SysDeleteTournamentTemplate
Deletes the tournament template identified by the tournament code.
📄️ SysEditDivisionSetConfig
Updates a division set configuration with specified changes
📄️ SysEditTournamentTemplate
Creates a new tournament template.
📄️ SysListDivisionSetConfigs
Lists all division set configurations for the app.
📄️ SysListTournamentTemplates
Lists all tournament templates.
📄️ SysReadDivisionSetConfig
Reads the current version of the division set configuration identified by the division set id.
📄️ SysReadTournamentTemplate
Read a specific tournament template by tournament code and version.
📄️ ViewCurrentReward
Returns the user's expected reward based on the current scores.
📄️ ViewReward
Returns the user's reward from a finished tournament.