So I just started playing second life, and the main reason was because i wanted something to keep my progging skills sharp. i've been using VB and C for about 10 years now, but only as a hobby, not as a job.
so i stumbled across a page somewhere on the vastness of the internet describing a school of fish, and it intrigued me, and i decided to try my hand at scripting creatures. my goal of to have a pack of wolves that feed on rabbits, which feed on carrots, which i'll have to grow somehow.
for the wolves, i'm going to try to duplicate pack behaviour, with an alpha male and alpha female, etc. the rabbits are going to be more independent. and the carrots, well, i haven't decided whether to actually make them "grow" and reproduce or just have a carrot machine. at first it'll probably be the latter though, until i get everything else working.
so far i've just ben playing around to learn the language, using little floating balls to work on movement as a group. the script i have right now is something like this:
each ball is born with a random 1-10 'hyper' rating, which affects their speed and rate of directional change.
first born takes leadership after 5 seconds. the leader sends out his next targeted location each second to each other ball within 50m. each ball then heads towards it. normally, the leader has picked a new target before they get there, so the motion is seamless, not jerky.
randomly, the leader can drop leadership. if this occurs, all the other balls pick up leadership. at this point, one of two things happens. either one of the balls sends out it's leader message quick enough and is the new leader, or sometimes they split into two groups, each with their own leader. the latter is more likely to happen with bigger groups(more than ten). normally though, if the two groups come near each other again, they form back into one group.
right now i've just got them set to constant motion, like i said, to learn the language and physics. the way the targeted path is chosen is this... for the first movement, the leader picks an offset based on randomness and hyperness, up to 5m away. each cycle after that, a second offset is added to the original, that can be +- 0.5m, so the direction doesn't just spaz around randomly, and instead follows a smoother path.
so far everything works pretty smoothly(although at first i had about 400 balls go off the edge of the world, lol). i had to tweak the leader's speed though, because he would always stay way ahead of the pack, so i just shifted it down some, and now he'll stay grouped with the rest. this also makes it hard to tell which one -is- the leader without watching for a minute, which i like a lot.
my next goal is to get them to hunt food instead of randomly choosing the direction, so wish me luck with that. any tips in this area would be appreciated.
any thoughts or ideas? i'm always interested to hear what others have to say.