Multi player functionality (long post)

Bas Hamstra

Member
Licensed User
Longtime User
I finished a concept Hangman game that works well on GS2 and 8" tablet. Now I want multi player functionality for my next turnbased game, let's say for simplicity it's chess or scrabble:

- get a list which unique userids are logged in into MyApp
- create a game
- send a move
- send a message
- store global (serverside) highscore
- store global (serverside) gamedata for a game like "the board"
- send a push notification move if a user is not online

this is what for example OpenFeint API seems to provide. Wouldn't a B4A gameserver with it's own API give B4a a boost? How hard would it be? Keep up with Corona I would say, it integrates to several game servers.

Ok, if I must reinvent the wheel, I got WAMP server up and playing with PHP and MySql. It works. I can fire a query online from anywhere. The first problem I ran into is: how do I get a list from unique UserID's that are logged in into MyApp? If I want to set up a game with a random player, I need this info. Same if I want to send a text message. How in the world could I know when they log out off the game with PHP/MySql?

I think a B4A multiplayer tictactoe example would fulfill a tremendous global wish :) I don't know much about libraries, but could the existing OF API be ported to a B4A library?

Best regards,

Bas Hamstra
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I can fire a query online from anywhere. The first problem I ran into is: how do I get a list from unique UserID's that are logged in into MyApp?
Whenever someone log-in you can update a table in the remote database. You can then easily find the logged in users. You can log out the users when they exit your application or after a defined period of inactivity.

Same if I want to send a text message. How in the world could I know when they log out off the game with PHP/MySql?
You can either poll the database for new messages or use GCM push services to notify the user about the new user.
 
Upvote 0
Top