Knowledgebase
Leaderboards
Overview
OpenFeint leaderboards are a powerful yet simple way of encouraging social competition in your game. Leaderboards in OpenFeint have the following behaviors:
- High Scores can either be ranked globally or filtered by a player’s friends.
- High Scores can be sorted in ascending or descending order.
- Each player can have one ranked score per leaderboard.
- A game can have an unlimited number of leaderboards.
- Leaderboards can be named whatever you’d like.
- Leaderboards are not shared across games.
- You can restrict leaderboards by your game’s bundle version.
- Score submitted when offline will be sent to the server the next time they are playing online
- If displayText is passed when submitting that is shown in the high score list instead of the score
What is an aggregate leaderboard?
OpenFeint supports aggregate leaderboards that allow you to summarize any number of other leaderboards. These are useful when you want to have a set of leaderboards all contribute to another leaderboard.
Quick Start
- Add a leaderboard to your application from the Developer Portal.
- Note the Unique Identifier of your new leaderboard.
-
In your application, submit the player’s score like this
[OFHighScoreService setHighScore: scoreGoesHere forLeaderboard:@"leaderboard_id_string" onSuccess:OFDelegate() onFailure:OFDelegate()];
Downloading leaderboard data for custom display
If you wish to download leaderboard data to display inside your game please have a look at OFHighScoreService.h. The scores are "paginated", meaning you can only request a certain number of records at a time
[OFHighScoreService getPage:1 forLeaderboard:@"leaderboard_id_string" friendsOnly:NO silently:YES onSuccess:OFDelegate(self, @selector(_scoresDownloaded:)) onFailure:OFDelegate(self, @selector(_failedDownloadingScores))];
- (void)_scoresDownloaded:(OFPaginatedSeries*)page
{
NSMutableArray* highscores = nil;
if ([page count] > 0)
{
if ([[page objectAtIndex:0] isKindOfClass:[OFTableSectionDescription class]])
{
// NOTE: In the following line, we access "[page objectAtIndex:1]" to retrieve high scores from
// the global leaderboard. Using "[page objectAtIndex:0]" would retrieve scores just for the local player.
// Older versions of OpenFeint did not break this out into 2 sections.
highscores = [(OFTableSectionDescription*)[page objectAtIndex:1] page].objects;
}
else
{
highscores = page.objects;
}
}
for (OFHighScore* score in highscores)
{
// ...
}
}
- (BOOL)canReceiveCallbacksNow
{
return YES;
}
You'll end up with a 'highscores' NSMutableArray that contains a number of OFHighScore objects which describe the user who submitted the high score, their rank, and their score.
Header Files
- OFLeaderboardService.h
- OFLeaderboard.h
- OFHighScoreService.h
- OFHighScore.h

