Reading full list of players from multiple Game Rooms, while being in a Lobby Room.

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

valr2
Posts: 6
Joined: 29 Jun 2022, 09:23

Reading full list of players from multiple Game Rooms, while being in a Lobby Room.

Postby valr2 » 06 Feb 2023, 19:58

Hello!

I'm trying to implement a casino lobby in which I can look around and see multiple tables (up to 50, because they are partitioned by floors) and be able to render all player profiles around all those tables, as they come and go, in real-time.

So my user is in the Lobby, which is implemented as a dedicated Lobby Room. There are other people in the Lobby and I see them as fellow users in this Lobby Room, we can all chat together and display a list of users in the Lobby, and that's fine.

However, the majority of users are not in the Lobby, but are sitting at some tables. Each table is a separate Game Room, and users playing in there are Players in that Room.

All the rooms from this floor belong to a single Rooms Group, let's call it "Floor0".

While I'm in the Lobby, I can switch between multiple floors, but let's say I'm at Floor 0 for now. So I will subscribe (SubscribeRoomGroupRequest) to "Floor0" Group, to be able to access data on all Game Rooms from my floor, while still in the Lobby. "Floor0" has also been set via setPublicGroups() on SFS-side as being a public group, so I can subscribe to it. Now I should be able to see all Rooms on this Floor, and indeed I see them. I also see up-to-date "userCount" numbers for each room, if I add a listener for USER_COUNT_CHANGE.

But what I couldn't do is to see all the actual players, with their names and profile data, from all these rooms. Any chance I could do that? I've tried calling getPlayersList() or getUsersList() on the rooms from by "Floor0" group, but they are both empty, although userCount reports a number > 0.

Thanks!
Valentin
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Reading full list of players from multiple Game Rooms, while being in a Lobby Room.

Postby Lapo » 07 Feb 2023, 09:47

Hi,
by default you are only able to see other player's data in Rooms you have joined.
This is to avoid generating too much traffic towards clients. Example: if a Room Group has 40 Rooms with 10 players each, it would need the server to send updates about all those 400 players to everyone, which is a lot of traffic. Just to keep each User updated about everyone else.

In any case you could still implement a way for viewing who's inside other Rooms with Extension calls. Instead of having the server continuously send updates about everyone, this should be implemented on a per-request basis.

In other words when the player wants to see the details of who's in a specific Room you can send an Extension request, fetch the data and show it to that User.

Makes sense?
Lapo
--
gotoAndPlay()
...addicted to flash games
valr2
Posts: 6
Joined: 29 Jun 2022, 09:23

Re: Reading full list of players from multiple Game Rooms, while being in a Lobby Room.

Postby valr2 » 07 Feb 2023, 15:05

Hi!

Yes, it does make sense. I was also concerned about the heavy traffic, that's why we limited the number of rooms by floor.

So ok, I will implement a custom system via Extension Requests. I just wanted to check with you first if there is a native way to do it via the Group subscription method.

Thanks for the answer!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 54 guests