Energy

From Second Life Wiki
Revision as of 08:38, 28 December 2008 by Marvin Macbain (talk | contribs) (spelling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

When certain dynamic functions are called from a script running on a physical object, the object loses energy. As the object loses energy, the effectiveness of dynamic functions on the object decreases. Energy is mostly relevant for large physical objects. For objects the size of an avatar or smaller, energy effects can generally be ignored.

  • What does "effectiveness" mean in this context?

Non-physical objects need not worry about energy, as main way energy is reduced is through llPushObject, llApplyImpulse, and llSetForce. Even very massive non-physical objects can run almost any script just as well as one 100x smaller.

Please describe how it works! Answer at least the following questions:

  • What's the energy content of an object?
    • It is a value from 0.0 to 1.0. It is not analogous to RL energy.
  • Is it possible to calculate the energy consumption of an action, e.g., running a script;
    • Yes, but it is involved.
  • When the energy is consumed how much time does it take to build it up again?
    • 200/mass units of energy per second.
  • During the energy build-up can we execute all actions needing less energy than the energy available?
    • Yes, but their effect will be diminished if the energy is less than 1.0.

Also

  • Does the script totally stop when it runs out of energy? Or pause?
    • Neither. The script is executed regardless of the energy level. Only the effect of those functions requiring energy is diminished.
  • Are events that occur during such an "energy pause" queued up so when it is restarted they are then triggered?
    • No. There is no pause in the script, nor queued events.
  • At what rate does energy return (so one can add pauses in scripts for energy to return)?
    • 200/mass units of energy per second.
  • Does an object's energy exist per-prim, or per-object (link sets)?
    • Per object.
  • How does Energy get treated on Avatars?
    • Under normal circumstances, an avatar is not subject to energy concerns.
This isn't precisely accurate... attachments on the avatar seem to have the same energy limitations as unattached objects -- Argent Stonecutter 10:13, 4 August 2007 (PDT)
  • How is energy used in scripts related to lag?
    • No direct relationship, to the extent that lag refers to things not happening in a timely manner. But energy constraints can make the movement of large physical objects erratic, which might be blamed on lag.


More (from Argent Stonecutter 07:18, 10 May 2007 (PDT))

  • If Energy is on a scale of 0.0-1.0, and I use llShout which uses "10.0 Energy", where do the missing 9.0 energy units come from? Can you elaborate on just what this means?
I believe the llGetEnergy returns the quantity of energy available divided by the total possible for the object. Since it is known that small and large objects regenerate energy differently this is a fair assumption. -- Strife Onizuka 20:29, 13 April 2008 (PDT)
Hypothesis: if I have an object with a mass of 1.0 kg it can call llShout 20 times a second, and if it calls llShout 40 times in a second this will leave it with 0.5 Energy. Is this correct?
No. The energy value of 10.0 in the header for each function in this Wiki seems to be a constant from a template and doesn't mean anything. Most lsl functions neither affect, nor are affected by, energy. -- Omei Turnbull 11:10, 13 April 2008 (PDT)
If it does have meaning then energy is regenerated faster then 10.0 (internal) units per increment of time as to not register a value. The energy values were extracted from the function setup code and those values are used to modify the script's energy register when a built-in function is called. -- Strife Onizuka 20:29, 13 April 2008 (PDT)
  • If you have 0.5 Energy, does this mean llShout would have a range of 50 meters instead of 100 meters?
    • No, distance is unaffected by energy.

AnnMarie Otoole asks: Does energy then serve any useful purpose? It appears it may only have a nebulous undesired effect on large physical vehicles and is obsolete. I would rather see an efficiency value listed for every function that indicates compiled efficiency. For example, how many llGetOwner()s do you have to do before it would have been more economical to declare a variable and use the variable name?