Leaderboards?

Started by
12 comments, last by ApochPiQ 12 years, 5 months ago
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?
Want to make Android Games?
Then check out the free RoboBrain SDK.
[size="2"][url="http://www.robobrain.org"]www.robobrain.org[/url]
Advertisement
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.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


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.
Want to make Android Games?
Then check out the free RoboBrain SDK.
[size="2"][url="http://www.robobrain.org"]www.robobrain.org[/url]
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


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 :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement