Written by Emileigh Starbrook
Thursday, 22 May 2008 16:54
Reprinted with Permission
We all love pets - they are an outlet for our love and are the non-judgemental companions that provide a theraputic emotional boost when we are down. They are cute, cuddly and have adorable ways of communicating. They are our protectors and our playmates. Residents in Costa Rica have dogs, cats, dolphins, fish, jellyfish, octopuses, puffer fish, birds, butterflies and other assorted animals, all of which have the potential to be physical. In Second Life, they fill a gap between a boring game and realism.
Unfortunately they contribute a tonne of lag (and before my fellow scripters jump on me, it isn't always script or texture lag.) It is because they are generally (though not always) physical - as physical as avatars, planes, sailboats and cars. And as physical entities, they produce collisions that requires complex processing and severely impact server performance. This may be a hard concept to understand, so lets go step by step.
What is a collision?A collision occurs when a physical entity (an avatar, for example) collides with a non-physical entity (a prim) or another physical entity. This collision generates a collision event - in fact lots of them. To show you how this happens, create a 10x10x0.5 "floor" (square plywood prim) and then in the Contents tab create a new script and replace the default code with the following:
default
{
state_entry()
{
}
collision_start(integer num)
{
while(num)
llSay(0,llDetectedName(--num) + " has started to collide");
}
collision_end(integer num)
{
while(num)
llSay(0,llDetectedName(--num) + " has stopped colliding");
}
collision(integer num)
{
while(num)
llSay(0,llDetectedName(--num) + " is still colliding" );
}
}
Now walk across the prim - what happens? Well, you can see how collision reports will quickly fill up your screen. This is because collisions (by default) can be reported up to 20 times per second. The good news is that most prims do not contain the collision detection code, and collisions are quickly ignored. However this is not always the case with pets.
Why Pets are BadPets are bad for a number of reasons:
1. They have to detect collisions and make complicated decisions about how to behave
2. They have complex prim structures that require them to move in unison
3. They have to detect collisions in multiple prims
4. They usually have sensors (radar) to detect owners (so they come to you) and intruders
Lets consider a typical dog - it will put out a radar "ping" to see if an avatar is nearby. It will then move in the direction that avatar is located. All the while it is firing off radar pings to insure the avatar is in range. If this scenario happens in an open field, it's not quite so bad - the dog takes a straight line course to the avatar, collides with it, and then behaves like a real life dog would do - attack an intruder, lick or jump up on an owner or friend.
Why Pets in Houses are WorsePets in houses are worse. They are surrounded by prims (walls, floors, ceilings and furniture) and they have no way of knowing which obstacles are in the way. The collision detection/sensor systems act like the eyes and nose of a dog. If we go back to the previous scenario, see what happens. The avatar is outside the house, and the dog collides with the wall trying to get to it. It may take many actions including moving around tracking the avatar - colliding with furniture, moving left or right (only to collide with an adjacent wall) barking, jumping and generating thousands of collisions along the way. Physical fish designed to be put in the ocean will really cause severe problems in fish tanks.
Why Pets in Some Houses are Twice as BadUnfortunately some houses also have collision detectors built in. These can range from door openers to wall and floor-based security systems (like our floor example.) The result of this is that there are now twice as many collisions occuring - the same collision is reported to the dog and wall/floor/door opener. The result is that instead of 20 collisions per second, it is now 40 or 60. We have measured these in most sims and in one house, the kittens were generating over 300 collisions per second!
What Residents Should DoWe want you to enjoy your Second Life and the realism it provides, but unfortunately pets are having a severe impact on performance. We don't want to impose restrictions, so for now we ask that you voluntary stick to the following guidelines.
1. Please do not keep physical pets in your house unless they are in sleep mode.
2. Keep pets outside - most pets do not detect ground collisions
3. Turn them off or put them into inventory if you are not present on the property.
4. Do ask an estate manager to measure your pet's "lag contributions" if you are unsure
Also be aware of what you have that is physical - you can determine this by turning on a physics beacon. Torley Linden has a good VidTut if you do not know how to use beacons.
**************
Thank you, Em, for this great guideline to pets in Second Life.
Please be aware of this and understand if I ever come to chat about your particular pet.
Cheers!
Char