Developer Console

Leaderboards and Tournaments Tutorial - Setup

Return to Tutorial Overview


The focus of this tutorial is the Leaderboards and Tournanaments integration into an Android game. We use the Kotlin language in our code, but all concepts apply equally to Java. We will stick to standard Android framework classes such as Activities and AsyncTasks.

Because our focus is the integration of Leaderboards and Tournanaments into a game, we use a very simple quiz game. The code for this game is provided in whole without integration, and then we go through each integration point. The entire game is provided for download. The tar-ball is a git repository. There is a separate branch for each step in this tutorial. This approach allows us to see how each API integration impacts the app as a whole.

Before starting the Leaderboards and Tournanaments integration, we need to complete the following prerequistes.

Prerequisites

  1. Android Studio (with all of its dependencies such as Java) setup.
  2. A test device or emulator to run the app.
  3. A registered account with Leaderboards and Tournanaments, with the accompanying API key. If you haven't already registered, go here to set up your account.
  4. After you register with Leaderboards and Tournanaments, you'll need to create a game. This will give you an admin API key. We need this in our app later.
  5. For our sample game, we use one long-lived tournament to collect scores. Using the admin console, create a new tournament and have it expire after a few weeks or months. After creating the tournament, you can copy the tournament id from the URL in the Leaderboards and Tournanaments console. It will be a standard GUID, for example 2c8aff46-d8d7-4668-8ee7-36db59d76789.
  6. To avoid implementing all of the HTTP client boilerplate by hand, we use the openapi-codegen tool with the Player API model to generate the client code.
  7. Download the game source code.

Next - Game Walkthrough