How to make an online score board

:information_source: EDIT by @4ian in 2022: you can now add Leaderboards to your game using built-in leaderboards provided by GDevelop and Liluo.io. Read more here: Leaderboards [GDevelop wiki]


Hi, I am trying to make s post jam version of my game for ludum dare and after a lot of feedback I would like to make a online score board were the players will be ranked according to their score (like a scoreboard) which can be opened by player or that can be used to the read data from the scoreboard database and show it in the game

1 Like

You might start with the tutorial here: GDevelop 5 [GDevelop wiki]

[edit]

I’m a bit curious about this myself. It’s on my list of things to do, but not something I’ve yet attempted. My main concern is that using a database can turn into a big vulnerability with php/mysql injection and I don’t know enough about php or mysql to implement it safely.

If anyone is knowledgeable about the subject and willing to share, what would be the primary dangers and what would be the best way to mitigate risks? If I made a browser based game and set the database to only accept connections from localhost would it be relatively safe?

At a high level, online scoreboards/leaderboards are absolutely possible.

However, this is something that is going to require you to understand network services, and that GDevelop won’t really be able to simplify for you.

For more detail, to make an online score board, you’re going to need to do a lot of things:

  1. Determine where you’re going to store the scores. It has to be tracked somewhere. This can be a server you build yourself, some kind of database service, etc.
  2. Determine how you’re going to communicate between the game and the score host server. You will need to build this from scratch, and likely need to use the Network events with a REST API
  3. Build out your events to store the scores, then transmit them using whatever you develop in #2.

There are not tutorials on the above items because there are near infinite ways of completing each of them, and risks involved around each (such as mySQL security issues like fitkoh mentioned) that you would need to resolve.

Well a simplified solution would be using the firebase extension :eyes:

True, although they’ll still need to think about how they’re wanting to store/pull data and get a decent understanding of Firebase.

That said, all the more reason for the extension to get added. :smiley:

A solution is currently being worked on here too.
https://forum.gdevelop.io/t/json-and-dreamlo-and-android/

But one problem could be … how useful a scoreboard really is where every player can enter any name. But yes definitely better than nothing.

Thanks for the solutions. But, is there a simplified or an in depth tutorial about online score board because I don’t know a lot about database and pulling and storing data

Unfortunately, what you’re asking for isn’t something that is simple. There may be tutorials in the future for Firebase once that extension is out, but that will only tell you how to use Firebase.

You’ll still need to solve almost all of the items I mentioned above yourself as they’re specific to your game.

I found a site called “dreamlo” from the forum and was successful in reading and writing data to the leaderboard, but now I don’t know how to convert the json file from the site to a variable. When I use the action convert json to scene variable it is giving the value 0. Also how do I extract a specific value or part of the json (ex: name of player) to a variable

1 Like

Hi, I have solved my problem and now I have a working online scoreboard. I more problem If I want data of a specific player it is send me a pipe delimited type(I don’t know what that is, but it was shown on the website) and how do I extract specific data like rank from it.