I’ve been wanting to write this blog post for while (since this past summer, in fact!). I, along with the rest of the Sun team, began working on a brand-new module system for the 0.5 release this past summer. While I expect to improve to this module system over time (like any piece of software), we have implemented all of the features we need for the upcoming 0.5 release and have been using it for quite some time.
Writing a blog about a mundane technical topic like a "module system" may seem inconsequential, but in reality, it has far-reaching and important consequences for the future of the Project Wonderland platform.
What is a Wonderland Module?
A Wonderland module is very simply a collection of things for a virtual world. These things can be a number of items: code, scripts, artwork, or world descriptions. Wonderland modules are very similar in spirit to ‘plugin-ins’ or ‘add-ons’ that you find with other software programs. A Wonderland module delivers new functionality to a Wonderland world. This may include custom cell types (Java code), or it may include 3D models and textures, or it may include scripts, or it may include assemblies of world components into a world.
From a technical point of view, a Wonderland module is a Java Archive File (JAR) with a specific structure and XML files to describe its content. The exact nature of this JAR file structure is laid out in the Wonderland Module Specification: while ordinary users and most developers do not need to know this level of detail, it never hurts to expose as much information about the operation of Project Wonderland as possible.
With Wonderland modules developers can package up new virtual world functionality and deliver it to others. The installation and management of modules in a Wonderland server is done via a web-based administration UI (see below).
Examples of Wonderland Modules
Perhaps now is a good time to illustrate some examples of Wonderland modules, just so we are on the same page. ;-)
The Portal: Let’s take one of the modules we (along with our friends at Applied Minds and the iSocial team at the University of Missouri) had written for v0.4: the portal. When an avatar steps into the portal, he/she is transported to another part of the Wonderland world. This is a custom cell type (Java code), along with some 3D models and textures to represent the portal itself in-world. The portal doesn’t come standard with the v0.4 release: you have to build Wonderland from the source code and compile-in the portal cell code from the v0.4 "incubator" project. In v0.4 you also have to serve the artwork (models, textures) from a web server you have installed separately.
In the v0.5 release, Wonderland modules makes the sharing and installation of a custom cell type, such as the portal, much easier. Developers can package up their code, 3D models, and textures into a module. (We have tutorials already that tell you how to do this). Once installed, the Wonderland server automatically serves the artwork to clients for you: there is no longer a need to separately install artwork into a separate web server.
Artwork & Sample Worlds: A Wonderland module does not have to contain code. It can simply contain a collection of artwork, and perhaps sample arrangements of that artwork into a world. In fact, most any form of media may be contained in a module, such as audio files, images, documents, or movies. The Wonderland module system, therefore, addresses the content developer too. Content developers can use the module system to distribute the artwork they’ve created for Wonderland (using standard tools such as SketchUp, Maya, or Blender in the COLLADA format).
Wonderland Module Central
We also hope to build a central place for developers to upload and share their modules with the community, much like projects such as Glassfish, Hudson, and Netbeans have (see the picture on the right). At this point, its more of a wish, since we haven’t officially committed resources to building it, but we’ve talked about it a bunch. Besides the ability to upload and download modules, community members could serve as reviewers for modules, rating their functionality and stability. Wonderland, after all, is about open-source and extensibility, and Wonderland module central seems like an essential piece.
Licensing of Wonderland Modules
Another critically important aspect of the new module system–although not technical–is the change we made to the software license governing Project Wonderland. We migrated from the GNU Public License Version 2 (GPL v2) to GPL v2 with the "Classpath" exception (also called the "linking" exception). The "Classpath" exception essentially allows module developers full control of the intellectual property contained within their module. Developers may license their module code and artwork as they see fit, not bound by the constraints of the GPL v2 license. The "Classpath" exception is widely used by other open-source projects, such as GNU Classpath, Netbeans, and OpenJDK.
We are hoping to enable a robust ecosystem of module developers for Wonderland, both non-commercial and commercial and think the new license is a necessary piece towards that end.
Managing Wonderland Modules
In v0.5, we provide a nice web-based administration UI: one aspect of this is for module management. After you start up your server, you can click on the "Manage Modules" link to see the list of installed modules. At the bottom of this page, you can upload and install new modules. If your module does not contain any code, it should be installed immediately; if your module contains code, you will have to restart the Darkstar server before your module is installed. (We’ll automatically detect whether your module contains code and requires a server restart or not, so don’t worry!).
You can find some complete documentation on managing modules here.
Our Use of Modules
The Wonderland team uses modules all of the time, and not just for "add-on" functionality: we use it to organize code in the "core" of the Wonderland platform. If you install any developer release of version 0.5, and click on the "Manage Modules" link you will see upwards of a few dozen models already installed, ranging from pure add-on functionality such as the whiteboard, telephone, and cone of silence, to more central features, such as avatars, model loaders, and even the Darkstar server and voice bridge.
We use the modu
le system and its flexible set of module "parts" to help organize the code and break out interface from implementation that will allow us to easily upgrade components in the future. We, for example, will be able to deliver a brand new avatar system just by delivering a new module.
Whose Module Will Be the First?
We are releasing v0.5 in stages: our early developer releases are aimed at those developing modules with custom code and artwork. As we near making the final release of Project Wonderland v0.5 towards the middle of 2009, I wonder who out there will be the first to release a complete module for Wonderland. Will it be you?