Forum Multiplayer Question regarding lobby - custom message to server.

Discussion and help relating to the PlayerIO Multiplayer API.

Question regarding lobby - custom message to server.

Postby raRaRa » August 7th, 2010, 3:47 pm

Good day!

My question is easy and straight forward. Is it possible to send a custom message to the server when you're not inside a room?
I want to be able to send a few custom messages to the server to verify some things before I allow the client to see the lobby.

Any suggestions would be appreciated.

Thanks,
Jón Trausti.
raRaRa
 
Posts: 3
Joined: August 4th, 2010, 11:15 am

Re: Question regarding lobby - custom message to server.

Postby raRaRa » August 7th, 2010, 4:23 pm

I've solved this problem temporary by having two type of rooms:

    PreLobby - Pre conditions
    Lobby - Lobby conditions
That way I can do some kind of validations server-side before I enter the lobby.
raRaRa
 
Posts: 3
Joined: August 4th, 2010, 11:15 am

Re: Question regarding lobby - custom message to server.

Postby fox1980 » August 8th, 2010, 12:48 am

You can't send any message to the server when not in a room, cause the server instance only launches when you actually join a room. Your "workaround" is the right way to do it.
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: Question regarding lobby - custom message to server.

Postby TomatoGG » August 8th, 2010, 6:04 am

Something else u may consider is to create an invisible room for each user. There is a limit on the number of users per room but there is no limit on the number of rooms. Invisible rooms also does not show up on the room list. If the preconditions take a long time to complete, they won't block other users from coming in. The server or user can take more time to pick which normal room the user is to go into.
TomatoGG
 
Posts: 17
Joined: July 3rd, 2010, 11:15 am

Re: Question regarding lobby - custom message to server.

Postby Benjaminsen » August 8th, 2010, 10:18 am

raRaRa wrote:Good day!

My question is easy and straight forward. Is it possible to send a custom message to the server when you're not inside a room?
I want to be able to send a few custom messages to the server to verify some things before I allow the client to see the lobby.

Any suggestions would be appreciated.

Thanks,
Jón Trausti.


What are you trying to achieve? As in what kind of information is it that you want to have send to the server before showing the loggy?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Question regarding lobby - custom message to server.

Postby raRaRa » August 8th, 2010, 10:58 am

@ Benjaminsen:

Let me give you a brief example on what is happening when an user wants to play the game:

When an user wants to play the game, the server check his FacebookID against the database whether it exists or not. If it exists, then his Username is fetched from the database, or else he will get a registration popup window in the game where he has to type in his nickname that he wants to have (it will be unique for each user).

So when an user logins with a facebookID that has been registered, then he will get his nickname supplied to him.
In the lobby window I'd show his nickname and some statistics about him.

When a room is created I could broadcast to all players in the "Lobby" room about it, and when an user is leaving a room and sett-era.


Please let me know if this is a bad work-around to achieve this. If it's not, would there be a possible update for Player.IO so that with the Multiplayer class we could send custom messages to the server? And bind to Multiplayer messages?

Thanks.
raRaRa
 
Posts: 3
Joined: August 4th, 2010, 11:15 am

Re: Question regarding lobby - custom message to server.

Postby Benjaminsen » August 8th, 2010, 5:45 pm

Oki, as I understand it you wish to create a more complex registration service, which makes perfect sense.

As others suggest, using a separate server type for co-registration and migration would be the way to go with out services. We used a similar approach when we created the backend for the mball game.

I am not entirely sure what you are asking for with If it's not, would there be a possible update for Player.IO so that with the Multiplayer class we could send custom messages to the server? And bind to Multiplayer messages? but here is a few tips and tricks that should help you get going.

Read only BigDB table for migration status
If you create a read only BigDB table and store an entry for each user who have successfully migrated you can use it to quickly verify migration status both on the client and the server. IE when the user successfully connects with facebook you do a clientside lookup in the migration table. If no key exist for the current user you connect to your migration service who migrates the user and create the missing database entry.

If you do not relay on data stored by the clients you could use the PlayerObjects table for this purpose.

Distributing users between rooms
Should you wish to automatically distribute users into n amount rooms, just use the room id $service-room$ when connecting to the multiplayer server and your users will get distributed automatically.

Sending additional Auth data to the servers
You can use UserData to send extra Auth data to the servers when they connect. This could be an auth hash generated from your own servers or a special lobby room.

3rd party verification
Need 3rd party server-side verification, check out the Web API

Global Presence system
If you want a global system of who's online where, you can use my presence server example as a base.

/Chris


showroom/presence-server-example-t479
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to Multiplayer