Jump to content

llSetLinkPrimitiveParamsFast in large quantities bug.


Eliwood407
 Share

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

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

Recommended Posts

 

Good day!

EDIT:
A workaround for the issue has been found, changed the post to explain the problem and a workaround.

Problem:
When having a linkset of multiple objects, and wanting to change all those object's textures/alpha/color using llSetLinkPrimitiveParams(Fast), can cause the clientsided-viewer to not show all texture/alpha/color updates.
Example:




The above GIF image showing two tests, of 100 prims changing color through two different ways.
You can see some prims refuse to update their color, this is a client-sided problem as server-sided they actually DID change color.

A possible workaround:
While experimenting with this problem, I have noticed that inventory changes causes the server to force update the linkset on your client. I stumbled upon this when I clicked "New Script" while the textures of my linkset were not properly updated.
This fixed it. So to fix this issue, make the script (or an other script) reset itself after the changes have been made.

Example of the script:



 

This will ensure that any faces/prims that fail to update on your client, will be forced to update the moment the/a script resets in that linkset. 

Link to comment
Share on other sites

It's hard to do anything but guess wildly without seeing the script(s), but I'll suggest two things to study:

1.  The llSleep function does exactly what it says.  It causes the script to be completely unresponsive until the sleep period has ended.  That is, it cannot detect any messages or respond to stimuli.  It is "comatose".  That is in contrast to the much better alternative, which is to use a timer event.  A timer is triggered at the end of the period you set with llSetTimerEvent an dit does NOT prevent other events from happening.  It is generally advisable to use llSleep sparingly and only for very short periods of time when you can be sure that the script will not be likely to miss important input.

2.  The llSetLinkPrimitiveParams function, used properly, can affect any links that you identify within a scripted object.  Functions like llSetTexture, llSetColor, and llSetAlpha only affect the links that they are in.

It's also worth pointing out that if you have several scripts running in the same object, they may be creating a race condition, competing with each other to change the state of the object.

Link to comment
Share on other sites

I'm not remembering the details now, but not that long ago this was a huge problem, where some object updates from the sim weren't seen by viewers. I really haven't seen that lately, but I'm not sure if that's because it's mostly fixed or if I'm somehow not looking at affected content. 

Anyway, my suggestion would be to replace multiple calls to llSetLinkPrimitiveParamsFast with a single such call using PRIM_LINK_TARGET to specify individual prims to be updated simultaneously. It may or may not help, but it's worth a try, and even if it doesn't solve the problem it's much more efficient to batch all those little updates.

[ETA: I just noticed "Some even in multiple scripts." Yeah, don't do that. If there's any possible way to avoid using multiple scripts, pull everything together. There's no modularity bonus. If memory is a real problem, okay, or other very unusual circumstances, but mutliple scripts generally suggest lax design.]

Link to comment
Share on other sites

To specify the problem further:

Here two different tests, both failed to be reliable.

https://gyazo.com/b7854eba4b2d3e3ece931013bba31999
Gif showing the two tests.

Green:
Linkset of 101 prims.
1 script in the root prim:

integer beep;default{    state_entry()    {        llSetTimerEvent(5);    }    timer()    {        if(beep)        {            llSetLinkPrimitiveParams(LINK_SET,[                PRIM_COLOR, ALL_SIDES, <1,1,1>, 1]);             beep = !beep;        }        else        {            llSetLinkPrimitiveParams(LINK_SET,[                PRIM_COLOR, ALL_SIDES, <0,1,0>, 1]);             beep = !beep;        }    }}

Also tested with llSetLinkPrimitiveParamsFast(LINK_SET,...); same results.
Shows to be about 7% inaccurate.

Red:
Linkset of 101 prims.
1 script in all prims:

integer beep;default{    link_message(integer link, integer i, string msg, key id)    {        if(msg == "change")        {            if(beep)            {                llSetPrimitiveParams([                    PRIM_COLOR, ALL_SIDES, <1,1,1>, 1]);                 beep = !beep;            }            else            {                llSetPrimitiveParams([                    PRIM_COLOR, ALL_SIDES, <1,0,0>, 1]);                 beep = !beep;            }        }    }}

1 script in root prim:

default{    state_entry()    {        llSetTimerEvent(5);    }    timer()    {        llMessageLinked(LINK_SET, 0, "change", NULL_KEY);    }}

Proves to be about 3-4% unreliable.

I can conclude from this that using a script in each prim seems to be more reliable, at the cost of memory.
My project does not have 100 prims, but this is just a test showing the issue.
Of course I want to prevent using 1 script in each object, hence why I am hoping anyone has a workaround for this.

EDIT: Will test PRIM_LINK_TARGET on my project.

Link to comment
Share on other sites


Qie Niangao wrote:

I'm not remembering the details now, but not that long ago this was a huge problem, where some object updates from the sim weren't seen by viewers. I really haven't seen that lately, but I'm not sure if that's because it's mostly fixed or if I'm somehow not looking at affected content. 

 
[ .... ]

I wouldn't say that it's a huge problem any more, but it is still an issue, especially with mesh objects for some reason. Typically,  I see delayed or failed texture and color changes if I have a script that is switching textures repeatedly to simulate movement.  And then, of course, we all have seen ghost objects that remain visible after they have been deleted, until you click on them.

Link to comment
Share on other sites

There's actually an easier solution, which I had forgotten until recently.  All you have to do is update any prim property, like a hover text.  Change

llSetText("This is a text",<1,1,1>,0.0);

to

llSetText("This is NOT a text",<1,1,1>,0.0);

for example.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2829 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...