Jump to content

Does a 'rocking boat' create undue lag?


UnilWay SpiritWeaver
 Share

You are about to reply to a thread that has been inactive for 232 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

If I put a script into a boat that causes it to rock on the surface of the water on a timer - is that creating a lot of lag?

Essentially it's constantly adjusting the 'rotational coordinated' of the boat on a short enough timer to look like motion, and then stops doing anything if the boat goes 'physical'.

I put that into my boats a few days ago - but I'm starting to wonder if it's lagging my region having it in there - given how rare such scripts are maybe they're not used for a reason? So I just turned off the script (putting an error into it so it can't compile - to be sure it stays off).

But am I just being 'paranoid' about script resource? I do recall seeing a sim lag out years ago because an physics based explosion simulation had been left there on a loop - but that was due to physics collisions.

 

Link to comment
Share on other sites

i think the general scripting rule is to not run a script when there is no good reason to do so

rocking a boat is a good reason from an aesthetic pov

this said, we can use keyframed motion https://wiki.secondlife.com/wiki/LlSetKeyframedMotion

this gives a more smooth-looking rock

a caveat with keyframed motion is that the object can wander off track after a while. So we do need to check/reset the position of the object/boat on a timer, but we only need to do this once every some minutes. Unlike every part-second where our script is rocking the boat thru each step of an arc

 

Edited by elleevelyn
timer
  • Thanks 1
Link to comment
Share on other sites

Try LlSetKeyframedMotion. You can use that into loop mode, and have it rock the boat gently with no ongoing script activity. This is both more efficient and looks better than doing many moves with llSetRot.

Notes:

  • End position for keyframe motion must be the same as the start position for a smooth effect, or it returns to the start position in a sudden jerk.
  • Drift is possible. Once every 10 minutes or so, reset to the starting position.
  • When someone turns on the boat and it goes physical, allow about 2-3 seconds between using keyframed motion and using physics. SL has three motion systems (set pos, keyframe, and physics) which are not interlocked. Switching between modes without some dwell time results in bogus motion.
  • Like 1
Link to comment
Share on other sites

I agree that KFM is slightly less nasty than a dense enough sequence of llSetLinkPrimitiveParamsFast() calls to look like smooth rocking, although…

  1. Keyframed motion is constant between keyframes which means, for a simple pair of keyframes it will rock to one extreme and then abruptly reverse and rock back, instead of slowing to a stop and then reversing. One can add more keyframes, but that can approach the complexity of the same interpolation using the old kinematic approach.
  2. Adding to animats list: KFM is apt to run amok upon CHANGED_REGION_START, and STATUS_BLOCK_GRAB_OBJECT may come in handy.

Either way, a rocking boat will end up sending a bunch of object update messages to every viewer that has the boat in the corresponding interest list. That doesn't matter if there's nobody around to look at the boat, and it's not a hugely expensive update for viewers to handle anyway, but it's prudent to weigh the benefits of stuff that increases a sim's network or processing load as avatar count increases.

Link to comment
Share on other sites

  • 2 weeks later...
On 9/3/2023 at 8:34 PM, Qie Niangao said:

KFM is apt to run amok upon CHANGED_REGION_START,

Most definitely.

It is essential to have a "home" position to which the object can be safely moved to by llSetRegionPos, and in a changed event for Region restart, kill all KFM motion and set position to home before resuming KFM.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 232 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...