The story behind the Leaderboard
Hey, thanks everyone for playing our game and for your comments! Now, I just wanted to share with you the story behind our Leaderboard - The why it was a a good choice and yet, why I would not recommend it.

The leaderboard was never supposed to be part of this Game Jam. I was just feeling tired on Sunday at 1:00 AM, so I started to play this Compo game, and for a compo, it was still a pretty solid entry with minimalist visuals, the bare minimum of inputs - basically the kind of game that you could easily play on a smartphone.
For a full 10 minutes, I played the game and just COULDN'T STOP. Some guy had posted his score on the game page and all I wanted was to beat it. That's when I realized that, even if our game turns out ok, people will still play it again just to beat someone, or be the best at it. Then came the idea of adding the leaderboard.
Now, that's where I must be honest and say that, even though it was a good move, it was a risky one. The leaderboard didn't make it into the game until 5 minutes before release, and even then, it was an insanely stressful time. Thing is, it was a big move and if it hadn't worked out, I would've wasted a whole day for nothing. This is why, before actually doing the feature, I had to consider most of what it implied:
- Finding a free hosting service (I guess that was an added challenge cuz I could've payed for it),
- Back4app
- Hosting the leaderboard
- Doing the requests
- Making the UI
- Doing async calls, which meant adding some loading screen in the UI
- Finding some way to remember the user without needing to sign-up / sign-in
- Actually ADD a scoring system
It finally took 7 hours of nightmare to make it barely work, and 20 for the full integration. It could've taken less time, but the backend I used provided an SDK for Unity (Parse) that looked really easy to implement. I mean, look at that:
c#
ParseObject gameScore = new ParseObject("GameScore");
gameScore["score"] = 1337;
gameScore["playerName"] = "Sean Plott";
Task saveTask = gameScore.SaveAsync();
Turned out that the it had been deprecated for 4-6 years and wouldn't compile in Unity because of some code in the DLLs that already existed in Unity. Luckily, they provided the actually source code, so I went in Visual Studio, removed the broken bit, recompiled the DLLs and VOILA. It worked.... ... ... In the Editor.
I was smart enough to build the project and run it in WebGL, which crashed immediately. That's when I remembered that WebGL is not a fan of Threads, and the DLLs were using Tasks… Don't use Tasks in WebGL kids. ... I ended throwing the SDK out and do simple HTTP request calls to the database using UnityWebRequest (since it's single-thread). The database documentation on how to use Web Request was scarce, but it provided a way to use cURL, which was.. kind of alright to understand...
console
curl -X GET \
-H "X-Parse-Application-Id: 8ffbed6523c84319a7ae17979fbea93b" \
-H "X-Parse-REST-API-Key: 0b34122ce4fd4997b5993cc447cbfd1f" \
-G \ --data-urlencode 'where={"title": "My post title", "likes": { "$gt": 100 }}' \
https://parseapi.back4app.com/classes/Post
I mean.. not great, but... alright. After all of the painful debugging and integrating, I finally had something that worked. I was really proud of it, the UI was done, I could post data and it would show up in the leaderboard... but when it was time to actually use it, we realized something...
No one did the scoring system.
It's one hour before release. We have to implement the tutorial scene, the scoring system, hook it up with leaderboard, show some UI to display the score, build, distribute, test-test-test and hope everything holds. It's pretty easy to guess that we did not do it all.
So this is the story, or part of it. I guess I learned new things, but 21 hours before deadline is not the time to implement a new massive feature!