TOWARD MINIMIZING SCRIPT USE TIME

INTRODUCTION

In my previous blog, I looked at the typical total script time used by attachments worn by avatars in a region.  As I mentioned there, monitoring script time is more important that monitoring the number of scripts although the two measures are correlated.

In this installation, I’ll look at various sources that contribute to script time.  First, we need a tool that allows us to measure our script time.  I looked at several on the SLMarketplace.  The one I like the best can be gotten for free at https://marketplace.secondlife.com/p/Script-Usage-Meters-MP-Series/2704917.  It’s called the Script Usage Meter.  There are several versions of it.  I like the MP version since it allows you to wear it as a HUD.  For each avatar in the region, it looks at all attachments and HUD’s and reports the number of scripts in them, how much sim memory they are using and, most importantly, the average script time being used.  It is updated every 30 seconds or so.

It’s a great tool if you want to monitor what everyone’s script usage is in the region.  It also has various options, available by touching it, including the ability to report your own usage, which is what I was interested in for this article.

For this article, I wanted to look at the script time contribution of various specific attachments.  The most reliable way to do that is to remove ALL attachments and HUD’s you may be wearing.  That is, when you look at your own statistics, the number of scripts should be zero.  You can accomplish this by just wearing system clothes with no attachments.  If you are using a viewer with a bridge, like Firestone, make sure to detach that also by navigating to it in your inventory.

Now just add the attachment you want to look at.  Wait a minute or two for the Meter to update and stabilize on a particular value.  I’ve found that it sometimes takes about 3 minutes for reported times to stabilize.

You may ask, “Why can’t I just add the new attachment to those I’m already wearing and just take the difference of the two measurements?”  Well you could.  But if those other scripts have events occasionally kicking in, they could use script time now and again.  So could end up with measures that are contaminated by the variability in what you are wearing.  So better to take it all off and just add what you want to measure, one at a time.

I took a look at 4 classes of typical attachments: hair, shoes, jewelry, and ao’s & posing huds.  Since I found the same script use patterns in hair, shoes, jewelry and other clothing items, I’ll lump those together.  Ao’s and posing HUD’s I will address separately, since they function somewhat differently.

ATTACHMENTS & ACCESSORIES

The first group, the body and clothing attachments and accessories, very often come with scripts that allow the user to resize the item and perhaps retexture or recolor some of the components.  Some may allow you to show or hide certain parts of the object.

In the early days of SL, these types of scripts were not commonly used.  A modifiable object could easily be resized and recolored or retextured by the user in edit mode.  This allowed a lot of flexibility and kept script use to a minimum.  Many of my older shoes and hair allow this.

However, many designers did not like users changing their creations even if it was not possible for them to resell the items.  To keep creative control, they made their objects non-modifiable and included scripts to allow resizing and recoloring within a limited range.

There seem to be a couple of approaches to accomplishing this.  Some creators put a script in EVERY prim that has to be changed which are then controlled by a master script.  Some even have a script for every type of thing they want to change.  It’s not unusual for items like this to have hundreds of scripts.  As I mentioned in my previous blog, each script uses a minimal amount of script time just to monitor for events and other housekeeping.  It’s not unusual for items like this to be using in the neighborhood of 0.250 milliseconds of sim time per frame.  So one item like this could put you in the 90th percentile of typical script use time (see previous blog).

Designers that take the above approach don’t realize there is no need to do this.  Most of the same functionality could be accomplished with one well written script.  SL provides a scripting function called llSetLinkPrimitiveParamsFast that allows the scripter to control most aspects of a link set from one script.  Objects that use this approach will contribute in the neighborhood of 0.001 to 0.005 milliseconds of sim time per frame.  Many creators are moving in this direction.

Some designers who are wedded to using the multiple script approach are at least including a menu function that allows the user to delete all the scripts in the object once all modifications have been made.  I found that this does not always do what is advertised … some scripts often remain.  And, you have to be careful to do this on a copy of the object since you lose the ability for further modifications once you remove the scripts.

So if you are monitoring your script use with the script meter and see your script times way up there, start taking off items and see how it affects script time.  Jewelry is a big offender since it tends to have many prim in a link set.   Hair and shoes can also be problematic.  Sometimes I have to take it all off and just add one item at a time to see what it adds.

AO’S AND POSING HUDS

For all the hype about removing AO’s at events, I found AO’s and posing HUD’s to contribute minimally to script time usage.  This was surprising to me.  As a scripter I know that such items often are executing code multiple times a second.

I looked at 8 commonly used AO’s: Huddles EZ animator, Abrimations Fem AO, Franimation v1-7, AutoZHAO-II,HJAO Basic, Oracul, SE Motions, Vista-ZHA.  The EZ Animator includes many extra features and has many scripts in it.  Not unexpectedly, it used the most script time: 0.070 ms.  Even that is only about a third of what is contributed by some hair and jewelry.  The others were in the 0.015 to 0.030 ms range.

Many models use multifunction posing HUDS on the runway.  These often combine a pose player with a modified AO that serves as a walk replacer.  I looked at: The Balut Runway HUD, the Huddles Catwalk, the BehaviorBody WO Catwalk Series I, and the NYU Concepts HUD.  These were in the same range as the AO’s above.

Some models use a walk replacer along with a dedicated posing HUD for their poses.  I looked at the Balut EasyPose, Balut Posing Matrix, Huddles Quickpose.  These used very little script time, generally in the 0.001 to 0.009 ms range.  Having created a couple of these, I know why.  Unlike the others mentioned above, they do not contain an AO component to handle the walk.  It’s generally the part of the script that handles walking that uses most of the script time.

This is borne out by looking at HUDs or attachments that function solely as walk replacers.  The Balut Multi-Walk Replacer is a good example.  It’s really a stripped down version of an AO that handles just the walk animation state.  It contributes 0.015 ms of script time, at the low end of the AO’s described above.

Many models use a walk replacer and play their poses manually or via a posing HUD.  Most of these walk replacers are really just AO’s that have configured just the walk part of the AO in the set up notecard.  People who use a walk replacer like this and play their poses manually, contribute about the same amount of script time as someone using a full AO.  Those that use a walk replacer along with an additional posing HUD are actually contributing more script time than those using a full featured posing HUD.  I am most familiar with the Balut Runway HUD since I created it.  It contributes 0.014 ms of script time per frame.  This is about the same as using just a walk replacer alone.

Someone gave me a copy of something called Walk Replacer which apparently is given out by Avenue in its modeling school.  It’s a simple walk replacer worn as an attachment on the body, not as a HUD.  It was the most efficient of the simple walk replacers, 0.001 ms.

So what should script conscious models make of all this?  If you want to use a scripted HUD or attachment to control your runway walk, using a full-featured HUD is about the same as just using a walk replacer and certainly better than a walk replacer combined with a pose player, but we’re talking script times in the neighborhood of 0.014 to 0.05 ms here, a small fraction of what is contributed by just one poorly designed hairdo.

My point here is, don’t feel guilty about using a walk replacer even combined with your favorite posing HUD.  It’s no big deal.

But if you are obsessed with eliminating every iota of script time from the show what can you do?  The (Avenue) Walk Replacer or the AO built in to many viewers like Firestorm contribute little or no script time.  Use that along with playing your poses manually.

CONCLUSIONS

Badly scripted attachments with many scripts like many hairs, jewelry, shoes or clothing are the items that contribute the most script time use to a sim.  Concentrate on removing those scripts or avoiding those items and your contribution will likely be below the 50th percentile.  Asking people to remove AO’s or banning the use of posing HUD’s does not give much return for the extra hassle they cause.  One badly scripted hairdo will contribute the same script use time that 15 AO’s or full featured modeling HUDs will contribute.

Advertisements

~ by monicabalut on November 25, 2012.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: