GameJolt: Login, Achievements and Leaderboards Implementation

1

Index

Stats

9,607 visits, 19,255 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 10 Sep, 2013. Last updated 19 Feb, 2019

Leaderboards!

I won't be covering having multiple leaderboards, simply because I haven't dug into that yet. So I'm not gonna need the learboard ID, since when you don't pass that parameter to the API, it just adds that score into your Primary leaderboard.

Setting up the variables

You will need to add two variables, in my case, I called them GJScore and GJScoreSTR. This is totally arbitrary, you can name them as you want of course. I named them that way to remind me that one should send the numeric score used for sort and the string value that will be used for score. Basically, the score could be "10 Coins" but the sort should be only "10". Again, it's really important to note that these two values MUST BE strings. So when you make the variables, be sure to set the type to text instead of number.

Setting up the function

So, for the Scores function, I basically copied Galactic's SetGJTrophie and modified the calls as specified in Game Jolt's Score API Documentation.

It should look like this:

(Don't worry about copying from here, I'm gonna upload a .capx with the function so you can copy it)

This will be the main function that you will use to send your scores. On Game Jolt, you can configure the leaderboard to have all scores for each users, or unique, which will only store the highest score. You can find these options in Dashboard / Manage / Achievements / High-scores.

Sending the high-scores

To make this work with the function I had to make a few adjustments to my event sheet.

You could make a function for sending the high-score. In my case, I have an onDeath layout. What I did was pass the numerical value of my score TotalDistance to the new text variable I set up before called GJScoreSTR and GJScore, and then call the function ''SetGJScore'' that will pass those values into the API calls. Like this:

If you have an "onDeath" Function for example, just replace On Start of Layout with your function.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!