Momento Leaderboards Just Got Even Better with Competition Ranking
Leaderboards are an essential tool for tracking player rankings in games, competitions, and other score-based applications. With Momento Cache, developers have been able to create powerful, scalable leaderboards using sorted sets of player data. Today, we’re making them even better: the Momento Java SDK now supports competition ranking for leaderboards with the new getCompetitionRanking
call!
Momento’s architecture is built to handle the demands of large-scale leaderboards, supporting live rankings for millions of players. In fact, Momento powers massive real-time leaderboards for customers like Raider.IO, whose largest leaderboards manage over 35 million entries. With the introduction of competition ranking, handling ties at massive scale just got easier, making rankings more accurate and intuitive for your players than ever before.
Why this matters
Many competitive apps rely on ranking systems where tied scores should result in shared positions. Whether you’re building leaderboards for a game, fitness app, or sales competition, competition ranking ensures fairness and delivers the ranking behavior users expect.
What’s new?
Most leaderboards use ordinal ranking, meaning each player has a unique numeric position—or “rank”—based on their score, even if several players tie. Ordinal ranking is simple and common, but it can feel a bit unnatural when multiple players achieve identical scores. Momento’s new competition ranking addresses this by assigning the same rank to players who share the same score, making leaderboards clearer and fairer, especially in scenarios where ties happen frequently. It’s an optimization that better matches the tanking style gamers and competitors expect.
The best part? Nothing has changed about how you build your leaderboards. Your existing setup still works exactly as before, but now you can use getCompetitionRanking
to retrieve competition-based ranks instead of ordinal ranks.
How does it work?
Let’s say we have a leaderboard with these scores:
Player | Score | Ordinal Rank | Competition Rank |
Kenny | 300 | 1 | 1 |
Khawaja | 275 | 2 | 2 |
Ellery | 250 | 3 | 3 |
Daniela | 250 | 4 | 3 |
Allen | 225 | 5 | 5 |
With ordinal ranking, Daniela would have been ranked #4. But with competition ranking, Daniela and Ellery both share rank #3 since they have the same score. The next player (Allen) moves to rank #5, skipping #4.
使用 getCompetitionRanking
in Java, integrating competition ranking into your existing leaderboard is simple. Here’s how you can fetch players’ competition rank:
final Set<Integer> ids = Set.of(123, 456, 789);
final FetchResponse response = leaderboard.getCompetitionRank(ids, SortOrder.ASCENDING).join();
if (response instanceof FetchResponse.Success success) {
for (LeaderboardElement element : success.values()) {
System.out.printf( "id: %d, score: %.2f, rank: %d%n",
element.getId(), element.getScore(), element.getRank());
}
}
That’s it! No extra logic, no workarounds—just a direct API call that returns the correct competition rank instantly.
Ready to build?
- getCompetitionRanking
API is available now in the latest version of the Momento Java SDK.
Ready to take your game’s leaderboard to the next level? Schedule a demo with our team and see how Momento can deliver real-time, competition-style rankings at scale—with APIs built specifically for leaderboards.
Happy coding!