OpenSpace 2.0 officially released

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

Moderators: Lapo, Bax

User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

OpenSpace 2.0 officially released

Postby Bax » 29 Jan 2010, 16:26

OpenSpace 2.0 has been officially released.
Please visit the OpenSpace website: http://www.openspace-engine.com


==============================================


OpenSpace 2.0 final version is now available.
You can download it by clicking on this link (LINK DISABLED).
Please read the bottom of this post for installation instructions.
For newcomers, a description of the v2 main features is available here.

This new version is to be considered the final one before the official release. The code development is now closed and there won't be changes (unless last-minute bugs are reported). We are now concentrating our efforts on completing the documentation and updating the OpenSpace website.

This pre-release version brings the following changes/improvements.

On the Client-side:
- a bug has been fixed in the OpenSpace.tileDropValidator function, which was called in EDIT MODE even if the user wasn't dragging an inventory item, but just moving the mouse on the map;
- two new parameters have been added to the OpenSpace.dragInventoryItem method: now you can assign an instance name and tile triggers to the inventory items that are being dropped on the map.

On the Server side:
- we added a simplified event dispatching system which now fires an "onMapUpdated" server-side event when a user updates a map (it can be useful to recreate the NPCs after a map change);
- when the OpenSpaceExtension.moveAvatar method is called, and a valid path to the target coordinates can't be found, a PathfindingException is fired.

The API documentation has been updated too (but still work-in-progress):
- client-side API
- server-side API


==============================================


OpenSpace 2.0 beta 5 has been released.
You can download it by clicking on this link (LINK DISABLED).

This new release brings the following changes/improvements.

On the Client-side:
- new OpenSpace.getMapSize method returning the width and height of the current map base grid;
- signature of the OpenSpace.getTileByCoordinates, OpenSpace.checkTileWalkability, OpenSpace.moveMyAvatar and OpenSpace.teleportMyAvatar methods has been changed: now a single Position3D object must be passed instead of the three separate map coordinates (sorry, for this API change!);
- OpenSpaceEvent.MAP_ITEM_SELECTED and OpenSpaceEvent.MAP_ITEM_DESELECTED events have been improved: now the params object brings an additional tiles array containing a reference to the Tile objects composing the selected item;
- other minor improvements.

On the Server side, the OpenSpace Extension now features the following methods which can be invoked from a child custom extension:
- OpenSpaceExtension.sendAvatarToMap, which can be used to make a user join a map; a typical use case scenario is described in this post;
- OpenSpaceExtension.moveAvatar, which can be used to send the avatar of a user to to new coordinates on the map; a typical use case scenario is the NPCs movement on the map.

The API documentation has been updated too (but still work-in-progress):
- client-side API
- server-side API


==============================================


OpenSpace 2.0 beta 4 has been released.
You can download it by clicking on this link (LINK DISABLED).

This new release brings the following changes/improvements:
- drag&drop of inventory items during runtime map editing added to Flash version of OpenSpace;
- minor improvements to the OpenSpace Editor.


==============================================


OpenSpace 2.0 beta 3 has been released.
You can download it by clicking on this link (LINK DISABLED).

This new release brings the following changes/improvements (casual order):
- the OpenSpace.clearMap method has been renamed to OpenSpace.unloadMap;
- methods OpenSpace.getBackgroundParts and OpenSpace.getForegroundParts have been added, to make the background and foreground parts display objects accessible;
- OpenSpaceEvent.ANIMATION_START and OpenSpaceEvent.ANIMATION_END events added: they are triggered by the zoom and pan actions, or when the avatar movement causes the map to scroll;
- selected tiles/supertiles can now be dragged without deselecting them previously (works both in the Editor and during runtime map editing);
- In the Editor, a checkbox in each tab has been added near the create/update button: if selected, editing continues when the button is clicked;
- a "tiles" parameter has been added to the OpenSpaceEvent.MAP_ITEM_ADDED event params object: it is an array containing the tile (or tiles, if the added item is a supertile) just placed on the map;
- OpenSpace.tileDropValidator property added: this custom function is called when ever the player drags an item on the map, and can be used to inhibit item dropping.

Also, a work-in-progress version of the API documentation is now available here. Please consider the IOpenSpaceAPI class as the staring point.


==============================================


Hello.
We are proud to announce the public release of OpenSpace 2.0 beta 2.
You can download it by clicking on this link (LINK DISABLED).
The package contains two examples (one for Flex and the other one for Flash), the OpenSpace Editor Air application, the Flash and Flex components SWC files and the server-side stuff, including: the example Zone configuration, the server-side extension, the example maps data.

Before the final version can be released, some work is still needed. Here is our TODO list:
- Client API documentation is still work-in-progress, so it is still missing (but you will find some informations below);
- Server API documentation not yet available (yes, OpenSpace 2 comes with a dedicated server-side extension);
- Other required documentation (client configuration for example) is missing too;
- the Flash component lacks a class required to enable drag & drop of map items during runtime editing, so at the moment this can't be implemented);
- the Flash example provided in the downloadable package is not complete: it only shows you how to initialize OS and load maps;
- some minor improvements to the Editor are still to be implemented.

We are sorry that documentation is not yet available, but we are sure that the expertise you gained using OpenSpace 1.0 and the provided examples will help you to get started easily.

Also, the this beta release is a trial version, which:
- allows you to load maps with an area not larger than 225 tiles (corresponding to a 15x15 map for example);
- shows a "Powered by OpenSpace 2" logo in one of the viewport corners.
All the other features are available. If you are an OpenSpace v1.0 customer, you can send us an email to receive the full version (please attach your purchase invoice to the email).

Client installation

The example is a Flex project you can import in Adobe Flex Builder 3 (but OS2 is compatible with Flex Builder 2 too).
To use OpenSpace in your own Flex application, simply add the OpenSpace_Flex.swc file to your project library path: this makes the OpenSpace component appear in the Flex Components panel, ready to be dragged on the stage.
To use the Flash component, close Adobe Flash (CS3 or CS4), open Explorer (Windows) or Finder (Mac OSX) and go to the components folder:
Windows --> C:\Documents and Settings\user\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Components
Mac OSX --> user/Library/Application Support/Adobe/Flash CS3/en/Configuration/Components
Now create the "OpenSpace 2" folder and put the OpenSpace_Flash.swc inside it.
Open Flash and drag OpenSpace on the stage from the "OpenSpace 2" group in the Components panel.

In order to create a custom avatar you will also need to add the AvatarLibrary.swf file to the same folder. You will then find a new item in the Components panel that you can drag to your fla library. It contains the Avatar class you will need to extend to create your custom avatar.

NOTE: it seems that Flash CS3 doesn't like the OpenSpace and AvatarLibrary components, in fact you won't be able to drag them to your fla library. The reason is not clear; the workaround is... copy them from the provided example fla to your own fla instead of dragging them from the Components panel.

The Editor can be installed by double-clicking the .air file. The provided Flex example comes with its own .osp file, so you can play with it. No documentation is available yet, but usage is quite straightforward. Please notice that if you want to edit a project created with the previous version of the Editor, before loading it you have to open the osp file in a text editor and add the <id>yourProjecUniquetId</id> tag after the <title> tag. Attention: osp file and exported map files have a new format, so if you load and then save a previous osp file, you won't be able to load it in the v1 Editor anymore.

Server installation

OpenSpace 2 requires a server-side extension to run. It is a zone-level extension which takes care of loading and caching map data, send maps to the client, save maps modified by users at runtime, calculate avatar paths, etc. Developers will be able to extend its class in order to add application logic to the core OpenSpace functionalities. This feature is already in place but not tested.
To enable the OpenSpace extension you have to:
- copy the content of the zone_config.txt file to your SmartFoxServer config file (it is a zone definition, used by the example);
- copy the openSpace folder to your SmartFoxServer Pro Server folder;
- open the start.sh (Mac/Linux) or start.bat (Windows) file in the Server folder with a text editor and at the end of the long list of jar files, just before the closing double quotes, add the following:
Mac/Linux --> :openSpace/OpenSpaceExtension.jar (including the colon!)
Windows --> ;openSpace/OpenSpaceExtension.jar (including the semicolon!)
- restart SmartFoxServer.

If you create new maps you have to export them and copy the files to the Server/openSpace/data folder. Also, maps must be "linked" to rooms in the SmartFoxServer config file, by setting the _os_mapId room variable just like in the example zone.

As it regards the avatars, first of all you have to define the available "types" on the server side (check the Server/openSpace/OpenSpace_server.xml configuration file - in OpenSpace v1 avatar definition was located in the client-side configuration file instead).
You then have to create your own class which must extend the com.smartfoxserver.openspace.engine.model.avatar class. Please follow the example provided in the src/assets/avatar folder in the Flex example project (the fla file requires Flash CS4).
Last edited by Bax on 30 Apr 2010, 16:40, edited 19 times in total.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 29 Jan 2010, 16:31

Client API

The following is the list of the available methods of the main OpenSpace component (both Flex and Flash). As some methods require custom classes to be passed as parameters, the properties of those classes are listed below too.
Check the provided example for available events and their parameters.
Please notice that the main difference with respect to the previous version is that now OpenSpace is in charge of the room join process (in fact you have to pass a room id to the loadMap method).

A work-in-progress version of the API documentation is available here. Please consider the IOpenSpaceAPI class as the staring point.

Code: Select all

com.smartfoxserver.openspace.components.flex.OpenSpace
com.smartfoxserver.openspace.components.flash.OpenSpace
   var version:String
   var xtName:String
   var configPath:String
   var skinAppDomain:ApplicationDomain
   var bgAppDomain:ApplicationDomain
   var avatarAppDomain:ApplicationDomain
   var enableTrace:Boolean
   var userInteractionEnabled:Boolean
   var isEditMode():Boolean

   function init(smartFoxClient:SmartFoxClient, customItemSelector:AbstractMapItemSelector = null):void
   function loadMap(room:*, password:String = ""):void
   function renderMap(params:MapCenteringParams = null):void
   function clearMap():void
   function loadInventory(projectId:String = "", filterParams:Object = null):void
   function getInventoryItemSprite(itemId:String, itemDir:int):Sprite
   function getInventoryItemCount(itemId:String):int
   function centerViewOnCoords(mapCenteringParams:MapCenteringParams, showAnimation:Boolean = true):void
   function panView(dx:int, dy:int, overrideLimits:Boolean = false, showAnimation:Boolean = true):void
   function zoomView(factor:Number, showAnimation:Boolean = true, mapCenteringParams:MapCenteringParams = null):void
   function enterEditMode():void
   function dragInventoryItem(inventoryItemId:String, inventoryItemDir:int, dragInitiator:*, event:MouseEvent):void
   function leaveEditMode(saveChanges:Boolean):void
   function getTileByCoordinates(px:int, py:int, pz:int = -1):Tile
   function getTileByName(tileName:String):Tile
   function getSkinByName(tileName:String, skinName:String):DisplayObject
   function getAllSkinsByName(name:String):Array
   function setCustomMapLimits(limits:Rectangle):void
   function checkTileWalkability(px:int, py:int, pz:int = -1):Boolean
   function showWireframe(showFill:Boolean = false):void
   function hideWireframe():void
   function createMyAvatar(params:AvatarCreationParams):void
   function removeMyAvatar():void
   function getMyAvatar():Avatar
   function getMyGhostAvatar():Avatar
   function setMyAvatarSkin(skin:Object):void
   function setMyAvatarState(state:Object):void
   function setMyAvatarAction(action:Object):void
   function setMyAvatarAnimationTime(animationTime:int):void
   function moveMyAvatar(px:int, py:int, pz:int = -1, disableUserInteraction:Boolean = false):void
   function stopMyAvatar():void
   function stopAvatarLocal(avatarId:int):void
   function teleportMyAvatar(px:int, py:int, pz:int = -1, direction:int = -1, applyHeightCorrection:Boolean = true, showEffect:Boolean = true):void
   function centerViewOnMyAvatar(applyHeightCorrection:Boolean = true, showAnimation:Boolean = true):void
   function zoomOnMyAvatar(factor:Number, applyHeightCorrection:Boolean = true, showAnimation:Boolean = true):void
   function getMyAvatarCurrentTile():Tile
   function getAvatarById(userId:int):Avatar
   function getGhostAvatarById(userId:int):Avatar

com.smartfoxserver.openspace.engine.model.other.MapCenteringParams
   var px:int
   var py:int
   var pz:int
   var xOffset:int
   var yOffset:int
   var overrideLimits:Boolean

com.smartfoxserver.openspace.engine.model.avatar.AvatarCreationParams
   var type:String
   var name:String
   var px:int = -1
   var py:int = -1
   var pz:int = -1
   var direction:int = -1
   var skin:Object
   var state:Object
   var animationTime:int = -1 // Duration in milliseconds of the movement from tile to tile along N/E/S/W directions (correction is applied for other directions)
   var centerViewport:Boolean = false

   NOTE: leave shown default values in px,py,pz coordinates to make tha avatar appear on map access points randomly
Last edited by Bax on 25 Feb 2010, 16:51, edited 1 time in total.
Paolo Bax
The SmartFoxServer Team
User avatar
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Postby julifos » 01 Feb 2010, 19:29

Very nice! Much of the new methods will be very helpful. :D

When do you plan to release the full documentation? (approximate, something as "around two weeks" or "around four months" or "around one year")
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 02 Feb 2010, 12:06

Good work so far!
At the moment I'm porting one of our OpenSpace 1 examples to OpenSpace 2. So far, map loading and display is working but - and that's strange - the avatar is not shown at all. I get "[INFO] Avatars creation completed" logged correctly but my Avatar is never displayed anywhere on the map.
I made sure the updated avatar extends the new class and overrides the required methods (in fact I don't get any errors when compiling the avatar swf).
Do you have any ideas?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 02 Feb 2010, 14:36

julifos We aim to ship by the end of the month
laxersaz Can you show some the code you use for the avatar?
Lapo
--
gotoAndPlay()
...addicted to flash games
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 02 Feb 2010, 14:59

Hello again,

I checked again and there actually was an error message that appeared on top of my log. That's why I didn't see it in the first place.AVATAR CREATION

ERROR: Missing 'MyAvatar' class definition in avatars application domain for 'demo' avatar type

I don't quite get where this avatar swf is referenced in your example. I checked my server side OpenSpace configuration and it seems to be correct since the right class is referenced. The problem is that the class can't be found even though I also created a dummy reference in my test application.

NEW: I just checked out your Flex example (which unfortunately only runs in Flex builder and not in FDT due to the structure) and I get the exact same error there, too.
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Postby warhell » 03 Feb 2010, 18:59

I get the following error when trying to run the Flex example with Flex 3.5...

ArgumentError: Error #1063: Argument count mismatch on mx.binding::PropertyWatcher(). Expected 3, got 2.
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 04 Feb 2010, 08:55

I used Flex 3.5 too but didn't get any errors. The only thing that doesn't work is the avatar loading and display.
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Postby warhell » 04 Feb 2010, 19:41

I seem to get the same error as my previous post when I run the project with the 3.2.0 SDK, it seems to only work if I use 2.0.1
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Postby warhell » 05 Feb 2010, 18:13

Also, this is more of a question out of curiosity. Why is it that the class DemoAvatar.as does not have the correct package name in the file? The package is blank, but it should be assets.avatar. Though for some reason the example sitll works :roll:
Last edited by warhell on 15 Feb 2010, 19:06, edited 2 times in total.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 Feb 2010, 21:48

warhell wrote:Also, this is more of a question out of curiosity. Why is it that the class BeerTownAvatar.as does not have the correct package name in the file? The package is blank, but it should be assets.avatar. Though for some reason the example sitll works :roll:

I can talk about our example DemoAvatar: the as class is in the same folder of the fla file, so the package can be blank. Then the fla is exported as an swc file, which is used as a library in the Flex project. In this way everything works fine.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 Feb 2010, 21:49

laxersaz wrote:Hello again,

I checked again and there actually was an error message that appeared on top of my log. That's why I didn't see it in the first place.AVATAR CREATION

ERROR: Missing 'MyAvatar' class definition in avatars application domain for 'demo' avatar type

I don't quite get where this avatar swf is referenced in your example. I checked my server side OpenSpace configuration and it seems to be correct since the right class is referenced. The problem is that the class can't be found even though I also created a dummy reference in my test application.

NEW: I just checked out your Flex example (which unfortunately only runs in Flex builder and not in FDT due to the structure) and I get the exact same error there, too.

Is the MyAvatar class contained in a separate swf file?
Paolo Bax
The SmartFoxServer Team
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 08 Feb 2010, 08:41

Yes it is.

Could you please describe how to create an avatar for OS2 and where to put the file? That would be very helpful.

When I try to compile your example avatar fla, I get some errors of type VerifyError: Error #1014 and ReferenceError: Error #1065

That is probably related to the absolute class path that is defined in your example:
/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer/OpenSpace/Client/Classes/src

What exact classes are you referring here?

Thanks for your help!
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 09 Feb 2010, 20:44

It seems you pointed out something we left behind when packing the beta release. We updated the beta 2 package, so you can download it and retry.

I'll explain how the avatar in the provided example works. We created the DemoAvatar and DemoGhost classes in a Flash file, extending the Avatar class. We then exported an swc file (not a swf!) and added it to the Flex project. Now check the onOpenSpaceMapLoaded method in the main.as file, to see how we use the avatar. A reference to the avatar and ghost has been added to the server-side configuration too.

If you like, you can use a different approach, similar to the one used in OpenSpace 1.0: create an swf containing the avatar classes, load it at runtime, set the OpenSpace.avatarAppDomain property and then proceed like in onOpenSpaceMapLoaded method mentioned above (except you don't have to create a temporary reference to those classes as we did in the main.as file).

Let me know if something is not clear.
Paolo Bax
The SmartFoxServer Team
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Postby laxersaz » 12 Feb 2010, 10:34

Thanks, the swc approach finally worked like you said.

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 12 guests