Search code examples
androidlibgdxkryonet

Registering a user?


I need to create a login/register system for my game but I have no clue on how this is commonly done. I already have setup a working client/server system with Kryonet where I can push data over the network. Any user can log in but once he disconnects everything is lost. Eventually I want this to be compatible with a Facebook login but that is not necessary at the moment.


Solution

  • You have few options to do this, some of them:

    1. Use facebook login, just implement Facebook SDK and follow facebook developer guides to create login button and login/logout flow.

    2. On your server create simple php script which will get username and password as parameters and will save it to mySql database. Then create other script which will also get username and password as parameters and will return OK if user logged in successfully. You will need to send POST requests from your libgdx game to your php scripts on server. You will also need to save user password and username if he already logged in in previous game launches. In this cases you should send automatic login request to your server, other option is to handle the session.

    It is very basic description, I think if you don't have experience on client-server application try to work with facebook, their SDK is not the best one, but they do most job for you.