Portable IMML – Host a virtual world like a PDF

As part of the v1.3 release the Portable IMML (PIMML) format was updated to include some new features (encryption, URI impersonation, additional assets, DRM).

An update was also made to the Creator to expose this new functionality and make packaging up a PIMML file a simpler experience.

Here’s a quick step-by-step guide to create a PIMML file using the Creator (v1.3 required!)

Begin by loading your IMML up into the Creator. For this example I’ll use hello-world-hills.imml. Navigate to the Publish menu and select File.

The first step is to decide how the PIMML file will be used. If you have designed it to be a multi-user environment, choose Offline Use. The difference between Online Use and Offline Use is quite simple; online means that the PIMML can use URI Impersonation to connect to a VastServer whereas offline cannot.

For this example I’ll pretend this file will be used online – in reality the IMML for hello-world.hills hasn’t been designed for online use, so don’t expect anything multi-userish to magically happen if you are following along at home :)

Next, we need to instruct the PIMML file where the VastServer that will manage the multi-user data is located. In this case I’m using the fictitious example.org as my address.

The benefit of this is that the PIMML file can be shared via email, served via Apache/IIS/VastServer/other, handed out on a USB stick, etc and still have the ability to be multi user. This is known as URI Impersonation.

By default, the Creator will only PIMML assets that are statically referenced in the original IMML.

In our example IMML the only element that really qualifies for packaging is the model called Mountain Terrain.

Often scripting will dynamically source content, so you may wish to add additional assets into the PIMML file. A good example of this is an animation resource as shown in the below example:

URI: The remote URI to map acquisition requests from
File path: The file to resolve the requests for that URI to

The final step is to check the document name is correct (it gets displayed at the bottom left of the Player UI) and choose an encryption level for the package.

I’ve choosen to encrypt in this example using a really thirst quenching password.

That’s all there is to it, hit Next and the Creator will do the rest:

The summary screen tells you where the PIMML was output to (defaults to Documents\VastPark\Creator\PortableIMML), the file can now be opened in the Player and interacted with as per usual:

Note: The title for this post was inspired by http://twitter.com/jokay/status/20869967909 :)

VastPark Platform 1.3 Released

Today the Creator, Player and Publisher based off v1.3 of the framework were released to web!

Some of the more notable changes include:

  • New Drawing API
  • New physics engine
  • Support for encrypted file formats
  • Improvements to the Portable IMML format
  • Additions to VastScript related to keyboard/mouse triggers
  • Refined Player UI
  • Many bug fixes and stability improvements

Why the jump from 0.98 to 1.3?

My last post implied that v0.98 would be the final DirectX version of the framework. Instead a decision was made for a few more iterations on DirectX to tie up some loose ends, prior to spending significantly more time working on the OpenGL framework (in actual fact, over the past 6 months we’ve been working on both!).

Since the release of 0.98, the version numbers have been ticking over in line with the growing maturing of the framework, with v1.1 and v1.2 surfacing as developer snapshots. As some fairly major pieces of the framework were being swapped out over this period, the numbering became important – some plugins were needing a minor rewrite to be compatible with the newer modules.

Using the magic of Metaforik and multiple Assets linked to each Item, we were able to publish the same plugin multiple times to maintain backwards compatibility for each framework version.

Portable IMML

The PIMML format has been updated to support some exciting new features:

Combined these features mean that a securely encrypted, portable virtual world can be distributed which is capable of connecting to a live server! Your users will benefit by much faster load times (the content is local) while still maintaining the ability to be in a multi-user space.

As part of the format update, a new wizard interface was introduced in the Creator making it easier to use the new features.

Find the wizard under the Publish to File menu:

Note: The update to the PIMML format is not backwards compatible. If you have some older files which are critical to migrate, please speak up at the forums on vastpark.org

Drawing API

Many customers are looking towards virtual worlds as a solution to collaboratively visualise information.

Whilst this was possible previously in VastPark using Primitive and/or Model elements, the new drawing API allows developers to take this to the next level by making it easier to create graphs, overlay annotations and build more intuitive user experiences.

The drawing API provides the following base types:

Access to these types are exposed via the RenderEngine interface and for convenience within VastScript via plugin (DrawingPlugin). We are considering ways that this can integrate nicely into the IMML spec at a later point.

Here’s a basic sample that uses the DrawingPlugin to demonstrate some of the functionality (right-click, save as): drawing-api-sample.imml

Refined Player UI

We’ve made further improvements to the Player UI to tighten up the look along with a brand new vastpark:home design:

At the same time we’ve changed some of the shortcut keys:

F1 – Help
F4 – Options
F5 – Refresh
F6 – Screenshot
F9 – Chat
F10 – Library
F11 – Fullscreen
F12 – Freelook camera

Also of note is the unified default folder structure for all of the applications:

Documents\VastPark\[application name]\[folder]

New physics engine

BulletPhysics had already been chosen as the solution for future versions of the framework. It was decided that to provide a smoother transition between the v1.3 and v1.5 codebases, we would port it back.

Improvements have been observed in a number of areas such as the stability of avatars and a more realistic, robust simulation.

Alas, the port was not without some minor regressions; GenerateExplosion, SetForce, AddForce, SetImpulse and collision events were temporary casualties. All of these will return again in a future version of the framework.

Final Note

The applications are available for download at the usual place.

If you are upgrading from a version prior to v1.3 I’d strongly advise a quick visit to add/remove to uninstall the older applications prior to upgrading to the newer release. The installers are now using MSI and will only allow overwrite from v1.3 onwards.

Enjoy!

VastPark Developer Introduction – v1.3 Framework

I recently gave a talk to a team of developers interested in working with the platform who are planning to build some new exciting products on top of it.

One of the audience offered to record the session remotely so the audio is a little scratchy, but I think it’s come across ok.

The talk covers:

Hopefully this is a useful primer if you are interested in developing with VastPark or are curious to know a little more about the way the system functions.

Download the PDF shown in the video here: VastPark Developer Introduction - Framework v1.3

Recent changes to the VastPark SVN structure

Recently we decided to do some repository reorganisation to make life easier for new developers wanting to tinker with the open source code for VastPark. This involved quite a bit of thought and a substantial amount of effort to migrate towards (actually, we’re still in the process of migrating some of the code) but we are already seeing the benefits of a cleaner structure.

The structure

As you will notice from the image above, we’ve gone with a multi-repository approach. This has a number of benefits for us internally, such as less duplication of files, as well as for those externally in that we can lock the public repository to specific external revisions to avoid pushing out code which might break compatibility.

Lib repository

Contains mainly third party source and binaries that we make use of in the platform.

Common repository

Contains the public source code for the VastPark libraries as well as VastPark developed specifications such as IMML, Metaforik and Continuum

Public repository

Externals common and lib repositories and sample projects developers can use to understand how the system works. It’s recommended that external developers work off the public trunk

Legacy code

Two quick points on some legacy issues to be aware of:

Getting the source

Using a subversion client, SVN checkout from:

http://vastpark.svn.cvsdude.com/public/trunk/

Be sure to enable externals or you will find only a fraction of the source code will be downloaded.

Happy coding! I’m interested to hear how simple it is to get up and running with the source code. Comments both positive and negative are welcomed on this.

Flocking algorithm in VastPark

Many months ago during May of 09, after meeting Ian Hughes at FCVW, I came across an interesting post on his blog discussing an implementation of the flocking algorithm in Unity.

I’d not heard of the term flocking or boids, so proceeded to get stuck into some research, which lead me to Conrad Parker’s page on Boids Pseudocode as well as many others who had implemented the algorithm, I figured it would be a fun little plugin to write for VastPark so gave it a try.

Implementing the algorithm

Thinking about what was required, I came up with the following as the plan for the plugin:

In terms of the plugin this translates into these properties:

The following callbacks:

The following methods:

The class diagrams look like this:

How does it work?

Put quite simply, the plugin works like this:

Downloads

Here is some sample IMML and the source code to the plugin, enjoy! Let me know if you decide to implement any of the other rules or do something cool with it :)

Sample IMML: flocking.imml
Source code to plugin: Plugin.Flocking.zip

Note: The source code will probably complain about some missing references. Install the Player from www.vastpark.com and link against the relevant binaries included with it.

Drag and Drop Sample

One of the major features of the 0.98 release is the inclusion of drag and drop. Basically, this allows you to drag an Item into the 3D space where the IMML can decide to do something with it.

To try drag and drop out for yourself, first download generic-drag-drop-sample.imml (right-click, save as) and open in the Player.

Next, you’ll need to expand the Items list. Do so by clicking on this icon:

By default you are presented with the list of Items of type Video and Document that the currently logged in account has access to (these can be further restricted by the hosting server’s group ACL).

In this case as we are opening the file directly, it will default to showing the most recently published Items without filtering and should look similar to this:

Click to select one of the items from the list (in my example, I’ve chosen “VastPark Logo”) and drag it onto the 3D view. The large rectangle in the centre of the screen will change colour to blue indicating it is a drop target.

Next, drop the Item onto the blue rectangle, which will cause it to change colour to green. Shortly the VastPark logo will appear on it.

How does this work?

Behind the scenes is a plugin (called MetaforikAdapter) which currently supports adapting Items of type “Document” and “Video” to a Model or Primitive element. The code to do this is quite simple.

First, reference the Plugin:

<Plugin Enabled="True" Source="http://id.vastpark.com/VastParkWS/get.vpws?name=MetaforikAdapter&amp;publisher=craigomatic&amp;domain=vastpark&amp;context=park" Name="MetaforikAdapter">
    <Element Name="InvalidRequestHandler" />
    <Parameter Key="InvalidRequestEvent" Value="InvalidRequestHandler" />    
  </Plugin>   
  
  <Script Name="InvalidRequestHandler">
    function main(obj, args)
      scene.ui:writeline('invalid request')          
    end
  </Script>

Next, handle the appropriate events on the elements you want to be able to drop on. Alternatively, this can be at the document level:
<Trigger Event="DragDrop" Target="OnDragDrop" />
<Trigger Event="DragEnter" Target="OnDragEnter" />
<Trigger Event="DragLeave" Target="OnDragLeave" />

In you script for the drop, pass the Item along with the element you want to adapt it to into the load method on the plugin. You may choose to inspect the Item before the drop to give user feedback as is done in the sample IMML.

<Script Name="OnDragDrop">
    function main(obj, args)            
      --args.data contains the Item which was dragged in
      
      --load returns a controller object
      c = metaforikadapter:load(args.data, obj)      
    
      scene.ui:writeline('item name: '..c.item.name)
      scene.ui:writeline('id: '..c.id)
      scene.ui:writeline('is first: '..tostring(c.isfirst))
      scene.ui:writeline('is last: '..tostring(c.islast))
      scene.ui:writeline('total pages: '..tostring(c.pages))
      scene.ui:writeline('current page: '..tostring(c.currentpage))
    end
</Script>
  
<Script Name="OnDragEnter">
    function main(obj, args)
        scene.ui:writeline('drag enter on: '..obj.name..' of type: '..args.data.assets[0].type)     
    end
</Script>
  
<Script Name="OnDragLeave">
    function main(obj, args)
      scene.ui:writeline('drag leave on: '..obj.name)
    end
</Script>

Working with elements other than Document or Video

One thing to be aware of is that you don’t necessarily have to use the MetaforikAdapter plugin to benefit from drag and drop. If you want to allow for models or sounds to be dropped in, you can use the item.updateuri as the source for the element and add it into the scene, like this:

<Script Name="OnDragDrop">
    function main(obj, args)    
      item = args.data
      if(item.assets[0].type == 'Model') then       
          m = model()
          m.source = args.data.updateuri
      
          scene:add(m)     
      end
    end
</Script>

Final Note

That’s really all there is to it, you may want to craft different UI depending on the state of the controller properties in the MetaforikAdapter plugin sample, ie: to handle a multi-page document differently to a video or single page document, or in the model example to only allow certain users to drop models into a specific region of your space.

Updated IMML for Stock Market Ticker

I’ve made some adjustments to the stock ticker built as part of my building a stock ticker in vastpark post to take advantage of the new Tooltip Plugin and the Define element in IMML. Rather than going all out, I’ve simply added a tip that shows the volume for the current day when the mouse is over one of the green bars and a Define that lets you more easily choose which stocks should be displayed.

If you haven’t already read the original article and are interested in how it works, be sure to have a read before continuing.

Define Element

The Define element is a declarative way of expressing a variable in IMML. It’s equivalent to doing element:set(‘variableName’, variableValue) but doesn’t require interpretation via the scripting engine which results in much better performance. It’s also a much nicer way to store global variables as they can be placed in more a easily identifiable location in the IMML rather than being buried within a script.

My Define in the sample looks similar to this (truncated for brevity):

<!--Use any Yahoo stock codes in the below define to control the stocks being generated and updated-->
 <Define Key="stocks" Value="IPL.AX,VIL.AX,FMG.AX,RIO.AX,BHP.AX,BOQ.AX" />

To change the ticker to show different stocks, replace any of the entries in the Value of the Define with the appropriate Yahoo ticker code for the relevant stock.

Tooltip Plugin

Note: To use the Tooltip plugin, you’ll need to be running either the most recent Player snapshot or version 0.98+ as it uses the Handle property that was added recently to the IRenderEngine interface.

The tooltip concept has been around for quite a while and is used by just about every modern desktop application. Ever wondered what that big red button does and hovered your mouse to find out? If yes, you’ve seen a tooltip. This plugin extends the concept to allow developers to associate a tip with an element in world.

To do so is quite simple, the following functions are provided with the plugin:

int Add(string text, ImmlElement element)
void Remove(int id)
void SetText(int id, string text)

To make use of these, I’ve added 2 lines to _updateStock in the UpdateStocks script:

--update the volume tooltip	
id = lastTradeVisual:get('tooltipId')
tooltipplugin:settext(id, 'Volume: '..volume)

…and 3 lines to _generateStock in the GenerateStocks script:

--store a define value on the last trade to represent volume for the tooltip
lastTradePrim:set('volume', volume)
id = tooltipplugin:add('Volume: '..volume, lastTradePrim)
lastTradePrim:set('tooltipId', id)

The end result still looks similar to before, but we now get tooltips when hovering:

Download the updated IMML here: stock-ticker.imml

VastPark Platform 0.98 Released

Along with a fresh look for www.vastpark.com, the 0.98 versions of the Player, Creator, Publisher and Server have been released. This will be the final DirectX only version of the platform as we move towards 1.0

What’s included in 0.98?

Drag and Drop

Drag and Drop allows the user to drag an Item from the Items list into the 3D space. This Item can then be interrogated via script or plugin and an action can occur based on the developer listening to the DragEnter, DragDrop, DragLeave triggers in IMML.

The benefits of this can be extensive, from dynamic presentations with multiple presenters able to drag out their presentation on demand to injecting new content into the scene.

Note: This Items list is populated by the Metaforik index. You can get content into this index using the Publisher application (you must have a publisher account!) which supports Models, Video, Audio, etc, but currently doesn’t support the type “Document”.

Simplified UI

Feedback was received that the UI for the Player was a little complex, so we’ve introduced a menu and removed much of the clutter from the tray area. All of the functionality previously accessible from the tray is now found under the menu at the top of the application.

The address bar now has back, forward and refresh buttons as well as a new icon that indicates the health of the current document and an icon that appears when content is loading in the background.

The debug dialog has been slightly tweaked and simplified also, note that debug rendering options now appear under the menu View -> Render. By default, the LoadQueue tab is now displayed which is useful in working out what is occurring while you are waiting for a document to complete loading.

More of a focus on capture

Along with the support for Continuum capture, the Player now supports capture of screenshots.

Screenshot and Continuum captures default to being stored in your Documents folder under the subfolders “Continuum” and “Screenshots”. This can be customised by visiting the Options menu (Tools -> Options) and selecting a new capture path.

In a future release video capture support is likely to make an appearance as we aim to provide a variety of ways to capture the experience within the Player.

Search Syntax

Some slightly more advanced searching ability is included in the Player’s Item list and follows this syntax:

[type:itemType] [publisher:nameOfPublisher] [tags:tag1, tag2, etc]

Some valid searches that follow this syntax are:

Crate type:Model publisher:craigomatic
- Finds all Model items published by craigomatic that have a name like “Crate”

Crate
- Finds all items that have a name like “Crate”

type:Document
- Finds all items of the type Document

0.98 Platform Changelog

Download link: http://www.vastpark.com/resources/downloads.html

VastPark Platform – Intro Video Series

vimeo_logo

We’ve recently put online an introductory video series that gives an excellent overview on VastPark and a brief intro to the concept of an Adaptive Web.

The videos were created and edited in record time by myself and our team of ninja video editors and will likely have extra polish added early in 2010.

Check out the series at: http://vimeo.com/channels/71694

Virtually Speaking

VastPark CEO, Bruce Joy speaks about the future of Virtual Worlds, virtually, at NUS in Singapore:

VastPark CEO Bruce Joy – NUS Presentation from VastPark on Vimeo.

You can take a look at the presentation in world using VastPark (the quality is much better) by first downloading the latest Player snapshot from here: http://www.vastpark.com/dev-snapshots

Then, download the PIMML (portable IMML) from here: http://vp.pimml.s3.amazonaws.com/nus-brucejoy-presentation.pimml

Next Page →