Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Global Developer

Second Life: A Programmer's Perspective


The SL Object Model

The virtual world that is Second Life consists of a bank of servers, each of which is responsible for managing objects, terrain, and avatars, and for ensuring that clients connected to the server are updated in a timely manner. Each server coordinates the interaction between avatars and in-world objects. Objects do not have an ability to react to inputs from avatars or other objects; they have to be scripted to come to life. Ordinarily, your responsibility as a developer ends with writing the logic for an object, but in SL, creating a lively and responsive world combines two development disciplines—object creation and object scripting.

SL hosts a combination tool (in effect, an IDE), both for creating tangible objects and giving them the ability to react to their environment. There are no restrictions on the sorts of objects you might dream up. Every visual element from shape to material to texture is possible to specify and tweak. Everything you create is a series of simple or linked polygons. In fact, your avatar itself and everything it interacts with is either a single 3D polygon (a "prim" in SL speak), or a grouping of linked prims. Whenever you right-click on any prim, a circular menu is visible, revealing both the limited built-in behaviors and those that you have given it via scripting.

Figure 1 shows an avatar having right-clicked on a chair, and sets of choices appear as pie slices in a circular menu. The few choices available are a representative set of defaults. A logical choice in this case might be "Sit Here." More complex behaviors must be added by developers attaching responses to potential interactions. Scripting is done via the Linden Scripting Language.

[Click image to view at full size]

Figure 1: An avatar using the Second Life object menu.

LSL has evolved through a couple iterations, but currently seems to have a stable set of APIs in the SDK. Studying the API reference (lslwiki.com or mirrors such as http://rpgstats.com/wiki/index.php?title=Main_Page), you find a rich API for doing everything from imparting physical motion, collision detection, and movement, to connecting SL objects with the Internet.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.