Skip to content
  • Our Product
    • Namazu Elements
      • What is Elements?
      • Why open source?
      • Docs
        • Elements in Five Minutes or Less
        • RESTful APIs Library
        • Security Model
        • Accessing the Web UI (CMS)

    Our Product

    A logomark with three layered rhombuses adorning the lettermark that says Elements in bold all-caps sans-serif letters.
    • What is Namazu Elements? Discover our easy-to-use backend network solution built for online games. Rapidly enables full-scale multiplayer games or online solo adventures.
    • Why open source? Is there a truly open source server backend for connected games? There is now. Download and run a local copy of Namazu Elements and try it for yourself.
    Download Namazu Elements

    Get started

    • Quick start Read our Elements 5-minute quick start guide
    • Documentation Read our developer docs for learning more about Elements
    • RESTful APIs A full list of core API specs for working with the Elements framework
    • Security An overview of the server-authoritative security model of Elements
    • Accessing the CMS Manage your game with ease via the Namazu Elements CMS.

    Co-development Reimagined

    • Reduce your costs Would you rather outsource your backend development? Hire Namazu Studios to build your server backend with the power of Namazu Elements.
      Co-dev

    Recent Posts

    • The watercolor-styled Namazu Studios logo over a giant namazu lurking in the depth
      Namazu Studios Featured in San Diego Business Journal
      22 Sep 2025 Press
    • Namazu Elements 3.1 Released – Service Layer Fixes, Secure APIs, and Steam Bug Fix
      22 Apr 2025 Release Notes
  • Case Studies
  • About Us
  • News
  • Services
  • Book a call
namazu-studios-logo
Book a call

Getting Started

  • Elements in Five Minutes or Less
  • 🐧Ubuntu Linux Setup
  • 🍎 Mac OS Setup
  • 🖥️ Setup for Windows
  • Accessing the Web UI (CMS)
  • General Concepts
  • N-Tier Architecture
  • Security Model

Namazu Elements Core

  • User Authentication / Sign In
    • What is a User?
    • User Authentication in Elements
    • Auth Schemes
      • Auth Schemes
      • OAuth2
      • OIDC
  • Features
    • Applications
    • Sessions
    • Users and Profiles
    • Digital Goods
    • Progress and Missions
    • Progress and Missions (3.4+)
    • Leaderboards
    • Matchmaking – Comprehensive Guide
    • Followers
    • Friends
    • Reward Issuance
    • Save Data
    • Metadata
    • Metadata (3.4+)
    • Queries
    • Web3
      • Wallets
      • Vaults
      • Omni Chain Support
      • Smart Contracts
        • Smart Contracts
  • Queries
    • Advanced Operators
    • Object Graph Navigation
    • Boolean Queries
    • Base Query Syntax
  • Advanced Operators
    • .name
    • .ref

Custom Code

  • Custom Code Overview
  • Introduction to Guice and Jakarta in Elements
  • Structuring your Element
  • Packaging an Element with Maven
  • Deploying an Element
  • Preparing for Code Generation
  • Properties
  • Websockets
  • RESTful APIs
  • Direct MongoDB Access (3.5+)

Releases

  • 3.4 Release Notes
  • 3.3 Release Notes
  • 3.2 Release Notes
  • 3.1 Release Notes

Configuration

  • Matchmaking – Comprehensive Guide
  • Direct Database Access and Batch Configuration
  • Batch Samples
    • Mission Upload Bash Script Sample
    • Item Upload Bash Script Sample

RESTful APIs

  • RESTful APIs Library
  • Swagger and Swagger UI

Crossplay

  • Namazu Crossfire
  • Deploying Namazu Crossfire in Your Game
View Categories
  • Home
  • Docs
  • Namazu Elements Core
  • Features
  • Leaderboards

Leaderboards

Est. read time: 2 min read


Elements facilitates the creation of Leaderboards that can track user rankings and scores. #

There are three primary APIs to be aware of:

  • Rank
  • Score
  • Leaderboard

Warning

Before working with the Rank and Score APIs, you must first create a new Leaderboard.

Leaderboard Properties #

Leaderboards have the following properties:

  • id: The database id of this leaderboard. This is assigned automatically when it is added to the DB.
  • Name: The name of the leaderboard as a string. This must be unique across all leaderboards.
  • TimeStrategyType: The time strategy for the leaderboard. Current options are ALL_TIME and EPOCHAL. EPOCHAL leaderboards allow for recurring leaderboards that are intended to repeatedly reset after a certain time interval (defined by EpochInverval).
  • ScoreStrategyType: The score strategy for the leaderboard. Current options are OVERWRITE_IF_GREATER and ACCUMULATE.
  • Title: The user-presentable name or title for for the leaderboard as a string.
  • ScoreUnits: The units-of measure for the score type of the leaderboard as a string. This can be anything you want, such as points, crackers, ducats – you name it!
  • FirstEpochTimestamp: The time at which the leaderboard epoch intervals should begin (in ms). If null, then the leaderboard is all-time and not epochal. If this value is provided during creation of the Leaderboard, then epochInterval must also be provided. [^1]
  • EpochInterval: The duration for a leaderboard epoch interval (in ms). If null, then the leaderboard is all-time and not epochal. If this value is provided during creation of the Leaderboard, then firstEpochTimestamp must also be provided.

Once you have your Leaderboard defined, use the CreateLeaderboard function in the LeaderboardApi to create it in Elements.

You can also set up and manipulate your leaderboards on the server side from your lua code:

local namazu_leaderboard = require "namazu.elements.dao.leaderboard"
namazu_leaderboard.create_leaderboard(new_leaderboard)

Now that you have a Leaderboard created, you can use the ScoreApi and RankApi to interact with it. The ScoreApi gives you the following function, which creates or updates a score on the specified leaderboard for the Profile of the player making the request and returns the Score as it was written to the DB.

Score createOrUpdateScore(String leaderboardNameOrId, Score score);

You’ll want to update the leaderboard score whenever someone does something that warrants posting to a Leaderboard, such as being awarded a score for a game.

Depending on the ScoreStrategyType of the Leaderboard, this will either add to the entry (ACCUMULATE), or compare and overwrite it if it is greater than the previous entry (OVERWRITE_IF_GREATER).

The RankApi provides the following functions:

Given the leaderboard name or id, this function will return all Rank instances sorted in order:

Pagination<Rank> getRanksForGlobal(String leaderboardNameOrId, int offset, int count, long leaderboardEpoch);

Given the leaderboard name or ID, this function will return all Rank instances sorted in order. This allows the the result set to be skipped forward to make the supplied Profile appear in the result set:

Pagination<Rank> getRanksForGlobalRelative(String leaderboardNameOrId, String profileId, int count, long leaderboardEpoch);

Given the leaderboard name or id, this function will return all Rank instances for friends of the User sorted in order. This allows the the result set to be skipped forward to make the supplied Profile appear in the result set:

Pagination<Rank> getRanksForFriends(String leaderboardNameOrId, Profile profileId, int offset, int count, long leaderboardEpoch);

Given the leaderboard name or id, this will return all Rank instances for friends of the user sorted in order. This allows the the result set to be skipped forward to make the Profile for the supplied profile id appear in the result set. Additionally this will filter the results to only include friends of the supplied Profile:

Pagination<Rank> getRanksForFriendsRelative(String leaderboardNameOrId, Profile profileId, int offset, int count, long leaderboardEpoch);
What are your Feelings
Still stuck? How can we help?

How can we help?

Updated on August 27, 2025
Progress and Missions (3.4+)Matchmaking – Comprehensive Guide
Table of Contents
  • Elements facilitates the creation of Leaderboards that can track user rankings and scores.
  • Leaderboard Properties
  • Documentation
  • Terms of Service
  • Privacy Policy
  • Contact us
  • Linkedin
  • Join our Discord

Namazu Studios LLC is powered by Namazu Elements, an Elemental Computing Inc. product.

Elements
  • Download
  • About Elements
  • Open source
  • Documentation
  • Support
About Namazu
  • Case Studies
  • About Us
  • News
Get in Touch
  • info@namazustudios.com
  • Book a call
  • (619) 862-2890
  • Linkedin
  • Discord

©2008-2025 Namazu Studios. All Rights Reserved.