Skip to main content
GameDev.net gamedev.net
🔒 Locked

Leaderboards?

Started by robobrain Nov 2, 2011 at 1:33 AM 12 replies 2.7k views
Original Post
robobrain
robobrain
What are people using for leaderboards? It doesn't seem like there is much out there unless you want to get involved with Mochi or a service like that.

I was thinking about releasing a small, open source, leaderboard script in PHP. Totally flat file, no MySQL. Easily Accessible via POST and JSON.

Would people be interested in something like that?
ApochPiQ
ApochPiQ
How will you handle the fact that every single game out there (clones of other games notwithstanding) is going to want to store a totally different set of stats on its leaderboard?
L. Spiro
L. Spiro
Don't be so quick to the gun ApochiPiQ.
Game Center does a fairly decent job of it. You basically have choices on whether your scores are integral or time-based, and the format for the integers and times, and a postfix string, one for singular and one for plural.
Then the choice to sort up or down (higher scores tend to be sorted high-first while times tend to be low-first) and a slew of other micro-properties that can come together to suit nearly any scoring system.

It would be worth the original poster's time to take a look at it.


I would say there is a demand for such a system, but after seeing how thorough Game Center is I would caution you that if you plan to make one you are in for a ride.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
ApochPiQ
ApochPiQ
Apparently I was misinterpreted. My apologies.

I'm not trying to suggest that the idea has no merit - far from it. I simply was curious how much thought the OP has put into the scope of the project.
L. Spiro
L. Spiro
No biggie. smile.gif



L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
robobrain
robobrain

How will you handle the fact that every single game out there (clones of other games notwithstanding) is going to want to store a totally different set of stats on its leaderboard?


The fact that it's open source and easily customizable. It would come prepackaged with like name/score, but anything else would require a bit of customization. Probably via a config file or admin area.


Don't be so quick to the gun ApochiPiQ.
Game Center does a fairly decent job of it. You basically have choices on whether your scores are integral or time-based, and the format for the integers and times, and a postfix string, one for singular and one for plural.
Then the choice to sort up or down (higher scores tend to be sorted high-first while times tend to be low-first) and a slew of other micro-properties that can come together to suit nearly any scoring system.

It would be worth the original poster's time to take a look at it.


I would say there is a demand for such a system, but after seeing how thorough Game Center is I would caution you that if you plan to make one you are in for a ride.


L. Spiro


Thanks, I see what you mean. I will have to take a long look at Game Center.
ApochPiQ
ApochPiQ
Ah, so you're talking about providing a leaderboard kit that others could run for themselves, rather than a hosted service?

Sounds like a plan!
robobrain
robobrain
I started playing around with this. It looks like a database may still be required for high-volume games. PHP's file locking mechanism doesn't seem to always work well.

But regardless, the API will be something like this:

to get the data you would just make a query like so:

www.yourdomain.com/high-scores/list/?key=[your secret key string]&all=true

which would return a json array something like this:


[
{
"rank":1,
"name":"Joe",
"score":1000
},
{
"rank":2,
"name":"Jenny",
"score":500
}
]


and creating a new entry would require a post to:

www.yourdomain.com/high-scores/new-entry/

just set the same vars that are in the json array: rank, name and score and the secret key. Does something like that seem useful? Would you recommend a different API?
ApochPiQ
ApochPiQ
Seems easy enough.

One question: why the secret key on downloading stats versus some kind of authentication on submitting stats? I would imagine that some kind of salted hash would be good for stats submission to help prevent people from gaming the system by just POSTing garbage numbers.
robobrain
robobrain

Seems easy enough.

One question: why the secret key on downloading stats versus some kind of authentication on submitting stats? I would imagine that some kind of salted hash would be good for stats submission to help prevent people from gaming the system by just POSTing garbage numbers.


Sorry if it wasn't clear, it's meant to be used for both posting and getting the data. The reason is that in the future you could also use it for tracking. So if your pc game has one code and your iphone version has another, you could separate them out. Obviously it won't be implemented right away, just trying to think ahead.

You could also theoretically still get the data without using the hash though.
L. Spiro
L. Spiro
Remember to only accept scores that are better than the previous. No client wants to sit there and track every previous score and new score and sort them out.
Clients send scores every time, server rejects lower scores, and in the event of better scores a reply is sent back to the client to confirm that a new high score was reached.

Also, Game Center allows partial scores.
When you submit an achievement, you submit how much of that achievement has been earned. If the goal is to beat every stage in a 10-stage game, and you have beaten 5, you would tell the server that you are 50% towards that achievement.
Only when you reach 100% does the server call back saying you have unlocked the achievement.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
ApochPiQ
ApochPiQ

Sorry if it wasn't clear, it's meant to be used for both posting and getting the data. The reason is that in the future you could also use it for tracking. So if your pc game has one code and your iphone version has another, you could separate them out. Obviously it won't be implemented right away, just trying to think ahead.

You could also theoretically still get the data without using the hash though.


Gotcha, just misread your post and overlooked the part where you mentioned the key goes both ways :-)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.