# Understanding PE: Server Weight & Scripts

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

## Recommended Posts

﻿I think that the recent confusions about how Scripts influence the Prim Equivalent of meshes needs to be clarified. So here is my attempt to explain it:

First of all, you must know that there is not a "duplication of PE due to adding a script" . The correct term is: "duplication of the Server Weight per prim due to adding a script"﻿﻿. The following explanation and interpretation is based on the wiki page:

Please also remind, that PE = Maximum of (Server Weight, Streaming weight, Physics weight)

Since Scripts come into play only in the calculation of the server weigh, adding scripts matters only, if ServerWeight is the dominant weight (which is rarely the case)

Here is how ServerWeight is calculated (currently):

Server weight(per prim) = cost_scaler * (active_cost * (per_prim_cost + base_cost / num_prims) ﻿

The settings (since august-8-2011) are as follows:

dynamic_multiplier = 2.0
static_multiplier = 1.0
per_prim_cost = 0.5
base_cost = 0.0 ﻿
cost_scaler = 1.0

Hence the formulas can be rewritten as follows:

﻿    Server weight(per prim) = cost_scaler * (active_cost * (per_prim_cost + base_cost / num_prims) ﻿﻿
Server weight(per prim) = 1.0 * (active_cost * (1/2 + 0.0/num_prims)) ﻿
Server weight(per prim) = active_cost * 1/2
ServerWeight = 1/2 * active_cost  * num_prims

For objects without scripts:

active_costs = 1.0
Server Weight = 1/2 * number of prims in linkset

This implies: If the linkset contains exactly one prim, then Server Weight = 0.5  -> rounded up to 1.0)  Hence PE=1 is now possible for Mesh prims.

For objects with scripts:

active_costs = 2.0
Server Weight = number of prims in linkset﻿

This implies: If the linkset contains exactly one prim, then Server Weight = 1.0 hence adding a script to a one prim object results in ServerWeight=1.0

Example:﻿

If your object contains 200 Prims, and you add ANY(!) number of scripts to it, distributed on your prims however you like, then the Serverweight will become:

ServerWeight = number of prims in linkset
ServerWeight = 200

Conclusion

Only if your object's streaming weight AND physics weight is below number of prims, then adding a script to the object has an effect at all.

﻿

• 2
##### Share on other sites

That is going to confuse SO many residents, who are used to 1 prim = 1 prim.

Maybe it's LL's way of increasing land sales?

##### Share on other sites

It is meant to help decreasing Lag.

• 1
##### Share on other sites

I still wanna know why, on my importing screen, I can get models as low as 1.5 PE there, but it magically raises to 2 PE once inworld?

I'd like to see PE display the true mesh weight, but maybe this is impossible for whatever reason... How can a 4 triangle mesh count as 2 prims, when some prims variations are over 8000 triangles?

I get how fractional prims might just want to be avoided, a base unit makes sense.

Yet..... surely it should be possible to make a 1 prim mesh, no? :matte-motes-bashful:

BTW I just did it for my first time.. added a script to a model & it didn't add anything to PE! :matte-motes-grin:

It looks like in my application, scripts will typically add 0 PE... Yay! :matte-motes-smitten:

##### Share on other sites

I still wanna know why, on my importing screen, I can get models as low as 1.5 PE there, but it
magically
raises to 2 PE once inworld?

I'd like to see PE display the
true
mesh weight, but maybe this is impossible for whatever reason...

Because PE is always an integer number, hence your PE gets rounded up or down. If you have a PE of 2.4 displayed during import, then you probably will see PE=2 when you rezz it.

The reason why you can not display one PE that fits for all circumstances is that the PE varies depending on how you use the prim.

• 1
##### Share on other sites

Thanks Gaia, very straight forward understandable explanation as always

##### Share on other sites

This is 100% not true for me, I did multiple tests. first time was on a 8 object linked mesh with a 5 PE. Dropped a sript in PE count went to 10 = DOUBLE. Tried again on a linkset that had 33 PE went to 66.... again DOUBLE. Did a final test on a linkset of 256 objects, and a 128 PE and guess what? PE jumped to 257... DOUBLE where are you getting this + 2 equation thing? If you look on the wiki equation LL posted there is a 2.0 multiplyer for this and physical objects! http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight﻿

##### Share on other sites

What exactly am I confused about? Look for yourself at the results I got. I guess your cool with being penalized for having efficient mesh's but what I'm seeing here is a DOUBLE increase in PE...

The script I'm adding is a few line script that changes color on a link message... The Mesh itself is very low poly custom physical model and all LOD custom models loaded. VERY EFFICIENT... So why are you cool with this PE effect on script? View all the pictures....

Without scripts 1...

With scripts 1...

Without scripts 2....

With scripts 2...

##### Share on other sites

Moo. Please try this for the 32 prim case...

1. Combine groups of four meshes into one in such a way as to keep the combined bounding box as compact as possible.

3. Add a script ... guess* linkset PE = 18; (server cost = 18).

4. Let us know the results.

* these depend on the exact meshes and the compactness of the bb of the combined meshes. Your numbers show that the individual mesh streaming cost isn't higher than 0.5. If it's a lot lower, these will be lower and you will probably do even better by combining larger groups. If the bb is much bigger than for the separate meshes and the individual streaming costs are near to 0.5, this may be higher.

##### Share on other sites

Not really sure what your saying. Combing meshs to keep the bounding box compact...? I make large items, not going to happen, this PE system needs to work on all levels... In the 32 example I showed thats 6 small mesh's and 2 prims times 4 linked. Also I have tried uploading multiple mesh pieces in one mesh and the PE cost is MUCH greater then indivdual small linked mesh's in SL if thats what your saying I should try.

##### Share on other sites

So that means:

For objects without scripts: Server Weight = 1 + 1/2 * number of prims in linkset﻿

200 prim object = 1 + 0.5*200 = 101 PE

For objects with scripts: Server Weight = 1 + 1 * number of prims in linkset﻿﻿﻿

200 prim object = 1 + 1*200 = 201 PE

That's a pretty hefty penalty for adding just one script! 100 prims? WHY? Why does adding one script to a 200-prim object cost so much more than the exact same script in a 1-prim object? That makes absolutely no sense to me at all.

##### Share on other sites

Does the same apply if you link 200 normal prims inworld and add 1 script to it?

EDIT: no it doesnt... so a comparison:

10 x 1PE mesh objects linked = 11PE ... with scripts = 21PE

10 x 1PE regular prims linked = 10PE ... with scripts = 10PE

A reply from a Linden about why this is would be nice. Lets hope its unintentional.

##### Share on other sites

"That makes absolutely no sense to me at all.﻿"

Nor to me really. Here is the best I can imagine .... there must be some server activity independent of actual script execution, that has to be regularly applied to every prim in a linkset if any one of them contains a script. Maybe this could be polling lsl message queues or something like that. (The Lindens' explanations do mention messaging).

##### Share on other sites

Sorry to tell you that i made a mistake in the calculations (Thanks to Drongle for telling me!). Adding a script will always make ServerWeight = num_prims + 2 and this implies that adding a script to a 2PE object will result in an effective PE=3 regardless how small the object is regarding streamingcosts.

I am a bit confused about that because until yesterday many of us (including me) have seen that PE does not change for "small" objects. Maybe that has changed overnight ? However the formula tells it should be 3, so now its correct (on Agni), sadly...

##### Share on other sites

Still screws over people with linksets that has less PE then num_prims... the equations needs to AT LEAST be (current PE + 2) not (num_prims + 2)

##### Share on other sites

This was discussed at today's meeting. It appears my idea is completely wrong. In fact the per-prim script resource consumption is only incurred by a minority of scripts that make things move, requiring updates. Because these cannot be (easily) distinguished by the server weight calculating code, the penalty for this potential server load is levied on all scripts, just in case they are causing movement. It was recognised that this is not entirely satisfactory.

##### Share on other sites

Ah bugger, I had my noggin so far inside maya I completely forgot about the meeting!

Edit: Read the notes, yikes scripts are counted as a high load script regardless!

Is there anyway to prevent or tag a mesh model as 'unmovable' to find some way to avoid a high cost due to the tiny small possibility that a script may be dynamic?

##### Share on other sites

Sorry you missed it York.

Drongle, very nice understatement: "It was recognised that this is not entirely satisfactory.﻿"

We do indeed recognize that this is not satisfactory, and we're continuing to try and improve our accuracy when weighing objects. I admit that we're erring on the side of too high, rather than too low. I know you do believe we are erring.

The idea is to give an accurate reflection of the impact an object has on overall performance. Current prim count for prims and sculpts is effectively arbitrary, so any comparison to how they work is fatally flawed (although it is natural to do make those comparisons).

I know that in the marketplace, consumers will make that comparison; we're actively exploring ways to help them get better information to compare. I'm very excited about the next few months.

Charlar

##### Share on other sites

For all the flak we give you guys, I do have to say I am convinced you are doing your best and working very hard to please everyone, its not a common sight but I for one am greatful for the high level participation in these forums and on the beta grid.

Very much looking forward to the next few months too

##### Share on other sites

• 3 months later...

Hi have been reading over old threads on script impact on mesh.  It's pretty confusing. (For one thing, the terminology -- "prim" is used to mean "mesh" in some of the explanations, in others, it seems to be a unit of measurement.)

I really don't need to know a formula, I don't think; I just need to know what impact my building methods have.  For example, I have a chair made of 9 separate meshes, LI = 5. When I add one fabric change script, it goes to 9.

Interested in being directed to any newer info on this, thanks.

##### Share on other sites

"For example, I have a chair made of 9 separate meshes, LI = 5. When I add one fabric change script, it goes to 9."

The server weights are 0.5 per mesh unscripted and 1.0 per mesh scripted. From your numbers, thesecwould be 4.5 (rounded up to 5) and 9.0. Since these are the LI you see, it follows trhat both download weight and physics weight are less than 5.0. Otherwise the unscripted weight would be higher.

The important thing to note here isd that the download and physics weightsw are not affected by scripts. Only objects whose LI is determined by the server weight can show his effect, and the server weight depends only on the number of separate meshes composing the object.

Depending on how much lower than 5 the  higher of those two is than 5.0 (you can see by using the "More Info" link in the edit dialog), that means you culd achieve a lower LI by joining the separate meshes. If you joined it all into one mesh (thus only 8 materials), the server weights would be 0.5 unscripted and 1.0 scripted. Thus the LI would be between 1 and 5 unscripted and between 1 and 5 scripted, depending on the actual download and physics weights. In this case you will certainly reduce the scripted LI by at least 4 if you join up the separate parts of your model. If you need more than 8 materials (for a chair???) you will still gain by joining it up into two meshes.

##### Share on other sites

Thanks very much Drongle. However, it occurs to me that I must have the seat and back meshes separate because they have a fabric change script that depends on them being given a certain name. So I must have at least three meshes.  I will try that at and see.

Wow, I was getting super excited about the possibilities to cut prims with mesh, but I see now that those are more limited than I thought, since almost all my stuff is scripted.

##### Share on other sites

Pamela Galli wrote:

Thanks very much Drongle. However, it occurs to me that I must have the seat and back meshes separate because they have a fabric change script that depends on them being given a certain name. So I must have at least three meshes.  I will try that at and see.

Wow, I was getting super excited about the possibilities to cut prims with mesh, but I see now that those are more limited than I thought, since almost all my stuff is scripted.

Not necessarily minimum of 3 - if the fabric areas are all set to a separate material you could easily change them by switching the script to address them by face #. It's just that as Drongle pointed out, you've got a max of 8 available doing it that way. If you're only using three, just UV unwrap chair body, cushion and back separately so you make the best use of the textures you apply to the cushion and back.