Sunday, July 13, 2008

A Script Generator for Second Life

Anyone who scripts in Second Life knows that the scripting language has a pretty steep learning curve, especially if you are not used to event driven programming. So it would be nice to have a code generator-maybe something a novice could use. Well today a post on SLED, the Second Life Educator's list, had a brief mention of a system called Scratch for Second Life (S4SL).

S4SL can be down loaded for Macs and Windows machine. I tested the Windows version on my home Vista machine and hope to test the Mac version on my iMac at work later this week.

S4SL is developed by Eric Rosenbaum at MIT, using Scratch . Scratch allows you to program graphically by snapping together little "modules." It sounds like a lot of fun in itself! But getting back to S4SL, the program has 8 classes of modules including one called pen which apparently requires an extra set of tools. Here is the opening window loaded along side the Second Life client. The left hand part of the window shows the eight modules, and the shapes associated with motion commands.

opening screen

Click on the image to go to my Flickr stream to see a large version of this screen. The basic idea is to snap together modules in S4SL. Then you press the copy code button. This copies the generated SL script into your clip board. So all you need to do is to rez an object SL, and paste the code in place of a new script.

S4SL is loads of fun and I spent a delightful evening making little Second Life "pets" that follow my Avatar around. The next image shows a Scratch program for a pet that exhibits random motion, but then attempts to find my avatar if it gets too far away.

Image3

The "modules" are color coded based on function and notice how the "modules" can be snapped together. This sort of approach ought to be appealing for novice programmers including biology types who are of course used to thinking of shape as related to function.

There are some limitations to S4SL. First, since it is in development, only some of the capabilities of SL's language are implemented. The code is fat, meaning there is a lot of non functional material in the code depending what sorts of features are enabled or disabled. Also the resulting code, because not everything is implemented may not work the way the user expects.

Originally I pasted the script into a cube prim for testing but it so happened I had a flexi prim representation of a phospholipid hanging around and I thought it would make a cool bacterium complete with flagella. So here is a brief movie (A still is here) of the resulting "bacterial cell:"



I think S4SL has a lot of potential as a learning tool. For instance someone interested in behavior could use the system, as my example suggests, let students design bots which mimic different sorts of orientation behavior. Students without any programming experience can give their simple prims behaviors and there are good pre-made S4SL projects that come with the down load to show how this can be done.

S4SL, a neat learning tool and lots of fun and it doesn't require any scratch for the fun.
Post a Comment