How do I add a login/signin system?

0 favourites
From the Asset Store
Customize the animation of character when item changed
  • I want to create a leaderboard, and therefore users have to create an account (to automatically save their scores and send them to the leaderboard database). It is similar to the system used in Clash Royale, there is a leaderboard where you can see the users with the highest scores (trophies).

    I know there are many tutorials on how to add a login/signin system or a leaderboard in C2 using a MySQL database and AJAX, but I have red them all and they are all obsolete. I think the problem is you need to use mysqli instead of mysql, and the code in the PHP is different.

    I decided to follow the steps written in this tutorial to create the login system scirra.com/tutorials/525/si ... ase?page=2 and search the code for the new PHP in other tutorials (outside scirra toutorials) but none of them worked.

    In this tutorial on how to create a leaderboard scirra.com/tutorials/4839/c ... e-4?page=2 the updated code for the getscores.php was posted in the comments and it works fine, but there is stil the updated savescores.php missing.

    Could anybody kindly provide the missing codes or update the obsolete tutorials (most of them are many years old)? Not only for me, because there are many many people having the same problem. It is a very common problem.

    Thank you for your help <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

  • Actually, I'd go with rexrainbow 's firebase plugin.

    It's really awesome.

    It provides an actual account system where you can register with your e-mail address, get a proper username and connect that with a database.

    No need to learn SQL or anything.

    If you want, I can send you a .capx of how it works.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • randomly please send my to, capx file...

  • Thank you for your reply, randomly

    I didn´t know about this plugin, maybe you could post the .capx here, so everybody can download it.

  • Document, plugin and sample capx are included.

    Leaderboard (old document), but firebase does not have excellent query.

  • rexrainbow Thanks.

    db3344 ChesVCF Look at rex's .capx's, they are more compact and helpful.

  • Thank you, rexrainbow

    I downloaded all the plugins and the sample .capx, but when I tried to run it I got this error:

    Javascript error!

    Uncaught Error: FIREBASE FATAL ERROR: Cannot parse Firebase url. Please

    use https://<YOUR FIREBASE>.firebaseio.com

    htttp://localhost:5000/firebase.js, line 45 (col 272)

  • ChesVCF

    Try to register an account of firebase, then get your Firebase url

  • It worked, but now I have another error when trying to create an account rexrainbow:

    Javascript error!

    Uncaught Error: This custom Firebase server (`frebaseapp.com´) does not

    support delegated login.

    htttp://localhost:50000/firebase.js, line 158 (col 324)

  • I found the problem, I was instantiating my Firebase object with the wrong url. Firebase databases live at firebaseio.com. Firebase hosting sites live at firebaseapp.com.

    But now there is a last error:

    Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/

    I have looked for a solution in the Internet and I found this stackoverflow.com/questions/3801 ... m-must-use I think rexrainbow the plugin code has to be updated to the new SDK.

  • Please answer rexrainbow, I don´t know how to update the plugin's SDK

  • ChesVCF

    rex_firebase_authentication works fine, here is a sample capx to login by facebook or google.

    But first of all, Does your leaderboard (scoreboard ) show scores page by page?

    If the answer is yes, firebase might not be a good choice.

    Here are some other possible solutions:

    1. scoreboard of newgrond.io service

    2. leaderboard by backendless service

    3. leaderboard by parse/back4app service

  • rexrainbow

    I've been trying them all (your scoreboard and authentification plugins) but there's still two things I don't know how to do:

    1-I want all players to post their own scores to a server and then request the server (e.g.) the 10 best scores and show them in the leaderboard (it's not a list of the player's personal best scores, but a ranking with the best players with their highest score).

    2- And is it posible to save the player's score (or any variable) when they login (for example via Google) with your authentification plugin? This way they can recover the advance they made if they login to their account from another device.

    I use many of your plugins and I have a last question, do I have to add your plugins to my XDK Project before exporting the project with Intel XDK? And if yes, where can I get the plugin's ID?

    Finally, I also wanted to congratulate you for your amazing plugins, they are really helpful and add necessary features to C2

    Thank you also for your help and for your answer

  • ChesVCF

    1. To get first N (first 100) best scores, all of these 4 service (firebase/newground.io/backendless/parse(back4app) could do it.

    2. To auth by 3rd party service :

    • firebase : google, facebook, email&password
    • newground.io : only built-in
    • backendless : facebook, email&password
    • parse(back4app) : facebook, email&password

    3. I did not try exporting to Intel XDK before.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)