Problems with switching room maps

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Problems with switching room maps

Post by atarim »

I have a situation where a map is shown on screen and I try to load a new map and replace the former.

I seem to do everything that is neccessary to switch room (and map), including changing room on server (had to do it server side), loading the new room and map assets and calling "loadMap" with the new room id.

The result is the screen turning white (but without any exception) and every attempt to call the component afterwards, follows with a null reference exception in the SmartFoxClient.

I must say that the SFS admin shows a complete transfer to the new room.

What am I missing in the process?
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

Maybe this Log can help (including loading the first and the second map):

Code: Select all

[INFO] Configuration loaded: resources/config/OpenSpace.xml
[INFO] Requesting initialization data to OpenSpace Extension
[INFO] Initialization data received from OpenSpace Extension
[INFO] Initialization completed
[INFO] Requesting map to OpenSpace Extension
[INFO] Map received from OpenSpace Extension
[INFO] Map parsing completed (13 ms)
[INFO] Tiles creation progress: 19%
[INFO] Tiles creation progress: 36%
[INFO] Tiles creation progress: 55%
[INFO] Tiles creation progress: 77%
[INFO] Tiles creation progress: 100%
[INFO] Map generation completed (86 ms)
[INFO] Map rendering duration: 5 ms
[INFO] Map shifted
[INFO] Avatars creation completed
[INFO] Map rendering completed
[INFO] Avatar '159' created in (3,16,0)
[INFO] Path to (0,1,0) coordinates received for avatar 159
[INFO] Requesting map to OpenSpace Extension
[INFO] Map received from OpenSpace Extension
[INFO] Avatar '159' removed
[INFO] OpenSpace was reset
[INFO] Map parsing completed (3 ms)
[INFO] Tiles creation progress: 19%
[INFO] Tiles creation progress: 35%
[INFO] Tiles creation progress: 51%
[INFO] Tiles creation progress: 72%
[INFO] Tiles creation progress: 100%
[INFO] Map generation completed (81 ms)
[INFO] Avatars creation completed
[INFO] Map rendering completed
[INFO] Avatar '159' created in (5,18,0)
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Problems with switching room maps

Post by Bax »

Did you check the server-side logs? No errors?
Also, is the map (including background and foreground) size equal to the viewport size? In this case there's a known issue which causes the map not to be show. Try making the viewport 1 pixel smaller than the overall map size.
Paolo Bax
The SmartFoxServer Team
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

No errors on server during the room change.

To keep it simple I used the same background swf but built a new server ".map" file for the new room to exclude the skins. Therefore I think it is not the viewport (the first room loads without any problem).

One think to notice is the luck of the component to respond after the map loading. Any attempt to send a public message to show in the avatar message balloon is refused with null reference exception.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

I suspect this is caused by manual room joining. Why don't you let OpenSpace join the new room?
Paolo Bax
The SmartFoxServer Team
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

I guess you meant letting SmartFox manage room join. I can't - I have to do it manually on server to associate users with parallel worlds rooms.

I tried server side "sendAvatarToMap" but with the same results.

I have to find a solution for this.
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

Hi Paolo!

As I suspected it was only a matter of invalidating the OS component after the new map is loaded, which means there is a small thing to fix with the component.

With the help of the very effective DeMonster Debugger I could notice that if I change the component width (invalidating it by doing that) the room suddenly appears and everything works just great.

By now I can invalidate the component myself, but that's just an hotfix and it would be great if the component does that by itself.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Actually we are not able to reproduce this issue.
Paolo Bax
The SmartFoxServer Team
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

I'll try to simplify the process:
1. Join a room and initiate and connect the OS client.
2. Send an extension message and change the user's room at server.
At this stage the OS still shows the old room.
3. handle the extension response in the client and tell OS to load the map of the newly entered room.
At this stage you will notice that the process of loading the map logs as if everything went OK, but the OS client faded to white.
4. In that stage, if you do something like changing the width of the OS client, it will show the new room.

Tell me if you were able to reproduce the issue.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

We can reproduce this issue only if new the map has the same exact size of the viewport. Also in this case, it seems to happen randomly.
Paolo Bax
The SmartFoxServer Team
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post by atarim »

Well, I've tried setting the viewport size to be 1px smaller than the background (no foreground) - it's still white and happens everytime, not randomly.
The only solution that works, is invalidating the component by setting:

Code: Select all

osClient.width = (osClient.width == 1000) ? 1001 : 1000;
I hope can you find a better fix than what I came with.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Thank you for the information. We will investigate this.
Paolo Bax
The SmartFoxServer Team
Post Reply