Web services and Second Life

Columnist William Brogden looks into the virtual world of Second Life as sees Web services business opportunities in its scripting language and REST style messaging.

The concept of online virtual worlds where a user can interact with other people and fantastic landscapes has fascinated hackers and science fiction writers for years. When I first thought about doing an article on this topic I was going to call it speculative, but Internet reality has caught up already.

Previously, insufficient computational and communication capability have been the main limits, not the imagination of programmers. With Second Life by Linden Lab we seem to have crossed a critical boundary and reached a point where large numbers of users can share the same virtual world at the same time. Major corporations are experimenting with a presence in the virtual world as a means of reaching customers and individuals are creating businesses which exist only online.

Some Second Life background

Downloading the Windows XP or Mac client and creating an "avatar" identity with basic membership is free. "Owning" or "renting" virtual property so you can establish a more extended presence involves a monthly fee. Within the system you can buy and sell with "Linden Dollars" which have a variable exchange rate with real US dollars. A few people have discovered how to earn a real-life living entirely from virtual income.

Whether you call Second Life a game, social networking tool or a programming environment depends on how you use it. Many people just buy a fancy outfit for their avatar and socialize. Others are having a blast designing their own virtual property.

As of this writing, over 6 million people have created an online identity, but most become less active after doing some exploring. A typical number of people who go online at least once a week would be 400 to 500 thousand. The number of registered users has grown dramatically over the last few months. Second Life has been able to scale up rapidly because adding new virtual land just requires adding low cost servers.

What is a business doing in Second Life?

There are now so many businesses experimenting with a Second Life presence that I can't begin to list them all. If you read the trade press for practically any industry you have been seeing news articles. I just found out there is a "Second Life Corporate Business Council" with 30-40 big business members! In addition to the obvious display of advertising banners with links to corporate Web sites, creating environments for virtual conversations with customers has been found valuable by Dell and IBM, among other big business applications.

Many small businesses are experimenting with a Second Life presence or even a full-time switch to the virtual world. Authors, designers of clothing and furniture and many other small businesses have found Second Life to provide low cost exposure to potential customers.

The programming environment

The Second Life environment is built with objects and program scripts. Objects are built out of graphic primitives modified by imported graphic file "texture" images. Objects may have one or more attached programs in the Linden Scripting Language, which provide behavior.

With proper scripting, objects can interact with avatars and other objects. Objects can detect the presence of nearby avatars, "hear" chat that is "spoken" by users and respond to being "touched." Objects can also use the connectivity capabilities described below to exchange data with the outside world.

The Linden Scripting Language or LSL

LSL has a syntax and operator set that will be familiar to C or Java programmers, but is not object oriented. Mainly it has a large number of built-in functions and event handlers specific to the 3D virtual environment and the manipulation of user-created objects. In addition to the string and numeric variable types, there are variable types specific to location and movement in the 3D world which provide the basis for dramatic animation effects. Collections are limited to a list type which can hold any of the other variable types.

The connection options

At present, the scripting language provides three interfaces for communication with the Internet, e-mail, XML-RPC and HTTP requests. Due to the way XML-RPC is handled, channeling all requests through a single server, it does not appear to be scaling well as the system grows. Furthermore, given the verbose nature of XML-RPC, the limit on message size is a serious problem.

E-mail can be sent both inside Second Life and to Internet addresses. To reduce load on the servers and prevent use for spam, there are limitations on how frequently an object can send e-mail and enforced delays for each piece of mail sent.

The http request facility appears to be the most flexible since, in contrast to xml-rpc, each server handles requests directly. When a script calls to llHTTPRequest function, the language automatically associates a matching http_response event handling method which will get the resulting response.

Requests can use GET, POST, PUT and DELETE methods. At the present time there is a limit of 2048 characters in a request or response body, so a verbose format like XML is probably not a good idea. Also the language does not presently support any XML manipulation tools like XPath. I think that REST style Web services are going to be the best approach. Clever programming will be required to get the most out of the limited message size.

In contrast to the enforced delays with e-mail and XML-RPC, I found less than one second response to http requests. An important aspect of http requests is that the headers contain complete specification of the object originating the request, including its owner, location and velocity. Thus any service addressed by the request has a lot of information suitable for enforcing security restrictions.

Examples of current connectivity

There are many ingenious examples of connectivity using the HTTP request facilities. Just to give three examples, there are several implementations of chat translation services which send chat messages to a server which in turn uses the facilities of Babelfish and returns a translated chat message in a fraction of a second. IBM created a simulation of Wimbledon tennis matches which displayed actual ball paths on a simulated court. The use of RSS feeds to provide current information on other sites is common.

Limitations

The new Second Life user should not expect the 3D display to instantly appear fully formed like an online game. Since the environment is created dynamically by the users, each time you enter the current state of your surroundings has to be loaded. Moving to a new area will cause a whole new set of objects to be loaded.

In order to avoid having any single user taking too much capacity on a server, there are restrictions on the number of objects which can be created and on the execution of certain resource consuming functions. For example, calling the e-mail send function takes a 20 second delay.

Conclusion

In my opinion, Second Life is the first 3D virtual world with enough functionality to justify serious experimentation with commercial possibilities. Experience gained in Second Life will probably show up in private corporate virtual worlds.

Resources

The main Second Life Web site. Check out the graphs of increasing activity.

Dr. Dobb's Life 2.0 Web site for developers.


This was first published in May 2007

Dig deeper on Scripting languages

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close