Now i think it's time to make my games more intresting with some nice features.
What i am thinking about is a friend system! Based on a database and php.
Games are created for Android.
Now, i am going to think out loud and write down my way of doing it. All information and or suggestions are welcome!
So.. The idea is simple. Every player creates a username that is writting into a mysql database with the username and a id.
Now. To make a friend request you simply type in the name and press add.
Now somehow the id of that player has to be written into a webstorage.
This way you could also make a online/offline status.
Once you go to your friendpage AJAX will check on the user id if they are online.
This will be done by setting "online" to 1 every 20 seconds by AJAX. A cron on the server will set "online" to 0 every 10 minutes of all users.
This way you get a pretty accurate online/offline system with 20 seconds wrong indications maximum.
This way you can see if your just added friend is online or offline.
Now. The problem is i have no clue how to do this for mulitple friends.
One friend would be possible the way i explained above. You can just name your webstorage "friendID".
Now, with multiple friends this way is not possible.
Or the webstorage has to be written as a array or something but i would have no clue how that works.
Again, all suggestions are welcome!
Thanks in advance!