Chick 'n' Egg for Second Life
Learning's more fun with a bird-brained virtual pet!
Developed by RaddDadd Upshaw
Chick 'n' Egg are virtual avian-looking characters created for my studies of object manipulation in Second Life. Also, to answer the age-old question, "Which came first?"
Script dissected
Change log
Bits and pieces from the course of hen development:
Touch prim of object to get its name, description, position, rotation, velocity
Rotate object in horizontal plane to point toward owner
Trig: Solving for an angle
Life begins at rez, with an egg. Once rezzed, the egg just sits there for an embryonic delay. Then the head and tail and, er, wheel begin to emerge. The hatchling begins to peck and pivot and wander about within a Corral. What was egg becomes a chick for a period, then matures into the adult hen. Once during its lifespan, the hen produces an egg. At the end of its life cycle, the hen stops its behaviors, and fades away.
The Corral is a fixed radius around the bird's Center. When rezzed, the position of origin is the bird's Center; the bird then looks for a nearby object named "Henyard," and, if found, the center of the hen yard becomes the Center for the bird's corral. (If no Henyard is found, the point of origin is remembered as the bird's Center.)
Eight prims comprise the Chick 'n' Egg. The bottommost and root prim is a vertical torus. The Second prim is the body, a spheroid which initially serves as the eggshell. A tapered, flexible box serves as a tail. The fourth prim is a cylindrical neck. The head, right eye, and left eye are all spheroids. Eighth and last, a comical conical beak. In the beginning, all the other parts are tucked inside the body-egg. (Therefore, this experiment only begs the question of which came first.)
The object is solid but not physical. In the root prim's inventory are, first, the birdbrains -- the Chick 'n' Egg script, running -- and second, a copy of the egg, which has running birdbrains in its inventory. When the egg within is rezzed by the hen, a copy of the egg is given to the newborn's inventory.
Completed:
Egg-to-Expiration script timing & state sequences.
Wandering, Pecking, and Pivoting behaviors
Adjustment of root and child prim properties through all stages of growth.
Maturation from chick to hen, with according resizing and repositioning of prims, and adoption of adult colors and textures
Rotation adjustment of beak, head, neck, and tail when moving between standing & resting positions
Reproduction
Fading out & dying
Accomplished, but not currently active:
Pivot in direction of movement
Pooping (optional)
Planned:
Keep outside the bounding box of all nearby objects
Veer toward nearest other chicken in area ("flock together" behavior)
Voice commands like "here" and "shoo" cause birds to veer toward and away from owner at a much greater rate
Various bells & whistles.
An unrevealed ultimate destiny.