Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Observations of A-Life Schooling AI

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-04-2005 19:23
I've been messing around with my A-life fish's schooling behaviour again and have noticed some strange "phenomenon" approaching the problem from two different methods.

1) moving towards the closest fish.
I went about creating a schooling AI by having each fish look for the same kind of fish and move towards it (using llApplyImpulse instead of llMoveTo) to prevent them all coming to one spot and stopping once they're all there). This seems to produce several small schools rather than one big school of fish. also, the schools don't seem to move together so much as having fish that tend to clump up with each other, but overall seem to be moving on their own paths.

2) moving towards the center of the school of fish.
I have these fish detect the average position of all the fish it senses to come up with a "school center" and move towards it (again using llApplyImpulse). this seems to produce one large school of fish that seems to keep the fish moving as a school, but the school itself seems to lack an overall sense of direction.


Overall, I'm trying to create fish that like to keep together, but also have an overall movement so that the school appears to move as a single entity with purpose rather than randomly drift around. anyone else making A-Life have further thoughts?
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
12-04-2005 19:41
random first thing that comes to mind: Have you tried setting up the sensors on a random timer, so that some will fall behind a bit and then catch up later? You could then use something like the amount of max timer value as a genetic trait for leaders or followers? Like I said kinda random and running on little sleep.
_____________________
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-04-2005 19:52
From: Cid Jacobs
random first thing that comes to mind: Have you tried setting up the sensors on a random timer, so that some will fall behind a bit and then catch up later? You could then use something like the amount of max timer value as a genetic trait for leaders or followers? Like I said kinda random and running on little sleep.


yep, all the fish run on random timers (the max value is something that's passed through a gene trait, but that code is disabled right now for troubleshooting). mainly, the school itself doesn't seem to move with purpose, it just seems to drift around. I was thinking of trying something like getting the average velocity vector of all the fish and having the fish determine which way the school is headed in general, and then trying to follow that path (with a bit of random deviation so that not all the fish move exactly the same) but I've hit an error problem with my code
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-04-2005 20:17
There's a fascinating thread in the forum archives by someone who did a lot of work on fish schooling behavior. If you haven't read it yet, I would strongly recommend it. I wish I could remember the person's name. There are other threads where people have implemented a well-known swarming algorithm in LSL. From what I saw, there are specific rules for being attracted to, and repelled by, nearby fish. I played with it, and if you set the parameters right, you can get a very nice looking school, which sticks together but wanders around, where one fish will change direction and the others will turn to follow and the whole school will seem to turn around and move in a different direction. It's a lot of fun to watch :)
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
12-04-2005 20:28
what about having the school determine a leader out of its school based on the key alphabetized. Then that fish could have some other script run to determine the groups overall direction?
_____________________
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-04-2005 23:04
From: Ziggy Puff
There's a fascinating thread in the forum archives by someone who did a lot of work on fish schooling behavior. If you haven't read it yet, I would strongly recommend it. I wish I could remember the person's name.
Olympia Rebus? If so, don't miss this thread, too.
From: Ziggy Puff
There are other threads where people have implemented a well-known swarming algorithm in LSL.
Apotheus Silverman?
_____________________
:) Seagel Neville :)
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-04-2005 23:50
From: Cid Jacobs
what about having the school determine a leader out of its school based on the key alphabetized. Then that fish could have some other script run to determine the groups overall direction?


I'm very much of the school of "order from chaos" so far, I'm getting better with no communication between the fish at all, just each fish acting "Randomly" based on it's environment. As of now I have fairly good school(s) of fish that run away from sharks and eat food pellets when hungry. I managed to get a better movement of the fish school by having the fish pick out a fish closest to it and match it's directional velocity to within 5 degrees. this has led to some interesting formations, as the fish will swarm towards one area, idle about a bit and then surge to another area as a whole group (for the most part. there are a few stragglers); much more like the behaviour of real schools of fish :)
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Tip Baker
Registered User
Join date: 12 Nov 2005
Posts: 100
Flocking rules
12-05-2005 00:36
You need three influences on the direction a creature takes to simulate flocking

# Separation: steer to avoid crowding local flockmates. (dont get too close)
# Alignment: steer towards the average heading of local flockmates. (go roughly in the same direction as those you can see)
# Cohesion: steer to move toward the average position of local flockmates. (Dont get too far away from those you can see.

As well as those three rules you need a 'goal' to make the flock move from place to place.

#Goal: Steer towards the current target.

All flocking algorythms need tuning, try adding a weighting to each rule, and then adjust the weightings to get different behaviours.

This is the best resource for flocking I know;
http://www.red3d.com/cwr/boids/
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-05-2005 08:10
Thanks for the links. I used the script posted by Apotheus Silverman. The name I was trying to remember was Surina Skallagrimson, and a search found the thread I was referring to:

/191/d7/48141/1.html
Davan Camus
Registered User
Join date: 13 Sep 2005
Posts: 67
Birds and V-Shape
12-05-2005 10:37
Not my area of expertise, but I keep my ears open... :)

When seagulls fly in a V-shape, they trade off who is the "leader". But each bird only knows to follow one-nearby, and to prefer one follower. I guess the guy in front sometimes gets tired of having no leader and two followers and escapes to the rear.

And you can often see malformed "V" flocks, with a secondary branch or two.

Fish seem different. Like they prefer to all point the same direction, and whoever notices a threat or a target first, enough that it wants to turn, instigates a shift.

http://www.heapspace.com/alifepages/alife.htm has some meditations on the subject...
_____________________
Visit Cubes at Alice 100,18.
--------------------------------------------------
Davan Camus, born: 2005 September 8
Out-world location: Santa Cruz, CA
UI Proposal: http://davancamus.hexaflexagon.com/blog/?p=39