I've written an app that uses UserVariables to store user data. The first UserVariable is set before joining any room and works great - all users see that the user has the variable.
When one user creates a game room and sets two more UserVariables in the game room - they seem to work OK. They exist in the admin tool and the user receives a USER_VARIABLES_UPDATE event. However, when a second user joins that game room from the lobby and iterates through the existing users, the only UserVariable that exists for the first user is the UserVariable set before joining any rooms.
I know the UserVariables are there, since if a third user launches the app, joins the zone and enters that game room, the UserVariables appear for that same user when iterating the user list.
Does anyone have a reason that this would happen or is there is a bug in the client API (AS3)?
Possible UserVariable Bug
Hi Lapo, stix, is there any update to this issue? I'm getting a similar issue with my development. In my case, it happens like this:
1. Player A joins Room 1
2. Player B joins Room 1
3. Player A joins Room 2
4. Player B joins Room 2
5. Player B joins Room 1 and moves to (100, 100)
6. Player A joins Room 1
... but player A still thinks player B is on the previous coordinate. From this point onwards, it seems that whatever Player B sets as user variable doesn't get updated in Player A BEFORE Player A joins Room 1.
One thing that I noticed is that the coordinate is changed when inspected from the admin panel, but using the User.getVariable("x") shows that the value hasn't been updated.
Is this a known issue?
1. Player A joins Room 1
2. Player B joins Room 1
3. Player A joins Room 2
4. Player B joins Room 2
5. Player B joins Room 1 and moves to (100, 100)
6. Player A joins Room 1
... but player A still thinks player B is on the previous coordinate. From this point onwards, it seems that whatever Player B sets as user variable doesn't get updated in Player A BEFORE Player A joins Room 1.
One thing that I noticed is that the coordinate is changed when inspected from the admin panel, but using the User.getVariable("x") shows that the value hasn't been updated.
Is this a known issue?
On closer inspection, I can really confirm that the user variables on other rooms don't get saved, or at least sent with the correct values (upon joining that room) in all of the following methods:
(a) room.userList
(b) user.getVariables()
(c) user.getVariable()
(d) SmartFox.userManager.getUserList()
... even though the admin reports the correct values.
I also tried adding a keyboard shortcut that would trace the user list using SmartFox.userManager.getUserList() from the point of view of Player A and noticed the following:
1. Player A joins Room 1 - (d) returns 1 user
2. Player B joins Room 1 - (d) returns 2 users
3. Player B joins Room 2 - (d) returns 1 user
So far so good, but this is where the issue appears:
1. Player A joins Room 1 - (d) returns 1 user
2. Player B joins Room 1 - (d) returns 2 users
3. Player A joins Room 2 - (d) returns 2 users (what???)
Can someone please advise?
(a) room.userList
(b) user.getVariables()
(c) user.getVariable()
(d) SmartFox.userManager.getUserList()
... even though the admin reports the correct values.
I also tried adding a keyboard shortcut that would trace the user list using SmartFox.userManager.getUserList() from the point of view of Player A and noticed the following:
1. Player A joins Room 1 - (d) returns 1 user
2. Player B joins Room 1 - (d) returns 2 users
3. Player B joins Room 2 - (d) returns 1 user
So far so good, but this is where the issue appears:
1. Player A joins Room 1 - (d) returns 1 user
2. Player B joins Room 1 - (d) returns 2 users
3. Player A joins Room 2 - (d) returns 2 users (what???)
Can someone please advise?
We need a clarification here:
At #5 Player B joins Room1, but he has already done that in #2. Which one is correct?
EDIT: Sorry, maybe I've interpreted this wrongly. You mean that when B joins Room2 he leaves Room1
1. Player A joins Room 1
2. Player B joins Room 1
3. Player A joins Room 2
4. Player B joins Room 2
5. Player B joins Room 1 and moves to (100, 100)
6. Player A joins Room 1
At #5 Player B joins Room1, but he has already done that in #2. Which one is correct?
EDIT: Sorry, maybe I've interpreted this wrongly. You mean that when B joins Room2 he leaves Room1
We did a series of brief tests but we don't see any problems when switching rooms. Variables are transmitted and received correctly. Additionally UserVariables are Room-agnostic, they don't depend on the Room in which you are in (in fact you can update your vars even outside of any Room).
As regards the main userManager we can reproduce that. I am not sure if it's a real bug at the moment. The global user manager works slightly differently than the Room's user manager (and it's not even particularly useful for the developer)
Typically you will always access the user lists via the Room objects, grabbing the room list from there.
Thanks
As regards the main userManager we can reproduce that. I am not sure if it's a real bug at the moment. The global user manager works slightly differently than the Room's user manager (and it's not even particularly useful for the developer)
Typically you will always access the user lists via the Room objects, grabbing the room list from there.
Thanks
Hi Lapo,
I can see your point, but I can still confirm that the user variables don't get updated when retrieving the userList from the room parameter upon joining that room.
To illustrate the problem, I've developed a simple Flex app that will show you how user variables don't get updated. You can download the ZIP file from here:
https://www.yousendit.com/download/MzZH ... NEpFQlE9PQ
(sorry it's 2.6MB as it includes spark, etc.)
Just run the UserVariableTest.swf under the bin-debug folder twice to simulate two players. Then follow these steps:
1. Player 1 (1st window) joins Room_A
2. Player 2 (2nd window) joins Room_A
3. Player 2 joins Room_B (note: on Player 1 window, the userManager.getUserList() list only shows Player 1)
3. On Player 2 window, select Player 2 (0, 0) <<< ME and change the x or y values and press Update
4. Player 1 joins Room_B
5. You'll see that on Player 1 window, Player 2 has the right coordinate
Now this is where the problem happens:
6. Player 1 joins Room_A
7. Player 2 joins Room_A
8. Player 2 joins Room_B (note: on Player 1 window, the userManager.getUserList() list shows both Player 1 and Player 2)
9. On Player 2 window, select Player 2 (0, 0) <<< ME (if it's not already selected) and change the x or y values and press Update
10. Player 1 joins Room_B
11. Now you'll notice that on Player 1 window Player 2 still have the old coordinates
Having the user variables updated on join room is an important logic in our game, because we need to determine the latest position of each players already on the new room. I'm sure everyone shares this same logic in their applications. So my question is whether this is a known bug that is already picked up and being worked on, or am I doing something really wrong here?
I've included the complete source for the Flex app in case you want to have a look at my implementation.
I can see your point, but I can still confirm that the user variables don't get updated when retrieving the userList from the room parameter upon joining that room.
To illustrate the problem, I've developed a simple Flex app that will show you how user variables don't get updated. You can download the ZIP file from here:
https://www.yousendit.com/download/MzZH ... NEpFQlE9PQ
(sorry it's 2.6MB as it includes spark, etc.)
Just run the UserVariableTest.swf under the bin-debug folder twice to simulate two players. Then follow these steps:
1. Player 1 (1st window) joins Room_A
2. Player 2 (2nd window) joins Room_A
3. Player 2 joins Room_B (note: on Player 1 window, the userManager.getUserList() list only shows Player 1)
3. On Player 2 window, select Player 2 (0, 0) <<< ME and change the x or y values and press Update
4. Player 1 joins Room_B
5. You'll see that on Player 1 window, Player 2 has the right coordinate
Now this is where the problem happens:
6. Player 1 joins Room_A
7. Player 2 joins Room_A
8. Player 2 joins Room_B (note: on Player 1 window, the userManager.getUserList() list shows both Player 1 and Player 2)
9. On Player 2 window, select Player 2 (0, 0) <<< ME (if it's not already selected) and change the x or y values and press Update
10. Player 1 joins Room_B
11. Now you'll notice that on Player 1 window Player 2 still have the old coordinates
Having the user variables updated on join room is an important logic in our game, because we need to determine the latest position of each players already on the new room. I'm sure everyone shares this same logic in their applications. So my question is whether this is a known bug that is already picked up and being worked on, or am I doing something really wrong here?
I've included the complete source for the Flex app in case you want to have a look at my implementation.
Who is online
Users browsing this forum: No registered users and 101 guests