Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006884opensim[REGION] Scripting Enginepublic2013-12-06 14:512013-12-09 03:41
Reporterrazwelles 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSWindows 7 x64OS Version0.8.0 Dev
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0006884: llSetLinkPrimitiveParamsFast() updates come in out of order or not at all after a certain speed/rate. (Mesh Animation)
DescriptionAlthough some developers may consider this more of an abuse of the system, Mesh Animation is becoming an important/integral part of building. Custom avatars with blink and talk sequences, moving mechanical/machine parts for demonstrations for simulation purposes-- anything that would be simpler to animate in a 3D package and import as a set of frames rather than script/code with LSL would be ideal for this sort of situation.

I have a suspicion that these out of order updates may be related to http://opensimulator.org/mantis/view.php?id=5256 [^]

I don't actually know updates work under the hood, but if the same system is employed for prim updates as avatar updates, it could be that the viewer is still getting these out of order updates but the agent movement gets averaged out by the viewer whereas prim updates are showing it fairly clear.

I know the issue shows that its closed and resolved, but if you pay close attention to walking in SL and walking in OS, you'll see fairly minute bursts in speed in OS, even with a local standalone where ping shouldn't be an issue at all.
Steps To ReproduceRez 5 cubes, link them in order. Paste in the following script.

float animation_rate = 0.08;

default
{
    state_entry()
    {
        while(1){
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
                                        PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);
            llSleep(animation_rate);
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
                                        PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);
            llSleep(animation_rate);
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
                                        PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);
            llSleep(animation_rate);
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
                                        PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);
            llSleep(animation_rate);
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
                                        PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0]);
            llSleep(animation_rate);
        }
    }
}
TagsNo tags attached.
Git Revision or version number
Run ModeStandalone (1 Region)
Physics EngineBasicPhysics
Script Engine
Environment.NET / Windows64
Mono VersionNone
ViewerFirestorm 4.5.1 (38838) O
Attached Files

- Relationships

-  Notes
(0024849)
dahlia (administrator)
2013-12-07 13:58

I suspect that your updating of several prims over and over and doing it at a frequency similar to the simulator frame rate might be conflicting with the lazy UDP update queues and you may not be seeing all state changes in the viewer. Given that the update queues dont store object state, but only that a state change has occurred, the state of the object may have changed by the time the queue is emptied and you could miss a few updates. The only workaround I can think of is to slow down your script or change the methods you use to achieve the desired effect. Given the complexity of the UDP processing in OpenSimulator and the potential loss of efficiency of removing the lazy queues, I doubt anything will be done to improve the performance of your test case. You might however take a look at the keyframe animation functions recently added to the LSL API; they are intended for object animation.

Also you might want to not use llSleep() in your scripts. I've heard it can cause issues with the threading in the script engine. Timers might be a better approach.

Here's a modified script which appears to work on my woefully underpowered server:

/////////////////////////////////////////////////////////////////////

integer index = 0;

Step()
{
    if (index == 0)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);
       
    if (index == 1)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 2)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 3)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 4)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0]);
            
    if (index++ > 4)
        index = 0;
}

default
{
    state_entry()
    {
        llSetTimerEvent(0.16);
    }
    
    timer()
    {
        Step();
    }
}
(0024851)
razwelles (reporter)
2013-12-09 02:15
edited on: 2013-12-09 02:33

I tried this script, and interestingly enough I had issues at around the same speed as the sleep rate- 0.11sec is about where it starts to break down.

I tried writing a not_at_target solution, but I still saw the same issue.

Do you think it would be possible instead to get an OSSL function that took a list of prim link numbers and just sent out a set of updates that cater specifically to mesh animation?

The OSSL functions are pretty nice, as they tend to cater to issues LSL coders in SL have been craving for a while. Having OSMeshAnimate([list_of_prim_links],FLAG_PING_PONG); or something would be excellent.

(0024852)
dahlia (administrator)
2013-12-09 02:58

Personally I'd rather see a "real" mesh animation solution that involved bones, but this would require changes on both viewer and simulator sides, probably much more on the viewer than the sim.

The problem is not in llSetLinkPrimitiveParamsFast(), it is successfully changing the objects as intended. The problem is in the rate at which object state changes can be repeatedly changed and have those changes successfully communicated via UDP to the viewers. Adding a OSSL function will not help if you repeatedly toggle a single state parameter too quickly. Only the most recent state is sent to the viewers at the time the update queues are emptied, and if you toggle a state back and forth between times it's emptied, the viewer will not see them. It's probably possible to hack and patch in a special function that avoids the lazy queues but the resulting code would be horribly spaghetti-ish and probably impossible to maintain. Unfortunately until a proper mesh animation system comes to fruition, you'll likely need to consider other techniques to accomplish an effect similar to that which you originally planned.

I believe there is a ini parameter which can allow a shorter timer interval:
MinTimerInterval (in the [XEngine] section in OpenSimDefaults.ini)
(0024853)
dahlia (administrator)
2013-12-09 03:41

this script appears to work for me, perhaps alter your technique to use something similar?

////////////////////////////////////////////////////////////////////////

integer index = 0;

Step()
{
    if (index == 0)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5]);
       
    if (index == 1)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 2)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 3)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0]);

    if (index == 4)
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,2,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,3,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.0,
            PRIM_LINK_TARGET,4,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5,
            PRIM_LINK_TARGET,5,PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0]);
            
    if (index++ > 4)
        index = 0;
}

default
{
    state_entry()
    {
        llTarget(llGetPos() + <0, 0, 10>, 1.0);
    }
    
    not_at_target()
    {
        Step();
    }
}

- Issue History
Date Modified Username Field Change
2013-12-06 14:51 razwelles New Issue
2013-12-07 13:58 dahlia Note Added: 0024849
2013-12-09 02:15 razwelles Note Added: 0024851
2013-12-09 02:20 razwelles Note Edited: 0024851 View Revisions
2013-12-09 02:33 razwelles Note Edited: 0024851 View Revisions
2013-12-09 02:58 dahlia Note Added: 0024852
2013-12-09 03:41 dahlia Note Added: 0024853


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker