Bug in updating user variables and SFSGames

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

Moderators: Lapo, Bax

vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 16:13

Hello,

I think there might be a bug when a user updates his user variables in the following scenario:
- Players 1 and 2 join the same room
- Player 1 sets a user variable indicating that he wants to create an SFSGame
- Server catches the variable update and creates an SFSGame with Player 1 as the owner
- Player 2 sets a user variable indicating that he wants to join the SFSGame above
- Server catches the variable update and joins Player 2 in the SFSGame above
- Player 2 sets a user variable indicating that he wants to leave the SFSGame
- Server catches the variable update and makes Player 2 leave the SFSGame
- BUG: Now whenever player 2 sets user variables, Player 1 does not receive the USER_VARIABLES_UPDATE event

It seems that when Player 2 left the SFSGame room then whenever he sets user variables the others can't see them.

Is this something that we might be doing wrong here?

Thank you,
Vaios
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 15 Jan 2013, 16:36

Why are you using UserVariables to send custom requests to the server?
You can directly invoke Extensions from the client side by using custom commands and any number of parameters.
Example:

Code: Select all

var params:SFSObject = ...
...
sfs.send(new ExtensionRequest("EnterGame", params));


UserVariables are broadcast to all other users causing a much larger update and waste of bandwidth.
Lapo
--
gotoAndPlay()
...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 16:40

I am not using user variables for every message. The steps I sent you are for a very specific scenario.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 15 Jan 2013, 16:44

Yes but it doesn't make sense to use UserVariables to invoke requests on the server side. UserVariables are for setting custom properties to a User and dispatch them to all clients.

You are not storing values, you are request actions, therefore you should use Extension calls.
If you need a quick tutorial on how this works check this video: http://www.youtube.com/watch?v=nKGxhwJ0 ... -X3Zw&lr=1
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 16:49

I appreciate your tips, however right now you are not helping me you are trying to make a different point. As I said, I am not using user variables instead of extension requests, in fact ignore the steps I sent you.

Here are some new steps:
- Players 1 and 2 join the same room
- Player 1 sends a request to the server to create an SFSGame
- Server creates an SFSGame with Player 1 as the owner
- Player 2 requests to join the SFSGame above
- Server joins Player 2 in the SFSGame above
- Player 2 requests to leave the SFSGame
- Server makes Player 2 leave the SFSGame
- BUG: Now whenever player 2 sets user variables, Player 1 does not receive the USER_VARIABLES_UPDATE event
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 15 Jan 2013, 16:51

It's no bug.
Two users are able to share their variables only when they are in the same Room(s)

That's why I am saying that you are using the wrong tool for your job, mate :wink:

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 17:05

So if user 1 is in 2 rooms and user 2 is in one of these rooms but not all of them then they won't be able to share user variables?

If so then this is problematic in our case, because all users are joined in one main room but they can simultaneously be joined in other rooms ( like minigame rooms, or chat rooms etc. ). When players walk around and interact with stuff they exchange messages AND user variables in some cases where properties need to be synced with other users in the main room. Again we are NOT using user variables to invoke server actions but we do need to sync user properties now and then.

Are you telling me that if a user is joined in this main room but also joined in a minigame then he won't be able to sync user properties with other players in the main room?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 15 Jan 2013, 17:12

Two users must be in at least one room together to receive their relative UserVars updates.
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 17:16

Ok so this looks like a bug then... Because at the end of my example Player 1 is joined in this main room AND the SFSGame room and Player 2 is only joined in the main room. They share one room in common ( the main room ) however Player 1 does not see user variable updates from Player 2
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 15 Jan 2013, 17:48

I am testing the same scenario with the latest SFS2X 2.5 and the Flash API 1.1.5 and no problem was found.
You didn't mention the version of the server in use nor the API type and version.

I would recommend the following:

1) Check that the users really are sharing one Room and that this Room has the USES_VARIABLES permission active
2) Make sure you are not using a super old version of the server and API
3) If so, please update, recompile the client and retry

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 17:54

I am using the 2.5.0 version of the server and the 1.0.6 version of the c# client. I will take a look at the issue again tomorrow and report back however the users are in the same room and that room has the USES_VARIABLES permission.
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 15 Jan 2013, 18:06

I should mention that the server code that makes Player 2 leave the SFSGame is inside a SysControllerFilter which might affect it?
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Bug in updating user variables and SFSGames

Postby vkalpias » 22 Jan 2013, 14:05

Sorry for the delay but this is related to a big system and it took a few days for us to debug and fix. From what I understand this was our fault as various exceptions were being thrown but due to a problem in our logger we didn't see the errors.

After fixing the logger we fixed all the errors and things went back to normal. Sorry for all the trouble!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bug in updating user variables and SFSGames

Postby Lapo » 22 Jan 2013, 14:30

Good, I am glad you were able to figure what was wrong.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 99 guests