Friday, April 20, 2007

Better Mousetrap

The schedule board at Rockcliffe University, while it looked nice, I'm told it was quite horrible to actually use. It required all sorts of strange configuration via notecards, making the weekly schedule change a nightmare.

I thought there had to be a better way. So I made a similar board - by tapering a box and then mashing it flat, three different letters could be put on a single prim. But instead of arcane configuration, I set it up so you could simply drop a notecard on it, and the text of the notecard would be displayed on the schedule board. Not too bad!

But it was kind of hard to read, and I thought it might be nice if you could change the colors for each line (or groups of lines by day), and added in a #color command which wouldn't be printed, but would set every subsequent line to the specified color, until it was overridden by another #color command. (Shown to the right; click image for a larger view. Classes which had already taken place appear in dim characters.)

And yet I still wasn't satisfied. I was already planning a Web-based schedule database, so the teachers could go in and schedule their classes, which would then appear on the Web site's calendar - so why not also automatically update the board whenever the schedule changed, or a class was over?

This required delving into the XML-RPC functions - which was an interesting learning experience in its own right. But while I was doing that, someone on the Scripters of Second Life group mentioned offhandedly that you could get five letters onto a prim. Well, that sounded like a fun challenge - not to mention cutting the number of prims by 40% - so I set about trying to do so.

Here's a graphic showing the stages of making a 5-letter text segment:

First, we start with a prism. This is the fourth icon on the "Create" pane, between the pyramid and the cylinder. I've colored the front faces red and black just for reference.

Second, set the Taper X and Taper Y both to zero, to get rid of the point on the top and make the edges straight.

Third, set the Path Cut to B=0.2, E=0.8. This cuts a wedge out of the front of the prism, giving us the faces which I've colored green and white. Those particular values leave the red and black faces each taking up one-fifth of the prim's width.

Fourth, set the Hollow to 65. This cuts into the green and white faces, showing us the interior between them (colored blue.

Fifth, set the X size all the way down to 0.010, which flattens out the prim as much as possible.

And sixth, scale the prim so that it gives us a good height-to-width ratio for text. I scaled it to <0.010,0.964,0.250> so that the letter faces were the same size as the ones on my previous version.

Next came setting the texture offsets. If you just tried to put a texture on the faces, they'd look okay on the second and fourth faces, but stretched out somewhat on the first and fifth faces, and REALLY stretched (and backwards!) on the middle face.

So if we were just going to apply a texture with a single letter to each, we'd have to change the texture repeats and offsets. From left to right:

  1. Repeat 2.5 horizontal, 1 vertical; offset -0.25 horizontal, 0 vertical.
  2. Leave at the defaults (repeat 1 horizontal, 1 vertical; offset 0 horizontal, 0 vertical).
  3. Repeat 15.4 horizontal (flipped), 1 vertical; offset -0.2 horizontal, 0 vertical.
  4. Leave at the defaults.
  5. Repeat 2.5 horizontal, 1 vertical; offset 0.25 horizontal, 0 vertical.
With those settings, you would just need to swap the textures for each face in order to display a different letter. (I did it somewhat differently, though - I made a texture with the lower 128 ASCII characters arranged in a grid, which requires a bit more computation every time the letters change.)

I'm still writing the database portion of the system, but to test the XML-RPC communication, I wrote a quick script on my Web site to contact the board in-world, display the version and time, and then include the output of the Linux fortune program, adding #color commands as appropriate:

Now I just need to add in sequence numbers so that if the Web server doesn't receive a response to its communication, it can resend it, and the schedule board won't duplicate the information if it already received it but its response was lost. And then finish writing the database front-end, of course. But still, not bad for a couple days' work!

Wednesday, April 4, 2007

Fantastic Inspiration

In Spaceport Bravo is the most amazing build I've seen in Second Life so far: a detailed reproduction of the Apollo Lunar Excursion Module. I thought I was obsessive about detail, but the scope of this build just awed me.

Lora Chadbourne, the creator of "Snowflake" (as she calls it) tells me it comprises 2370 prims and took her a month to build. And it shows, from the bracing on the inside of the hatch right down to the prim bolt heads.

A view of the exterior, compared with a picture I took of the real thing at the Kennedy Space Center:

Looking in through the front hatch:

And the control panels at which the astronauts stood (again compared with the real thing):

Utterly amazing, humbling and inspiring.

Monday, April 2, 2007

In the Webcomics

Sore Thumbs seems to have some familiarity with Second Life.