oxxxo

How To implement leaderboard in phaser?

Recommended Posts

Hi im planning to add an online leaderboard to my game..

 

The player does not need to log in the game, they just play and once the game is finish

 

they will be ask for a name and submit that name along with the score to the leaderboard..

 

I had research some google REST API and some stuff are still quite confusing..

 

 

any help is appreciated.. thanks..

Share this post


Link to post
Share on other sites

Maybe with phaser's local var ?...

 

I never try.

I had already tried, storing it in local browser storage.. but this is not what really I wanted.. I want players to submit there score into some server .. and have there score ranked..

Share this post


Link to post
Share on other sites

I had already tried, storing it in local browser storage.. but this is not what really I wanted.. I want players to submit there score into some server .. and have there score ranked..

Okay.. Do you try anything with ajax ?

Share this post


Link to post
Share on other sites

- Don't trust the client, validate data when it gets to the server.

- Use JS function closure to hide sensitive data.

- Validate data as well on the client side. You may encript the data sent to the server with JS.

- Minimize the JS code you load in index.html in one js file. You could also obfuscate it, there are softwares for this.

- Use immediate anonymous function to close all you JS code in just two brackets "(function () {// my code here }())"

 

In the end I could do all things in JS/Firebug so again it all falls back to server validation.

Share this post


Link to post
Share on other sites

Forget about making your leaderboard secure. As long as your game is running on a client and not on the server it's just a matter of time until somebody submits a fake score.

 

The most effective things I usual do: Calculate a hash/checksum and make the score a little bit verifiable.

1. Calculate a hash for the data package you're submitting. This hash can be recalculated from an experienced attacker who reads your code and finds the secret key and salt. But hey this will prevent all the script kiddies from intercepting and modifying a highscore submission entry.

2. Calculate your highscore with a special algorithm, so that you're able to sort out all the fake entries. A far too simple example: Only allow highscore that are divisible by 7. Together with 1.) an attacker would have to do the following steps: Intercept the request, update the highscore with a number that is divisible by 7 and recalculate the hash. You could append other annoying things to make the liste even longer. If all those things are distributed throughout your entire project it's going to be very tedious to submit a modified score. 

3. Accept any manipulated highscore but mark it as fake. Now display it only to the attacker. The attacker will believe that he succeeded and maybe stop at this point.

 

Regards George

Share this post


Link to post
Share on other sites

You could use JQuery ajax. It has all necessary things from sending request to recieving response from the server. Both JQuery and Phaser are plain JavaScript so it will be just exchange of js object/functions/data/json.

 

http://api.jquery.com/jquery.ajax/

 

Not sure if there is some integrated support for Ajax in Phaser?

 

https://phaser.io/docs/2.3.0/Phaser.Net.html

Share this post


Link to post
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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.