Question about Leaderboards and html5

Monkey Forums/Monkey Programming/Question about Leaderboards and html5

MisterBull(Posted 2014) [#1]
I understand that in web browser code (such as javascript/html) aside from php that you cant simply just save data to the server (or/and retrieve it)

So before I go through the headache of experimenting and researching this topic (wasting valuable time) I feel I should just ask about it here...

Can a monkey html5 app use a leader board system of sorts?

You know, recording and retrieving players scores.


Desperado(Posted 2014) [#2]
There are many cloud backend services available for that. I’ve used Scoreoid which works great. Scores can be stored and retrieved with simple http request calls from your Monkey app. Buddy, App42, and QuickBlox are some other options that also have leaderboard support.


MisterBull(Posted 2014) [#3]
I've looked through the links you gave me and I've signed up for Buddy. now, how would I go about linking my buddy app thing to my game? o.0

this looks a bit confusing atm.


Danilo(Posted 2014) [#4]
Wouldn't it be enough to call a PHP / CGI script with arguments on your server to save some info to a database?


MisterBull(Posted 2014) [#5]
I havent learned much PHP yet, unfortunately (I suppose its never too late to start learning though)


Desperado(Posted 2014) [#6]
Working with Buddy is more complicated than Scoreoid, but it might be worth the effort since it appears to provide more usage for free.

Below is the beginnings of a class that communicates with Buddy to create a user (and the user’s player), add scores to a board, and retrieve high scores for a board. To use it, first create an instance of it by passing in your Buddy Application Name and Key like this:



Here’s how you create a user:



That code will contact Buddy to create the user and add the user’s player. Note you’ll need to save off the userToken and restore it when the app is run again so the user doesn’t have to login each time you run the app. The userToken and name can be passed in when creating the Buddy instance.

Here’s how you add a score to a board for the current user:



Here’s how you can retrieve the high scores for a board:



Here’s the example Buddy class:




MisterBull(Posted 2014) [#7]
thanks for the code, I'll play around with it when it comes time to add the leader board to my game. If I have any further questions I'll post in this thread again.

Mucho apreciato!


MisterBull(Posted 2014) [#8]
I cant seem to get it to send the score to the buddy app :P

I'm not sure if I'm just coding it wrong or what... It does receive the new user code just fine though


Desperado(Posted 2014) [#9]
Well here's a complete example that works for me. Just save it to a .monkey file and run it. Press the various keys it displays to create or login users, submit scores, and get the list of high scores. Check the log for info about what's going on.




MisterBull(Posted 2014) [#10]
hey, yea, that helped allot! thanks! :D


IMMGames(Posted 2015) [#11]
I'm sorry to dig up such an old thread, but this example seems outdated now?
Any chance of you updating it for the new Buddy API?


Desperado(Posted 2015) [#12]
It looks like they may have dropped support for leaderboards with the new Buddy API.

Here are some other game backend services that support leaderboards which you could check out instead:
PlayFab
GameSparks
brainCloud
Clan of the Cloud
App42


MisterBull(Posted 2015) [#13]
yeah, they changed their services over to some new system just in the past month.

unfortunate since I now gotta find some time to rework the code in my game :P