It’s our first leaf of grass, or maybe it’s a weed. In any case, it is a single prim, phantom and physical. That was the easy part. Not much effort was used to make it artistic, as the real effort will be in the AI script. Besides, if this thing is to multiply, we don’t want to over run the parcel’s prim count. Remember, we are eventually going to have bugs as well.
The script is going to require several elements:
- Some means to manage its life span, including reproduction and life span.
- Some means to provide food to the bugs when they are introduced.
- Some means to receive parameter information.
The past several posts have pretty well covered the last element in the list. We’ll talk a bit about the first two elements in this post.
Being a plant, it is going to have to sprout, live a particular time, then die. During the course of that life, it will have a processing cycle, attending to its various life tasks each time through the processing loop. In the earlier part of its life it will grow somewhat, and towards the end of its life it will start to turn brown, die, and hence disappear. It will require another object to effect this life cycle, and that will be a seed. The seed will be quite small, and will be contained in the plant’s inventory. When the plant reaches the point of spreading its seed, it will place a copy of itself into the seed’s inventory then expel the seed. The seed itself will have a relatively simple script as well, being responsible for simply rezzing the plant in its inventory then deleting itself. The new copy of the plant will then proceed on its own independent life cycle.
Just in case there are still some of the uninitiated among you, “rezzing” is the Second Life term for pulling an object out of inventory and making an instance of it appear in the virtual world.
The plant will have a certain store of energy, simulating drawing sustenance from the soil. Being a living thing, it will become progressively less and less able to do this during its life, whereby its energy store will dwindle until it dies. Bugs feeding on it will tend to hasten this process as they draw their sustenance from the plant. The feeding process will be an adaptation of the protocol used in the ecosystem of the Second Nature 3 sim. Since there will be only one species of plant, and eventually one species of bug, that protocol can be simplified a bit.
A plant will be initialized to listen on a channel derived from its key. The uniqueness of the key will result in each plant listening on a unique channel. Bugs will start roaming around the ecopod, using the cyclical sensor function to detect nearby plants. When a plant is detected, the bug will get the plant’s key, and use the same algorithm the plant uses to derive the channel number. The bug will then send a message to that plant requesting energy, and the plant will respond. The plant loses a bit of energy, and the but gains some.
Now comes the hard part. An ecological balance must be maintains so that the bugs don’t multiply so fast and eat so much that the plants are all eaten up[. However, the bugs must multiply at a rate to sustain their population. Both the plant and bug population must be in balance. Parameters in the bug and plant scripts will have to be adjusted to maintain that balance, and that will have to be done experimentally over a period of time. An enhanced version of the XML-RPC application previously described will periodically transmit adjustments based on how our bug and plant population progresses.
The plant and seed scripts should be ready sometime next week, and we hope to start the plants reproducing. Our next post will have the details of these scripts.
Tags: Artificial Life, LSL, Second Life, XML-RPC
