Wednesday, May 10, 2006
Tornado
As those of you who've been to my little slice of SL know, I've had tornados for the last few weeks. Or, at least, my inadequate and stylized versions of tornados. Based on my minimal experience with the natural disaster in question, these are the sketchiest hints of the real thing. This is probably for the best. I expect that a giant funnel of destructive force sweeping across the sim and rending everything in its path wouldn't be as well received by the neighbors.
As it stands, they're an occasional harmless display for visitors to the Garden of Mo. But taming them proved to be an interesting task. The trick was designing natural and apparently random wandering movement into them, without allowing them to leave my property. (Even in SL, folks tend to get a bit uptight when rogue 18m tall whirlwinds bumble through their living rooms.) As a failsafe, that's relatively easy: just have the script check to see if it's on my property, and delete itself if it is not. But a tornado that makes a beeline across my land, only to disappear in seconds, isn't all that entertaining.
This is where I probably made things too complicated. The tornado's movement (in this case) is controlled by two factors: wind direction and distance from beacons. The latter are simple invisible prims scattered around the property. Every couple of seconds, the tornado checks the current SL wind vector, and determines the direction and distance to the nearest beacon. Then, the script creates a movement vector determined by these three values. If the tornado is near a beacon, then it will mostly follow the wind vector. But as it moves further from a beacon object, it applies more force towards pushing the tornado back to the beacon. So, as it moves, it meanders in the general direction of the wind, occasionally backtracking to the nearest beacon. And since there are multiple beacons (I needed 18 of them to cover the "J" shaped parcel while avoiding neighboring plots) scattered about the plot, and the SL wind is everchanging, the tornado's movement is nicely unpredictable.
Beyond that, tornado control is a mostly a matter of lag control. I was concerned about a free-roaming physical object and its impact on sim loads. Realistically, the impact is minimal. I've seen parcels that had dozens of physical leaves bouncing and blowing around in the wind (see the spectacular Valley of Autumn (Mocha, 64,222) for an example), with no perceptible lag issues. But, I might as well be frugal when I can. In this case, that means using sensors (with long cycle times) to check for an audience. If someone walks into sensor range, and said someone is actually standing on my land, then there is a chance that a tornado will be rezzed. This tornado will time out after 5 to 10 minutes, then another will be rezzed a few minutes afterward, if someone is still around to see it. Net result is the tornados won't be a drain on system resources unless another avatar is around to enjoy it. Seems like a reasonable enough precaution to me.
As natural disasters go, the GoM tornados have been good for my social life. I've met quite a few folks who stopped in to watch the whirlwinds whirl by. It seems to be something of an attraction. The DJs for Twister Radio saw them, too, and ended up commissioning a modified version for their events. Their version is designed to work from a single beacon, and optionally throws avatars into the air on collision. I've never been to an event where the Twister Twister was used (that would require me to be sociable, and thus be completely out of character), but I'm told it's gone over pretty well. It's nifty to be a small part of events like that, in any case.
I should mention that the initial alpha and beta stages were a cooperative project between Sophia Weary and myself. She had the original idea to make a tornado, and developed one version of the script. I ended up redoing it from the ground up, and bloating it significantly in the process, but used some of her ideas. Thanks, Soph!
Oh, if anyone is interested, there is an attachment version, the Human Tornado, available at Mo-Tech. I'm using it to terrorize Baffin sim in the picture above. It has a moderate push effect (launches avatars into the air, but not into orbit) on contact (optional, easy to turn on and off), authentic whooshing air noises, particle effects, and comes equipped to rez various barnyard animal cutouts for use as targets. It's surprisingly cathartic to dress up as a tornado and launch mooing cows, clucking chickens, and oinking pigs dozens of meters into the air.