Starting a thread to keep track of my progress with fireflies. I wanted to start out with simple objects that floated in air so that I could concentrate on behavior. Fireflies seemed like a appropriate name. Then I discovered that Llauren also has fireflies, but they look very different. Sometimes I just call them critters.
So far I've adapted two scripts from the script wiki. The floating pet script and the swarm script.
- First critter version floats around randomly.
- Next version floats around randomly until it gets hungry. Then it scans for a food source and heads for it. If it doesn't get food in time, it dies.
- Latest version no longer floats randomly. Instead it swarms until it gets hungry and then looks for food.
I'm finding it difficult to find a good code structure for multiple behaviors. Will have to sit down with a piece of paper and map it out, I think. All the critters have two scripts, brain and movement. The brain picks the next target and tells the movement script to go there. Its easy to get just swarming or just food seeking, but more difficult to get realistic food seeking and swarming. Right now, as soon as a critter gets hungry, it shoots off to the food source like a little rocket. Eventually the critters are all swarming around the food.
I'm also having trouble finding a good balance between attactive and repulsive flocking forces. The critters tend to drift pretty far apart.
Part of the problem is getting a good coding workflow set up. I've never written code before that might run away and die while I'm working on it. It's also hard to save and test and keep track of versions when you have to save the prim you're working on, and when as soon as you take it out of inv to work on it starts moving. I posted in the scripting forum for help on that.
/54/d7/134987/1.html
I think it's mostly a matter of getting a feel for SLS, what it's capable of, and what kind of code structures work best with it.