Leaderboard creation

Post » Wed Oct 25, 2017 9:55 pm

Hi

I have a simple endless runner which creates a high score when the player dies.
I want the ability to post this high score into a MySQL database so the player can compete with others.
I don’t want them to have to login to submit scores.

Does anyone have any hints/tips?

Thanks in advance

Andy
B
2
Posts: 4
Reputation: 156

Post » Thu Oct 26, 2017 1:15 am

tygamarketing wrote:Hi

I have a simple endless runner which creates a high score when the player dies.
I want the ability to post this high score into a MySQL database so the player can compete with others.
I don’t want them to have to login to submit scores.

Does anyone have any hints/tips?

Thanks in advance

Andy


Without any login/authentication requirement, this is super-easy. We did something similar for one of our sims/games on www.simbucket.com. All you need is a AJAX POST request with the data to a php script running on the server. It is super-easy to spoof, with virtually no security, but we weren't really worried about that for our purposes because we could just reset the high score if someone decided to mess with the system.

If you are worried about making sure the high scores aren't tampered with, then you will need to do some sort of user authentication.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
58
S
22
G
26
Posts: 454
Reputation: 18,738

Post » Thu Oct 26, 2017 7:10 am

tygamarketing wrote:Hi

I have a simple endless runner which creates a high score when the player dies.
I want the ability to post this high score into a MySQL database so the player can compete with others.
I don’t want them to have to login to submit scores.

Does anyone have any hints/tips?

Thanks in advance

Andy


This should fit ;)
https://www.scirra.com/tutorials/346/on ... -php-mysql

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
114
S
42
G
31
Posts: 1,191
Reputation: 29,823

Post » Thu Oct 26, 2017 8:36 am

cjbruce wrote:
tygamarketing wrote:Hi

I have a simple endless runner which creates a high score when the player dies.
I want the ability to post this high score into a MySQL database so the player can compete with others.
I don’t want them to have to login to submit scores.

Does anyone have any hints/tips?

Thanks in advance

Andy


Without any login/authentication requirement, this is super-easy. We did something similar for one of our sims/games on http://www.simbucket.com. All you need is a AJAX POST request with the data to a php script running on the server. It is super-easy to spoof, with virtually no security, but we weren't really worried about that for our purposes because we could just reset the high score if someone decided to mess with the system.

If you are worried about making sure the high scores aren't tampered with, then you will need to do some sort of user authentication.


Thanks - I'm not worried about security - it's just to win a bottle of wine for a bit of Christmas fun.
I had a tutorial from Construct2, but it doesn't seem to work on 3, and I'm on a mac, so cannot install 2.
Did you manage to get it to work with V3?
B
2
Posts: 4
Reputation: 156

Post » Thu Oct 26, 2017 8:38 am

AndreasR wrote:
tygamarketing wrote:Hi

I have a simple endless runner which creates a high score when the player dies.
I want the ability to post this high score into a MySQL database so the player can compete with others.
I don’t want them to have to login to submit scores.

Does anyone have any hints/tips?

Thanks in advance

Andy


This should fit ;)
https://www.scirra.com/tutorials/346/on ... -php-mysql

Regards
Andy


Hi Andy

Thanks - Does this work on 3 though? I tried this from this article
https://www.scirra.com/tutorials/4839/c ... -php-mysql

But it's not working on Construct3
It doesn't load the scores from the PHP file, and doesn't allow me to submit a score.

Thanks
Andy
B
2
Posts: 4
Reputation: 156

Post » Thu Oct 26, 2017 9:44 am

As mentioned in the comments of the tutorial, is your server using PHP 7 ?

If so, you need to modify a few lines of the script in order for it to correctly connect with your MySQL database.

Note: Otherwise, check for errors in your browser, this will give exact clues as to what is going on.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
304
S
123
G
98
Posts: 7,357
Reputation: 72,958


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest