Client Not Seeing Players

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

owen
Posts: 4
Joined: 17 Sep 2015, 08:31

Client Not Seeing Players

Postby owen » 17 Sep 2015, 11:13

Hello all,

I am currently developing a multiplayer game with a simple room structure where each room can have up to 4 players. Development is going great and we have server-side extensions attached to the Zone to control various different aspects of the game and manage timing, scores, etc for individual rooms. However, I have hit a really confusing issue that I simply cannot resolve after several hours of debugging.

We have a 'play again' button once our game has ended, which will trigger the client to leave their current room, join the lobby and then search for a suitable room to join again (a process that is specified in our extension). Their previous room has a variable set on it stating it is playing/ended, thus meaning it will not match as a suitable room when re-searching for another game. This process all happens when a user first launches the game, and it works every time they first load the game.

So the bug happens in the following use case: I am have a room of 4 players that have just played the game and everything is working correctly - all 4 players can see each other and see their scores are updating. I click play again to do as stated above and join a new room. Then the next 3 players also click play again in sequence and will also appear on player 1's screen to show they have joined. The game starts. The following happens: -

Player 1 can only updates from himself and player 4
Player 2 can see updates from himself, 1 and 4
Player 3 can see updates from everyone
Player 4 can see updates from everyone

The issue here is that the client-side smartfox API cannot see those players and so will not show the updated scores etc for them, even though it saw them join and made them appear (including their variables and usernames). Here is an warning that the console outputs: -

Code: Select all

[WARN] UserVariablesUpdate event, unknown User id: 175


Other notes: We can see the server extension destroys and creates rooms exactly as expected and that all expected players are always sitting in their respective rooms, including on play again. There are no errors in the server log from SmartFox and there does not seem to be any known errors in our client-side code. We are running the latest SmartFoxServer 2X version. The JavaScript output of smartfox.userManager.getUserList() will output only the users the client can see, as stated above.

Could anybody perhaps help shed some light on this issue? Somehow the JavaScript API is not in sync with the server when I relaunch the application. Any suggestions for trying to get to the bottom of this will be greatly appreciated. Please let me know if there's anything else I haven't mentioned that might be able to help figure out what's going on.

** UPDATE **
Logging the sfs.userManager.getUserList() everytime a user enters the new room shows something interesting. The creator of the room (and the next player) seem to get a bit confused and return a user list of their old room, rather than the room they have just joined. Note-worthy for the edit - hoping it could lead somewhere.

Regards,
Owen Ayres
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client Not Seeing Players

Postby Lapo » 18 Sep 2015, 07:52

Hi,
do you allow Users to join multiple Rooms at once?

My first suggestion would be to check with the AdminTool that all 4 players are in the game Room the 2nd time, as expected.

This error:

Code: Select all

[WARN] UserVariablesUpdate event, unknown User id: 175

is saying that a UserVar update has arrived to the User but he doesn't see any User with that ID.
Now, the server is sending that update because it does know that the sender and receiver are in at least one common Room, so it's kind of weird that the client is clueless.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
owen
Posts: 4
Joined: 17 Sep 2015, 08:31

Re: Client Not Seeing Players

Postby owen » 18 Sep 2015, 10:44

Hi Lapo,

Thanks for getting back to me promptly - much appreciated.

The server was not configured to have 1 room per user, so I've added that in now. I am guessing the only place this needs to be specified is in the zone configuration? I have also checked that all 4 users are in the same room on play again via the Zone Monitor (including server traces), and they are. The issue still seems to persist with the changes in place unfortunately.

Is there anything else you could suggest, or would you like to know anything else that could result in a solution? Thanks once again!

Regards,
Owen Ayres
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client Not Seeing Players

Postby Lapo » 18 Sep 2015, 11:26

owen wrote:Hi Lapo,

Thanks for getting back to me promptly - much appreciated.

The server was not configured to have 1 room per user, so I've added that in now. I am guessing the only place this needs to be specified is in the zone configuration?

Wait no, that's not what I meant. I was just asking if your application allows users to be in more than 1 Room at a time? Just to understand.

I have also checked that all 4 users are in the same room on play again via the Zone Monitor (including server traces), and they are. The issue still seems to persist with the changes in place unfortunately.

Is there anything else you could suggest, or would you like to know anything else that could result in a solution? Thanks once again!

So, let's recap:
- 4 players join a Room and play together the 1st time without problems.
- The game ends and the players leave the game Room, and join another one...

Questions:

1) Are the 4 players joining the same new Room? If so, why can't the just remain in the present Room and start a new match?
2) Can you tell me the version of the HTML5 (I presume) API that you're using. You can trace to the console the SFS2X.SmartFox.version

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
owen
Posts: 4
Joined: 17 Sep 2015, 08:31

Re: Client Not Seeing Players

Postby owen » 18 Sep 2015, 12:10

Hi Lapo,

The application should not allow users to be in more than one room at a time (this was a setting I hadn't got round to applying), so I have changed it in the zone config to say 1 room per user now.

The 4 players are all joining the same new room - each of them console log their room and they are all the same, the server traces has the same room with all four players correctly in this new room and the zone monitor says there's only this new room and the lobby existing, with all four players sitting in the new room. The old room is automatically removed when the last player clicks play again.

1) Players actually go back to a searching for players screen when they click play again. They could play against anybody else again in a new room, but in our local environment we are just using the same 4 players for testing.
2) Correct, the client-side HTML5 API version is 1.2.0

Thanks again

Regards,
Owen Ayres
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Client Not Seeing Players

Postby Bax » 18 Sep 2015, 13:40

I just did a simple test with a slightly modified version of the Game Lobby example we distribute in the HTML5 examples pack.

1) four players enter the lobby
2) player one creates a room and joins it
3) the other three players join it too
4) one at a time, all the players set a test user variable to a random number: they are all notified of each other's user variables update
5) player one leaves the room and creates and joins a new one
6) the other three players leave the room they are in and join the new one
7) again, all the players set the test user variable and they all receive the update event

Everything seems to work as expected.
If you send us an email, I can send back the test project, so you can test it by yourself and spot any differences.
Paolo Bax
The SmartFoxServer Team
owen
Posts: 4
Joined: 17 Sep 2015, 08:31

Re: Client Not Seeing Players

Postby owen » 18 Sep 2015, 13:55

Hi Bax,

Thanks for the reply. Hmm, that sounds promising. Could we get that example sent over please? Would you like me to email the info address on your website?

Thanks,
Owen Ayres
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Client Not Seeing Players

Postby Bax » 18 Sep 2015, 14:00

owen wrote:Would you like me to email the info address on your website?

Yes please.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 18 guests