A potential way to drastically reduce lag: Script deactivation
|
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
01-23-2005 08:37
This idea came to my mind yesterday as i went out to eat a pizza, there was no one at home so before going out i simply turned off all the lights. Then i thought: why not allowing people to "turn off the lights" in SL as well? OF course i am not talking about the lights themselves, but scripts. As everyone knows scripts (exèpecially listens and timers) are as of now a major source of lag in SL and many of those scripts run continuously even when they are not used at all (a simple example are the famous animation balls with their hide option commanded by a listen or veichles left there just for shows and tat are used maybe 1% of the time they are left there running) How to adress this? A simple solution would be adding a new flag to prims (they could call it "Active"  that is not influenced by permissions(even if you can't mod an item you still can operate the flag if you are the owner). When this flag is checked the item behaves at normally, the server reads the scripts inside it and operates them normally. When the flag is unchecked the server doesnt go beyond the rendering of the item itself but any script inside it is not operational at all. It doesnt listens, timers are not executed and so forth. It becomes completely dormant. This would allow the owner of an item to simply "turn it off" when he is not using it, and "turning it back on" when he needs to use it, with a simple click. A further inprovement would be to be able to actually "turn off all lights" in a property with a single click. They could add another switch on land that allows you to immediately uncheck the active flag on all items owned by you on that land. This way you would still be able to immediately reactivate the few items that you need to leave running (for instance vendors) and then safely go to bed, knowing that your items are not causing lag and that you are contributing to server performance. A last (but not least) improvement would be adding to lsl a simple command called llDeactivate, allowing scripters to script their items so they can deactivate themselves under certain conditions. I don't know by what percentage this would reduce the average lag in servers, but if enough people took their time to do a simple couple of clicks when they stop using a scripted item and to do another when they are gonna use it again (its in their own interest to prevent lag in their sim after all), the server load would be for sure reduced. Just think of the possibilities: a club owner able to turn off his club when there is no one in it... All those pose balls causing lag ONLY when they are actually used... parked veichles finally not polluting the environment anymore... the list would be much longer than this. I hope the lindens will consider this proposal, sure, it's not a completel solution to lag, but reducing it it's far better than nothing.
|
|
Zuzi Martinez
goth dachshund
Join date: 4 Sep 2004
Posts: 1,860
|
01-23-2005 10:05
you can pretty much do all of this now without too much extra effort. i've got scripts i wrote that only turn on a llListen when it's needed and turn it off after it's used, scripts that turn off everything when no one is around for a few minutes etc and i have a method to do the whole "turn off all the lights on your property in one click" thing. your suggestions might make it slightly easier but...... but............. you still got to get people to use them.  the big unmotivation to be efficient comes when you get done bleeding for days to make sure you're scripts are lean and next door is 10,000 lights and a particle volcano and every prim has a llListen. please don't anybody suggest LL starts reviewing every script for efficiency or something. we'd be better off if people just spread the gospel of good scripting since we have the ability to do this stuff now and even with these suggestions we'd still have the ability to be inefficient.
|
|
Unhygienix Gullwing
I banged Pandastrong
Join date: 26 Jun 2004
Posts: 728
|
01-23-2005 11:07
There are a number of tools/items that I'd like to see developed so that "Good Neighbors" can responsibly take care of their sim; however all of them would require cooperative efforts; the more people that chip in, the better the sim's health will be.
Not knowledgeable enough (yet) about scripting to do them myself; but perhaps in ahwhile; I'm still kicking them around in my head.
|
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-23-2005 11:11
A little evangelism can help reduce lag. I've flown around my sim investigating my nabors scripts and found-out several of my nabors were using a goo scripts left over from the early days of sl. Thanks to some help, now they use particle scripts. I wish there was an easy way to spread the word about goo, and how the alternative improve performance.
Wouldn't it be cool if there was a change event that would be triggered when the avatar loged in or out? that way object could be script to only work when the owner was loged in. With out needing to scan constantly for the avatar?
right now we already have a way to disable scripts. If LL included a right click option to turn off or on all scripts in inventory of a primtive. For now we can script scripts to turn off other scripts.
|
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
01-23-2005 11:27
I know that you can put an option in the script that turns it on and off, but implementing a flag in items would have advantages over that: 1: would be much easier to use, and easier means it would be used more widely 2: it would let the server ignore the WHOLE script, thus reducing lag more
|
|
Jsecure Hanks
Capitalist
Join date: 9 Dec 2003
Posts: 1,451
|
01-23-2005 11:34
Isn't there a "running" tickbox at the bottom of the code screen of scripts? Even if you can't edit the script I think you can untick that box
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
01-23-2005 11:37
We already have functions in the LSL library to do what you ask, such as llSetScriptState. Here's a script to toggle the scripts on and off in an object: integer scriptsRunning = TRUE;
default { touch_start(integer totalNum) { // Toggle the flag. scriptsRunning = !scriptsRunning; // Apply flag to scripts: string myName = llGetScriptName(); integer numScripts = llGetInventoryNumber(INVENTORY_SCRIPT); integer i; for (i = 0; i < numScripts; i++) { string scriptName = llGetInventoryName(INVENTORY_SCRIPT, i); if (scriptName != myName) { llSetScriptState(scriptName, scriptsRunning); } } // Notify the user: if (scriptsRunning) { llSay(0, "Scripts activated."); } else { llSay(0, "Scripts deactivated."); } } }
The only problems I can see in this method are when this script is used in objects you dont have full control of. If the sim hiccups and isnt able to restart one of the scripts, then your object is, at least partially, dead. Also, Im not sure if toggling the script state has an effect on any active event handles (listens, sensors, timers, etc) the script has, so this might not even do anything. I cant get in world to test it atm  All that's missing here is a conveniant UI checkbox that does this. ==Chris
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
01-23-2005 11:40
From: Kurt Zidane Wouldn't it be cool if there was a change event that would be triggered when the avatar loged in or out? that way object could be script to only work when the owner was loged in. With out needing to scan constantly for the avatar? You could create something equivelant to this by asking the dataserver every so often for the online status of the owner via llRequestAgentData. ==Chris
|
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-23-2005 11:57
lol yes, but that requires a timer. I guess a properly set timer wouldn't cause sim lag. I was just suggesting a push system.
|
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
01-23-2005 12:24
And what if I create an object that could potentially break something else if they deactivate it?
There's a reason some of us make our objects no-mod.
Do you honestly think that people are going to remember "Oh, hey, I'm about to log out of SL, I should go to my plot, individually select every prim I've got that has a script, and turn them all off one by one by hand," only to have to do the same thing all over again when they log back on? No. The "active" box on a prim will only end up being a nice hacker tool for people who want to get around various coded protections.
_____________________
</sarcasm>
|
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
01-23-2005 12:26
I know Christopher, but that would require everyone to modify their old scripts and i doubt many would, while adding the option to prims would make it functional even for old scripted items (even without cointing the fact that for sure not all scripters would add it, even only becausze some for sure don't know how to). This would let total control of the deativatio n of a script to the owner of the item, making it easier and more intuitive
|
|
Zuzi Martinez
goth dachshund
Join date: 4 Sep 2004
Posts: 1,860
|
01-23-2005 12:38
From: someone 2: it would let the server ignore the WHOLE script, thus reducing lag more i was under the impression that if a script isn't doing anything it doesn't add to lag. so if you turn off your llListens and timers and it's just sitting there waiting for an event to fire that might make it do something the sim pretty much ignores it. it's only active parts of the script that matter. is this wrong? might be better off if the Lindens just concentrated on making the servers run scripts more efficiently since that would have the greatest benefit. after all the majority of scripts will always be written inefficiently no matter what tools we have to make them more efficient ourselves. obviously both are nice but if you gotta have one it seems like overall script efficiency is better than user dependent script efficiency.
|
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
01-23-2005 13:24
Yes zuzi, i absolutely agree, but implementing a better overall script efficency will probably take lots of time and experiemnting, so i doubt it will be anytime soon. Instead i think that adding a flag to items wouldnt take too much, count it as a placebo until the script efficency can be made better. And even if they improve the overall script efficency, being able to completely turn them inactive with a simple script can't hurt, isn't it?
|