Page 1 of 1

Can't access to updated roomVars values after joining room

Posted: 26 Jun 2012, 17:19
by artificium
We' re developing a multiplayer game with 4 players rooms and we need saving some informations, like the positions chosen by players, via roomVars.

Every client, waiting for join a game, may visualize a list of the others available rooms and, in case, choose a particular position (from 1 to 4).

We're facing some problems trying to update the list and especially the positions already selected. In fact:

- after a player choose his favorite position, the others outside the room should be updated. Using getAllRooms() function we can "read" the new rooms list, but we are not
able to access to the updated roomVars values. Using getRoomList() instead we get updated roomVars but also a lot of warnings/errors, how explained in several topics, for
multiple calls to that function.

- to avoid such problem, we decided to move createRoom() and joinRoom() on the server side via extension. Also in this case we're in trouble because joinRoom(), unlike as
described in the manual, don't succeed in updating the clients outside the room. Our hope is that, after the join call, the server could update the other clients with
the updated values of roomVars.

We are italians developers (excuse our English :oops: ) and we hope to have been clear in our problem's explanation, let us know if you need further informations or code examples.

Best regards

Re: Can't access to updated roomVars values after joining ro

Posted: 26 Jun 2012, 18:43
by rjgtav
Hi.
Updating the whole roomList isn't a good idea, as it wastes lots of network resources, which will have a major impact on the server's performance.
- to avoid such problem, we decided to move createRoom() and joinRoom() on the server side via extension. Also in this case we're in trouble because joinRoom(), unlike as
described in the manual, don't succeed in updating the clients outside the room. Our hope is that, after the join call, the server could update the other clients with
the updated values of roomVars.
Yes, moving the logic to the server-side is always the best way to make sure everything works as expected. Where does the joinRoom() method fail in updating the users? What do you want to get updated to which users?
When you join a room, the server only updates the current client of the new variables, not all the other users, and just informs them that a specific user left the room, nothing more.

In your case, I think the best option would be to, when you update those positions, you also send an update to all the users inside the Lobby room (by using a server-side extension). If those updates are very frequent (more than 1 time a second), you can even group them and send them in packs, which will decrease some of the load.

Re: Can't access to updated roomVars values after joining ro

Posted: 03 Jul 2012, 08:50
by artificium
Hi,
thanks for the reply and sorry for the delay. We're trying to implement your suggestion, as for now it's working good.
We let you know asap, best regards.