User variables update bug
User variables update bug
Hi,
Here is a scenario.
Step1
Player 1 joins game ( created by some unknown player).
Player 2 joins the same game.
When a player joins some public player variables are set. Like exactly where the player is sitting.
At this time both Player 1 and Player 2 know about each other variables.
Step 2
player 1 leaves, player 2 leaves.
Step 3
player 2 creates a game
player 1 joins the game
At this time player 1 have the old variables of player 2 , from the time when they were sitting on the 3rd party game.
My work around is this before I leave a game:
NSArray *users=[[self.client userManager] getUserList];
for (SFSUser *user in users) if (![user isItMe]) [[self.client userManager] removeUser:user];
Here is a scenario.
Step1
Player 1 joins game ( created by some unknown player).
Player 2 joins the same game.
When a player joins some public player variables are set. Like exactly where the player is sitting.
At this time both Player 1 and Player 2 know about each other variables.
Step 2
player 1 leaves, player 2 leaves.
Step 3
player 2 creates a game
player 1 joins the game
At this time player 1 have the old variables of player 2 , from the time when they were sitting on the 3rd party game.
My work around is this before I leave a game:
NSArray *users=[[self.client userManager] getUserList];
for (SFSUser *user in users) if (![user isItMe]) [[self.client userManager] removeUser:user];
-
A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: User variables update bug
This is the intended result. User Variables attach to the user and travel with that user from room to room. This allows you to for instance, get points or status in one game room and carry that to the next game room. You can listen for event (either on room leave or on room join) to clear those variables. Alternatively, you can use Room Variables instead which can be destroyed with the room.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
http://a51integrated.com / +1 416-703-2300
Re: User variables update bug
That I do understand. However to make the scenario clear.
But even if the variable values of player two do change, before he meets player 1 , player 1 never hears about those changes.
What I'm saying is that on the client side of Player 1 the variables for Player 2 does not change and does not match what is on the server.
After step 3 . Player 1 has Player two var 'SID=1', when the same var on thePlayer 2 client has SID=2 and the server shows SID=2 for player 2. Only player 1 does not get the proper variable.
I think what happens is when someone has the owner of the game in the USer manager, when they join their game the user variables does not update. This is the same bug that existed when the API was available as source code. I think there is a topic about from way back in Sept/Oct 2011.
But even if the variable values of player two do change, before he meets player 1 , player 1 never hears about those changes.
What I'm saying is that on the client side of Player 1 the variables for Player 2 does not change and does not match what is on the server.
After step 3 . Player 1 has Player two var 'SID=1', when the same var on thePlayer 2 client has SID=2 and the server shows SID=2 for player 2. Only player 1 does not get the proper variable.
I think what happens is when someone has the owner of the game in the USer manager, when they join their game the user variables does not update. This is the same bug that existed when the API was available as source code. I think there is a topic about from way back in Sept/Oct 2011.
Re: User variables update bug
That's correct, because there is no need to.But even if the variable values of player two do change, before he meets player 1 , player 1 never hears about those changes.
I think there is a bit of confusion. For starters in a Game Room each player is assigned a unique PlayerID so that any user can be identified correctly in terms of "seat", if you will.
If you need to store more information related to game state use Room Variables instead, so the data will remain linked to the Room.
User Variables are not the right tool to store date related to a specific game, because they are linked to the user itself which moves from one Room to another, during his session.
User variables between player1 and player2 should be synchronized when they meet again in the new Room, after the join event. This means that:Step 2
player 1 leaves, player 2 leaves.
Step 3
player 2 creates a game
player 1 joins the game
At this time player 1 have the old variables of player 2 , from the time when they were sitting on the 3rd party game.
Player2 is already in the Room. When Player1 joins he gets a USER_ENTER event. You should get the User object for player1 with the updated variables.
Player1 is joining the Room. He gets the ROOM_JOIN event, which in turn updates the user list for that Room, which in turn updates the player variables.
If this is not happening there might be a bug in the API.
Let us know.
Thanks
Re: User variables update bug
Player1 is joining the Room. He gets the ROOM_JOIN event, which in turn updates the user list for that Room, which in turn updates the player variables.
In that second scenario is where user vars for Player 1 are NOT synchronized on server and Player's 2 client.
In that second scenario is where user vars for Player 1 are NOT synchronized on server and Player's 2 client.
-
A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: User variables update bug
Do you have a test case you can send me? Any basic example that displays the issue would be great. thx.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
http://a51integrated.com / +1 416-703-2300
Re: User variables update bug
I am seeing a very similar issue. Would love to know if any comments have been made on this, or if you have seen anything similar.
User 1, and user 2 are in a room together.
User 2 sets a user variable named "foo" to value "A"
User 1 sees user 2 set "foo" to "B"
User 1 leaves the room
User 2 sets user variable named "foo" to value "A"
User 1 rejoins the rom
User 1 sees user 2's variable named "foo" with value "A". The expected value should be "B"
User 1, and user 2 are in a room together.
User 2 sets a user variable named "foo" to value "A"
User 1 sees user 2 set "foo" to "B"
User 1 leaves the room
User 2 sets user variable named "foo" to value "A"
User 1 rejoins the rom
User 1 sees user 2's variable named "foo" with value "A". The expected value should be "B"
Re: User variables update bug
Do you Unsubscribe from the group the room was created in? I this exact behaviour when I unsubscribe from the room group , and then when I leave a subscribe again.
Re: User variables update bug
Hi,
thanks, something is not clear here:
thanks, something is not clear here:
If User2 has just set his "foo" variable to "A" why would the other user see "B" instead?djacobs7 wrote: User 1, and user 2 are in a room together.
User 2 sets a user variable named "foo" to value "A"
User 1 sees user 2 set "foo" to "B"
Re: User variables update bug
@lapo, I did type that incorrectly. I highlighted my corrections
User 1, and user 2 are in a room together.
User 2 sets a user variable named "foo" to value "A"
User 1 sees user 2 set "foo" to "A"
User 1 leaves the room
User 2 sets user variable named "foo" to value "B"
User 1 rejoins the rom
User 1 sees user 2's variable named "foo" with value "A". The expected value should be "B"
@mmilien, I do leave the room, but I don't do anything with the room group
User 1, and user 2 are in a room together.
User 2 sets a user variable named "foo" to value "A"
User 1 sees user 2 set "foo" to "A"
User 1 leaves the room
User 2 sets user variable named "foo" to value "B"
User 1 rejoins the rom
User 1 sees user 2's variable named "foo" with value "A". The expected value should be "B"
@mmilien, I do leave the room, but I don't do anything with the room group
Re: User variables update bug
Ok, thanks. We'll run a local test and let you know.
Cheers
Cheers