Limbo vs Regular room for more complicated Lobby?
Posted: 12 Apr 2011, 23:09
Hi everyone. I am currently designing a classic turn based "lobby with rooms" game with some specific features in mind, so I have few questions.
When user log in, he will enter the lobby, and will be notified about the game rooms currently present in that lobby. He should be able to see new rooms when they are created in the lobby, as well as he shouldn't see them when they are destroyed. So far so good - it is job that can be handled with limbo room type, because it process events onRoomAdded and onRoomDeleted.
But I need one more feature - I want users who wait in lobby to see changes in some of the room properties (for rooms that belong to that lobby of course). For example, I want them to see current number of users in each game room, and I want him to be notified when number of users change.
For this type of requirement limbo room is not enough, because it doesn't receive joinRoom/leaveRoom events. I have two solutions for this problem in mind:
a) I could use regular room type for lobby, and process joinRoom/leaveRoom events in internal event handler (in extension assigned to lobby room). From there I could send updated room list to all users that are currently in lobby. This should work if regular room extension (assigned to lobby) receives joinRoom/leaveRoom events for all rooms in the zone. If that is not the case, then this solution will not work.
b) I could poll from client side on every 30 seconds (or so) for game room list if client is in the lobby. That way client would have relatively updated room info. Frankly, I don't like this solution, because it's not elegant, and I hate polling as idea
Not to mention possible security consequences...
So my question is: Would solution a) work in the first place? If it will work, what do you think is better way to achieve wanted result performance wise? Do you have any other ideas how to solve given problem?
Thanks in advance!
Sarevok
p.s. I could use zone level extension to achieve solution described under a) but I hope I can avoid that
When user log in, he will enter the lobby, and will be notified about the game rooms currently present in that lobby. He should be able to see new rooms when they are created in the lobby, as well as he shouldn't see them when they are destroyed. So far so good - it is job that can be handled with limbo room type, because it process events onRoomAdded and onRoomDeleted.
But I need one more feature - I want users who wait in lobby to see changes in some of the room properties (for rooms that belong to that lobby of course). For example, I want them to see current number of users in each game room, and I want him to be notified when number of users change.
For this type of requirement limbo room is not enough, because it doesn't receive joinRoom/leaveRoom events. I have two solutions for this problem in mind:
a) I could use regular room type for lobby, and process joinRoom/leaveRoom events in internal event handler (in extension assigned to lobby room). From there I could send updated room list to all users that are currently in lobby. This should work if regular room extension (assigned to lobby) receives joinRoom/leaveRoom events for all rooms in the zone. If that is not the case, then this solution will not work.
b) I could poll from client side on every 30 seconds (or so) for game room list if client is in the lobby. That way client would have relatively updated room info. Frankly, I don't like this solution, because it's not elegant, and I hate polling as idea
So my question is: Would solution a) work in the first place? If it will work, what do you think is better way to achieve wanted result performance wise? Do you have any other ideas how to solve given problem?
Thanks in advance!
Sarevok
p.s. I could use zone level extension to achieve solution described under a) but I hope I can avoid that