Sending a map update notification

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

Moderators: Lapo, Bax

Post Reply
cyli
Posts: 16
Joined: 09 Mar 2010, 18:39

Sending a map update notification

Post by cyli »

Is there a way to send a map update notification from a server extension in order to force the client to reload a map? I attempted to send a JSON message with {"ver": <current time in milliseconds>, "_cmd":"_os_upd"}, and the client simply acknowledged that a map update was successful.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Well, why don't you simply send an extension message to the client, and reload the map when you receive it?
Paolo Bax
The SmartFoxServer Team
huhailong
Posts: 28
Joined: 14 May 2010, 04:39

Post by huhailong »

if a map file updated, i think have following two way to notify corresponding client to update:
1, send a simple extension message to client, message only have the modify 's file name. but at last, need send whole map 's data to client, waste bandwidth.
2, send the modify 's data to client, client update map use the modify 's data. this way maybe do not need update all map data. but message date

bax, please ask me which way is better ?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

This is not how OpenSpace works. First of all, if a user changes the map (using runtime editing feature), the update notification is automatic. If, instead, you modify the map with the Editor and substitute the map file, you have to send a simple message to the client, and the use the standard map loading method on the client to reload the map. No way to send just the changes.
Paolo Bax
The SmartFoxServer Team
huhailong
Posts: 28
Joined: 14 May 2010, 04:39

Post by huhailong »

the second way, our design is : a map will have many user 's house, when a user first login, we copy a map 's file to build the user 's house.
for placed The House on the map, we use sfs extension update the map 's file data when user first login. at the moment, we want to only send this modify 's data to all user of the map.
otherwise, other users on the map will not see the new house in his map.
but this will need modify openSpace 's client actionScript.
this way if has problem ?
Last edited by huhailong on 28 Jun 2010, 05:32, edited 1 time in total.
huhailong
Posts: 28
Joined: 14 May 2010, 04:39

Post by huhailong »

bax wrote:Well, why don't you simply send an extension message to the client, and reload the map when you receive it?
if send an extension message, whether only need following two parameters ?
params.put("_cmd", "_os_map");
params.put("rId", mapRoomID);
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Yes, those parameters are enough (the "cmd" can be whatever you want of course).
Paolo Bax
The SmartFoxServer Team
huhailong
Posts: 28
Joined: 14 May 2010, 04:39

Post by huhailong »

bax wrote:Yes, those parameters are enough (the "cmd" can be whatever you want of course).
if i only send the modify 's data (use "map" parameter) to client, client whether can auto update this modify 's data on client ?
because i see OpenSpaceController.as 's onExtensionResponse function, and IsoEngineController.as 's buildMap function, and AssetsLibrary.as 's importData function.
maybe can update client 's map file auto by modify 's data, is correct ?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

No you can't. You have to reload the whole map.
Paolo Bax
The SmartFoxServer Team
huhailong
Posts: 28
Joined: 14 May 2010, 04:39

Post by huhailong »

bax wrote:No you can't. You have to reload the whole map.
but reload the whole map, will need send map all data to client from server,
it is very waste bandwidth, is correct ?
Post Reply