Saturday, February 03, 2007

Arbitrary Prim Attributes

What a super idea! I've got the YAYZERAMA HANDS too now!!

Features like this (and other cool things, too!) could be added to the viewer client, 'specially now that it's open source, but so many features require just a little bit of help from the server to do it properly.

For example, right now there's no good way for the sim to remember "This prim has a saturation of 0.5 on all its sides" and tell that to everybody that comes by, so there isn't any way to share the desaturated goodness with anyone else! (Maybe you could store some cryptic data in the prim's name or description for other special viewers to notice, but that would be a dirty, dirty hack. Yuck!)

Sure, we could tug on the Linden programmers' shirt tails every time there's a new client-side feature we'd like the sim to store a little bit of data for. But, even if they were just twiddling their thumbs all day and waiting for something to do, there would never be enough time to add something for every feature that someone thinks up. (Plus they'd have to do a grid-wide update every 15 minutes.)

A better way would be to give each prim a little pocket where it can hold some arbitrary data to give to viewers that see it. There would be a hard limit on the size of the data (maybe 1k, or 5k), and it would be completely up to the viewer software to decide what to do with it. And of course, scripts would have to be able to read and write this data!

Ideally, objects and prims in SL should be sent as XML, kinda like this:

<primitive 
name="My Awesome Prim"
description="The best prim ever made."
shape="torus"
texture_uuid="top: [uuid], bottom: [uuid]"
contents="[first_item_uuid], [second_item_uuid]"
size="8m 2m 2m"
skew="80%"
awesomeness="23.5" />
Then the scripts could do something like this:
if( llGetAttribute( "shape" ) == "torus" )
{
llSetAttribute( "awesomeness", "infinity" );
}
Or if we had a decent scripting language, like ruby, it would be like this:
if self.shape == "torus"
self.awesomeness = "infinity"
end
And if you had a special viewer client that was programmed to understand the "awesomeness" attribute, the client could do something cool like write "This prim is so awesome!!" on your screen with a big squiggly arrow pointing to it.

That would be awesome.

P.S. If you're worried that this would contribute to sim load because of the increased amount of data being sent, remember that textures are the #1 cause of teen pregnancy sim lag. Plus, the sim could enforce a data size for the prim declaration, by dropping out some nonstandard attributes if it gets too big.

P.P.S. Yeah, I know this could be a big ol' security hole. What isn't? 'specially if you're using a custom viewer client provided by some homeless person down the street.

1 comment:

Torley said...

Jacek, thanx for expanding upon this with your technical insights; I had to smile upon reading of "The best prim ever made.".

I thought of another usage for this: a type of coded language shared by those with the same special viewer, in effect acting like an extended X-ray glasses. Staring at a sign that appears to look perfectly bland in the official viewer might contain a richness of secret messages when you're running on a modded client. Kinda like an SL "The Monsters are Due on Maple Street"!

Seriously though, I'm going to link to this from the internal issue — SL-34105 if you ever need to bring it up.

Thanx again!