Lag

From The Wastelands
Revision as of 16:13, 26 August 2019 by Xrrawva (talk | contribs) (initial data migration from old wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

We all hate lag, and with sims loaded with people, scripts, attachments and builds, it's an inevitability. So, to try and make all our lives a little easier, I'd like to go over a few things we can do to make this insideous threat a little easier to deal with on all fronts!

First, let's diagnose the causes of lag - and the TYPES of lag. Contrary to some people's beliefs, there is not just one all consuming lag force. There are several types, caused by several different things, some which are within our power and some which are not.

Physics Lag

First, physics lag. To demonstrate, you can hit CTRL+SHIFT+1 and read along with me. Under the bar "Simulator", which you may have to click to expand, you should see something called Time Dilation. Time Dilation is essentially a measure of how quickly the sim is currently processing physics. Physics of course means the movements of any object with "physics" enable, as well as avatars. This means bombs, bullets, people, plywood cubes with 'physics' checked, all contribute to a strain on the sim's physics performance. Ideally the Time Dilation shows 0.99 or 1.00. The largest strain on it is a large number of collisions - an object caught between objects, characters stuck against each other, etc, can cause this number to drop. At that point we experience something people often refer to as "walking through jello" or similar descriptions, the feeling of slow motion. Sometimes Time Dilation happens through no fault of our own, possibly another simulator sharing servers. However, we ask that you limit your physical objects, for all our sakes! At the same time, please do not be afraid to enjoy the projectile combat of the Wastelands sims, but be advised that some outside weapons can aggravate the physics lag badly, particularly freebie ones. Because physics lag is considered "serverside", and thus everybody experiences it equally, we will be particularly aggressive about ending physics lag.

Graphic Lag

Secondly, we have graphical lag. Graphics lag can also be observed by the performance window we summoned with CTRL+SHIFT+1 previously. By looking under 'basic' we can observe our FPS, or frames per second. This literally means how many frames our computer renders per second. Graphical performance and lag is entirely a "clientside" issue, meaning, each person experiences it on an individual basis depending on their graphics settings and their system. Because Second Life is a very intense program on any system, graphical lag is a very common form of lag. It can be diagnosed by a low FPS, which makes our viewing experience something like a slideshow as our system struggles to render frames for us. Graphics lag is somewhat insidious, because while one person's high end computer may have no issues with certain things, other people may find their own system struggling to render things. This means that sometimes, we may be causing lag for other people without realizing it - and sometimes causing lag for ourselves. While it is impossible and impractical to believe we can entirely eliminate graphical lag, there is a number of ways to help combat it.

Prims

SpherevsTorus 01.jpg
SpherevsTorus 02.jpg

We all know by now that prims cause lag. A higher prim count causes more lag than a lower prim count. This is a simple truth - the more things that our client needs to draw, or consider drawing, the slower it is, and the longer it takes to draw frames, slowing our performance. However, a myth associated with prims is that larger prims = more lag. While this may be true in terms of LOD, or draw distance (because SL will drop smaller prims at a distance), it is overwhelmingly untrue in general. In fact, larger prims can reduce lag, as Second Life can often intelligently decide not to draw objects behind these larger prims, speeding up the process. So what does cause lag? The number of 'faces' on a prim.

3D artists are quite familiar with the concept of faces and vertices on an object. In SL, however, where we tend to deal with whole objects linked together rather than these minutae, many are unaware. So let us take a look at two shapes, the sphere and the torus.

Sphere on the left, torus on the right. Two common shapes in SL, especially in attachments. They don't look all that different at a glance, but we can see clearly that the torus is more complicated. Here I've hollowed and slightly cut the torus to make a point. Obviously, slightly more complicated, but they're both one prim, so about the same lag, right?

Here, I've taken a second shot, exactly the same, however I have turned on "wireframe" mode, by pressing CTRL+SHIFT+R.

What this does is shows us all of the 'faces', or flat planes, used to create these shapes. There's a lot on both prims, however, the torus has upwards of five times the number of faces of the sphere. Yes, this absolutely means that the torus is five times as laggy as the sphere. In short, prim lag is NOT dictated solely by the number, but rather the complexity of the primitives used. That means curly, twisted prims cause exponentially more lag than simple shapes. If you suspect you or somebody else to be causing lag, try CTRL+SHIFT+R to see how many faces is in their attachments or creations. In short, please try to be mindful of not only the number of prims, but their complexity.

Textures

Also worth noting is texture lag. Less common but no less straining, texture lag is caused by too many textures or textures which are too high resolution, making them hard on our graphics cards. Please please please try to limit all textures to 512x512 where possible (yes, even skins!). The difference between 1024x1024 and 512x512 is largely negligible in SL, so swallow your pride and downsize where possible! Of course, many people do not design their textures and have no control over them. Try not to worry too much! By reducing your prim count you are likely reducing your texture count. In general, the average person has little to worry about - it is an issue more common in environmental builds. However, when displaying images for friends, for example, please be mindful of the size of these images. We all have to render them!

That about wraps up graphics lag. Remember, even if it's not hard on you, it may be hard on your friends and neighbours - try to be considerate! But remember - larger prims don't mean laggier. That giant av might not cause nearly as much lag as a belt made of 200 twisted tori prims.

Particles

Finally, we have particle lag. This comes in two forms. One, particles, being a texture, can result in texture lag, especially when many are being drawn all over. For some with higher end systems this may not be an issue. However, regardless of how well your system performs to particles, please remember that Second Life lets us see at most approximately 8000 particles at a time, and many people are using less than that. When designing or using particle scripts, please ensure your objects are not emitting too many particles. This may require some amount of math to decide. In general if you are using more than 500 particles a second or so, you are emitting too many particles and taking more than "your fair share", causing lag and not allowing other people to draw their own particle effects. A good limit is to try to keep your particles around 100-200 drawn per second. Remember that repeated bursts with long lives can cause many particles to be drawn simultaneously, even if your particle system uses a low burst count.

Network

Thanks to those who have stuck with me so far. Let's proceed to the third type of lag. Network lag. Network lag is an issue both serverside and clientside. This means it can affect everybody simultaneously, but have differing effects for individual people. Network lag can be tricky to diagnose, but is usually notable by high packet loss or chat not showing up or coming out of order. Reducing network lag is quite simple - try to keep your bandwidth settings around 500. Although those of us with high bandwidth connections may feel the need to set it as high as 1500, this can cause the Second Life servers to fire too many packets at us at a time, losing some in the process, causing these troubling distortions for us and those around us. Remember, if your client is putting a strain on the server, the server is strained for all of us. Please be considerate!

Fourth, we have another form of serverside lag: script lag. If you open the performance menu again (CTRL+SHIFT+1), we can see under Simulator something called "active scripts". This is essentially how many scripts are running in the simulator, be they on vehicles, unattended objects and builds, or our own avatars. This can be more difficult to monitor. However, please remember that EVERY script contributes to the script performance of the simulator, reducing it slightly. This means that the simulator must spend more time calculating and running scripts, slowing down the performance of all scripts in the sim for everybody, equally. This is of course why we request outside weapons not be used where possible, particularly those with a large number of scripts. Holstered weapons, in particular, often have dozens or even hundreds of scripts in them to hide and show the many prims in detailed weapons. If you are using holstered weapons, our devs may ask you to rez the objects on the ground to check for these "transparency swapper" scripts. Well scripted objects do not use this method and may be okayed by our staff. Again, because script lag is serverside and affects everybody equally, the Wastelands staff may be more aggressive about curbing this than other forms of lag.

Etc.

Finally, a lesser form of lag is flexi lag. This can be grouped in graphics lag, but for the most part, any lag by flexible objects can be covered by prim and texture lag. More specifically, many flexible objects on screen at a time causes our clients to animate the flexibility more primitively. If every attachment you are wearing has flexible prims, or if you have objects with 25-50 or more flexible prims (such as some hair and skirts), please be mindful that you are again taking more than your "fair share" of flexy processing, causing a little ugliness in all our lives. A little flex is pretty, a lot ruins it for us all.

All of this may sound very harsh but there is no desire to spread blame, but rather to educate and try to help reduce lag for all of us. We all have to live together, and we all have to look at each other, run around together, and try to enjoy ourselves as best we can. These explanations and tips are intended only to maximize our visual experience, letting us create beautiful things while being aware of how they may influence our virtual world and the people around us.

As a final note, we would ask this: please be considerate of the people around you. Although lag can be very frustrating for us all, not everybody may be experiencing it. If it's upsetting you, or if you suspect somebody of causing you lag, please speak to them civilly, raising your concerns, and remember the points discussed herein. Nobody wants to be told they are "ruining" somebody else's experience, and will be more receptive to a kind request than a furious outburst. People may not be aware of the lag they cause you, so try to educate rather than blame - we can all get along with a little civility and consideration.

That said, we understand that lag can be used as a griefing tool. Anybody suspected to be intentionally causing lag will, of course, be corrected or removed from the sim. As always, we are here to make this place great for our residents, players and visitors.

Thanks for sticking with me so long! Please enjoy the Wastelands and have a lagfree day!

By Ash Garden