Note
This guide has been updated to work with Godot v4.2, support for Godot 3.x is available at GitHub
We believe great games can come from anywhere - regardless of team size, location, funding, or choice of engine. In fact, it's thanks to new game engines that many people first get involved in game development. Because of that, we want to make sure every game developer has access to the full toolbox of LootLocker features and are working on integrations for all popular game engines, including Godot.
While creating an SDK for each engine will take some time, we didn't want to keep you waiting, so we've written this guide to get you set up with everyone's favorite online leaderboards.
In this example we will use GDScript to implement LootLocker in Godot and demonstrate:
From there, you can use this code as a base and build upon it however you like.
Before diving into Godot and writing some code, let's start by creating a free LootLocker account, setting up our game in LootLocker, and creating the leaderboard in the LootLocker dashboard. This only takes a few minutes.
Now it's time implement the LootLocker leaderboard directly in Godot.
Currently each leaderboard entry will use the Player ID, but you might wish to let the player set a name so it's more clear who they are on the leaderboard. This can be done by adding the following code to your project. Between lines 140 and 186 you can see the functions we've added for getting and setting the player's name.
Everything we've done so far has been in the Stage environment. When you're ready launch your game, it's wise to point players towards the Live environment. LootLocker comes with these two environments so that you can test and tweak your game in in the Stage environment without affecting your players in the Live environment.
You can switch between environments easily by doing the following steps.
Now that you've got LootLocker leaderboards implemented in your game, it's time to add a few more features to your game, like player progression or unlockable cosmetics and items. These all come out of the box, ready to be added to your game. Check out all of our available features on our website, and their corresponding REST APIs in our reference documentation.
And of course, if you're stuck - we're always here to help. Reach out to us or better yet, join us on Discord.