Multiple Rooms Chat Issue

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

Moderators: Lapo, Bax

burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 29 Mar 2017, 18:19

Lapo wrote:In any case, are you saying that in that long list of Rooms that you showed some other room is missing?
Or that there are too many Rooms and you expected to find less?


There are too many rooms. Like when the server moves the user from one room to another the local array is being updated to add the new room, but the previous room is not being removed.

(and we have gone through all of the room changes in the server to make certain that client notification = true.)
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 30 Mar 2017, 08:13

How do you manage leaving a previous Room exactly?

You said each player is joined in a Room and a Table at once. So typically you'd expect a player to be in 2 Rooms at once? Right?
What happens next?

Is the player allowed to leave the main Room?
I suppose he's also allowed to leave the current Table and join another one.

How are these operations handled? How do you leave one Room and join the next? Can you show me actual code?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 30 Mar 2017, 17:25

Lapo wrote:How do you manage leaving a previous Room exactly?

You said each player is joined in a Room and a Table at once. So typically you'd expect a player to be in 2 Rooms at once? Right?
What happens next?

Is the player allowed to leave the main Room?
I suppose he's also allowed to leave the current Table and join another one.

How are these operations handled? How do you leave one Room and join the next? Can you show me actual code?

Thanks


Thanks Lapo,

There are two ways players are removed from rooms.

(1) While in game they can hit a button that sends a client request to return to the lobby. This triggers an onleave event that removes them from the game and table rooms.

(2) While in a game, when the round ends the server moves people automatically based on if they win or lose. The code is posted on the other issue we've been having here: viewtopic.php?f=19&t=19318#p84210

You are correct, during ongoing gameplay the players are in two rooms. The entire purpose of two rooms is 1 room they can chat in, 1 room they can play in. The chat room has all the players in the game (up to 300), the game room (table) is only 4 players. During a game players are moved from table to table in-between rounds of play, using the code linked above.

There is no way for a player to leave a table and join another one on their own within an ongoing game and they do not get to select what tables they join, the server manages that.

Once a game starts, players are supposed to be able to chat via the chat room to everyone in the game. The client properly sends the messages to the chat room. Some players can see messages all players send to the chat room. Other players can only see the messages sent to players at their table. We have determined that the messages that cannot be seen ARE being relayed by the server and the client IS receiving them, however the SENDER is coming through from the client API code as "null".

Here is an excerpt from the client console:

110 [MainApp] Received chat message:
{message:Having trouble Mandy?, sender:null, room:[Room: Room_1, Id: 3, GroupId: RoomGroup], data:null}
111 [MainApp]
---------|----------------------------------------------------------------------------------------------------
ERROR | Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------


When the client received this message, it would have been in the following two rooms:

Room_1 (the "chat" room containing all of the game players.)
Room_1_Table_1 (the game play "table" room)

Thus as you can see from the console entry, Matt's client sent the message to the right room properly. The server relayed it properly. The client received it properly. But the API somehow stripped or failed to look up the sender.

This should not be possible and we really need a fix for it... It feels to me like the API only does the lookup in the "last joined room" rather than "all joined rooms". It should be quick and easy for the author to check and confirm if that is the case or not. We are happy to work directly via email or whatever preferred method to assist, but fixing the AS3 API is beyond our resources and expertise.
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 30 Mar 2017, 17:48

Another few thoughts, as we are fast approaching a deadline with this. We recently had a closed beta and this was by far the largest outstanding bug. We are supposed to be open beta in the next 1-2 weeks.

- Can you think of any work-arounds? Any way to force the client to listen and do the sender lookup for public messages on a specific room?

- Is the client api code closed source? Is there any way we can look through the code ourselves to see if we can figure it out?

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

Re: Multiple Rooms Chat Issue

Postby Lapo » 31 Mar 2017, 07:32

Thanks for details. It makes sense.

The entire purpose of two rooms is 1 room they can chat in, 1 room they can play in. The chat room has all the players in the game (up to 300), the game room (table) is only 4 players.

Here's a bit of a problem. A Room with 2-300 people sending public chat messages could be too much for some clients. Since public messages are broadcast to everyone you can do the math... 300 people each sending a message will generate 300x300 = 90000 messages.

This will generate lots of traffic and also visually it's impossible to keep up with all that text...

Please, check via the AdminTool > Dashboard that you don't have any dropped messages (see the stats in the right bottom corner of the dashboard)

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 31 Mar 2017, 07:33

burnside wrote:Another few thoughts, as we are fast approaching a deadline with this. We recently had a closed beta and this was by far the largest outstanding bug. We are supposed to be open beta in the next 1-2 weeks.

- Can you think of any work-arounds? Any way to force the client to listen and do the sender lookup for public messages on a specific room?

It's difficult to think of a workaround without knowing the source of the issue

- Is the client api code closed source? Is there any way we can look through the code ourselves to see if we can figure it out?

No, you can send us an email to support@... and we'll send you the sources.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 31 Mar 2017, 09:15

Lapo wrote:Please, check via the AdminTool > Dashboard that you don't have any dropped messages (see the stats in the right bottom corner of the dashboard)


Game isn't live yet. I get failures with only 2 players on the server. :) The message gets to the client. Just no sender coming through from the AS3 API plugin.

You're right that it could end up being a lot of traffic, but 300 players is the room max, we expect to average far less, and will adjust it if it becomes a problem.

I'll send an email shortly. Maybe I can find the issue in the AS3 code.

Thanks!
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 04 Apr 2017, 08:11

I've spent a lot of time going through the AS3 code to understand the public message userId lookups. It inspired me to try a few new things in the client.

First - I have been able to reliably replicate the issue now. I added some "chatter" from the NPC's when they join a game. Since we fill open seats with NPC's at every game start all I have to do now is:
1) Restart SFS server (just ensures I am joining before a game starts.)
2) Open client, join lobby, join game about to start.
3) At game start I only see the chatter from NPC's at my table. NOT from the 12 other NPC's at other tables. Console log confirms client received all 15 messages:

Code: Select all

249 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:[User: Yapping Moose-Heppner1, Id: 2, isMe: false], message:Yay! They let me play!, data:null}
250 [Main]      onUserVariablesUpdate
251 [Main]      vars = [UserVar: cid, type: Int, value: 3, private: false],[UserVar: aSt, type: Int, value: 0, private: false],[UserVar: cp, type: Int, value: 0, private: false],[UserVar: pSt, type: Int, value: 0, private: false],[UserVar: pRp, type: Int, value: 0, private: false],[UserVar: dMas, type: Int, value: 2, private: false],[UserVar: plI, type: Int, value: 0, private: false],[UserVar: pGb, type: Int, value: 0, private: false],[UserVar: g, type: String, value: M, private: false],[UserVar: pGB, type: Int, value: 0, private: false],[UserVar: gms, type: Int, value: 0, private: false],[UserVar: bun, type: Int, value: 0, private: false],[UserVar: wns, type: Int, value: 0, private: false],[UserVar: pid, type: Double, value: 12, private: false],[UserVar: frC, type: Int, value: 0, private: false],[UserVar: exp, type: Int, value: 0, private: false],[UserVar: pRl, type: Int, value: 0, private: false],[UserVar: pts, type: Int, value: 0, private: false],[UserVar: fid, type: String, value: 985210794929938, private: false],[UserVar: pf, type: Int, value: 6, private: false],[UserVar: pRw, type: Int, value: 0, private: false]
252 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:[User: BeanDip Marmot-Heppner1, Id: 3, isMe: false], message:Yay! They let me play!, data:null}
253 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
254 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
255 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
256 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
257 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
258 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
259 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
260 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
261 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
262 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
263 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
264 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
265 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
266 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
267 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
268 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
269 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
270 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
271 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
272 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
273 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
274 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------
275 [MainApp]      Received chat message:
{room:[Room: Heppner_1, Id: 6, GroupId: Heppner], sender:null, message:Yay! They let me play!, data:null}
276 [MainApp]      
---------|----------------------------------------------------------------------------------------------------
ERROR |   Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------


So there it is, super easy to replicate. Just start a new game, and even though I am in a room with 16 players, I only can see the 4 players in the other room I'm in.

Second, and maybe a better hint at what is going on... I noticed in a second game that I could see 7 messages. Still not all 15, but more than just the players at my table. I looked back through the logs and the 7 I could see were the other three at my table PLUS THE OTHERS THAT HAD BEEN AT MY TABLE IN THE PREVIOUS GAME. So once I "see" a player at a table with me, from then on the _usersById client hashmap will contain them. But for the overall room, they are not getting added to the _usersById hashmap.

So I think we're getting close here... what would cause failure to load the user list for a room? Looking at the room that is not loading the user list, we have PUBLIC_MESSAGES turned on, but do not have USER_ENTER_EVENT and USER_EXIT_EVENT. Are those necessary for the _usersById hashmap on the client to get populated?

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

Re: Multiple Rooms Chat Issue

Postby Lapo » 04 Apr 2017, 08:16

So I think we're getting close here... what would cause failure to load the user list for a room? Looking at the room that is not loading the user list, we have PUBLIC_MESSAGES turned on, but do not have USER_ENTER_EVENT and USER_EXIT_EVENT. Are those necessary for the _usersById hashmap on the client to get populated?

As I said in the other post you have sent. Yes this is the problem. If no USER_ENTER / EXIT event are allowed the client side won't get any updates about who is in the Room.

When a client joins Room A he gets the list of users that are in that Room at the time of joining. USER_ENTER and USER_EXIT are necessary to keep the room list up to date. By turning them off (by default they're always ON) you stop the update process.
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 05 Apr 2017, 19:33

Lapo wrote:Yes this is the problem. If no USER_ENTER / EXIT event are allowed the client side won't get any updates about who is in the Room.

When a client joins Room A he gets the list of users that are in that Room at the time of joining. USER_ENTER and USER_EXIT are necessary to keep the room list up to date. By turning them off (by default they're always ON) you stop the update process.


Great! Glad we got to the bottom of this. FWIW, I think the devs were trying to keep bandwidth consumption to a minimum and just wanted PUBLIC_MESSAGES on this room. I don't see it documented anywhere that PUBLIC_MESSAGES requires USER_ENTER/USER_EXIT. It would probably be good to mention everywhere you describe PUBLIC_MESSAGES in the docs that the other two are required for it to function. Could have saved us all a lot of troubleshooting hours.

Cheers.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 06 Apr 2017, 07:10

Good point. We'll add extra warnings in the docs.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 48 guests