Jump to content

Scoreboard / Leaderboard


Recommended Posts

I made a snake game with javascript and HTML5 coding. 

The only thing im missing now is a leaderboard that works with names and the score. Top score of all time at the top and the ranks downwards from 1-10. "You" should be there too, even if you are at 51. place, that would show under the 10. place.

Does anyone have a clue to make this work? 
Thanks in advance.

Link to comment
Share on other sites

You want it to persist across everyone? Or just be for the current player?

If you want it to persist you'll have to save scores off remotely and then fetch them when necessary, if it's just for that client then you could get away with whacking scores into local storage, although it sounds like you want the first option.

I think there are some off-the-shelf leaderboards that you could use, I have no experience if they are any good or how much you could customise them to fit in with your game.

If you roll your own then leaderboards are fairly straight forward, although stopping cheating can be a bit trickier. To roll your own then you'd probably want to expose a RESTful service, tied to a database, a simple key-value store like Redis, Riak or LevelDB would be decent choices. You then need two routes, one to post a score and one to retrieve the top 10, you don't need to retrieve the users' latest score, although you might want to retrieve their top score, at most that is two queries but one will be a sequential read from the head of the list and the other is a search, which is nothing to worry about.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...