Forum Multiplayer Does the code run separately for each client?

Discussion and help relating to the Player.IO Multiplayer API

Does the code run separately for each client?

Postby MrBiscuits » January 4th, 2012, 3:06 pm

I'm making a single player game that uses BigDB and PayVault, so I want the C# game code to run separately for each client.

Does this happen even if there are more players in the same room? Should I create a new room for each player or put everyone in the same room?
MrBiscuits
Paid Member
 
Posts: 26
Joined: May 15th, 2011, 8:09 pm

Re: Does the code run separately for each client?

Postby Henrik » January 4th, 2012, 3:31 pm

You should use service-rooms, that way you don't have to worry about placing users in rooms that have an open spot. In your serverside code you can just ignore AllowUserJoin and the UserJoined methods, never send messages to other players in the same room, and just react to and respond to messages.
User avatar
Henrik
.IO
 
Posts: 575
Joined: January 4th, 2010, 1:53 pm

Re: Does the code run separately for each client?

Postby MrBiscuits » January 5th, 2012, 10:09 pm

Thanks for the reply.

Does this mean that you can store current game information specific for the player on the server?
ie. variables regarding game state could be put in the GameCode class for example.
MrBiscuits
Paid Member
 
Posts: 26
Joined: May 15th, 2011, 8:09 pm

Re: Does the code run separately for each client?

Postby Henrik » January 6th, 2012, 10:50 am

Yes, but if it's per player you should probably store it in the Player class. :-)
User avatar
Henrik
.IO
 
Posts: 575
Joined: January 4th, 2010, 1:53 pm


Return to Multiplayer



cron