HåvardTangen Posted April 18, 2016 Share Posted April 18, 2016 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. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted April 18, 2016 Share Posted April 18, 2016 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. HåvardTangen 1 Quote Link to comment Share on other sites More sharing options...
HåvardTangen Posted April 19, 2016 Author Share Posted April 19, 2016 Thanks, this helps very much! Quote Link to comment Share on other sites More sharing options...
mattstyles Posted April 19, 2016 Share Posted April 19, 2016 I'd say there is a gap in the market for someone who sets up a very simple service to handle leaderboard interaction, something that can be deployed easily or run cheaply as a service. Although I haven't checked the market, something might already exist. Quote Link to comment Share on other sites More sharing options...
HåvardTangen Posted April 19, 2016 Author Share Posted April 19, 2016 I think FireBase have a leaderboard, but i couldn't make it work, but im trying again now with help of someone who have good expirience. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.