Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

YAFS (Yet Another Fish Simulator)

Sable Till
Registered User
Join date: 1 May 2006
Posts: 9
07-31-2006 03:17
OK, so I don't have the energy to read the whole thread (or really any of it to be honest, so forgive any mistakes) but Surina Skallagrimson's stuff seems pretty awesome and naturally far more complete and complex than my own work. On the other hand, I haven't seen any code there so I think some people will find this interesting.

The whole fish thing is a very obvious and natural direction for SL and there's nothing I like more than reinventing the wheel so I decided to make yet another flocking fish/bird simulator. The main difference here is I'm publishing all my code. I'm using the same sort of principles as everyone else. Shooting for complex behaviour from simple rules. I'm also going with a very modular approach which SL lends itself to.

I have a "module" or script for each behaviour and they all run simultaneously and sort of interact with each other in pleasant ways. So there's one script that makes each fish move away from its nearest neighbour with strength inversely proportional to the distance and another that makes it move closer to it's neighbour with strength proportional to distance. The upshot is they achieve a nice fluid balance. I know the usual technique is to make each agent move towards the center of the cloud rather than the nearest neighbour but that has always seemed like a lot of complicated calculating for no good reason to me. What I really like about my approach is that once you ignore the preposterously complicated notecard reader each script is very simple and easy to understand. Also the whole system is very extensible. It's quite easy to imagine new behaviours and add them quickly.

I'm planning on using the wiki as my own personal CVS repository and so you can see (and copy and distribute and sell) all the code I've developed so far here: http://secondlife.com/badgeo/wakka.php?wakka=SableTill Ultimately I may package it all up nicely and put it in the script library. Feel free to edit my stuff and republish it here or on the wiki or suggest improvements or whatever, but please don't muck around with my wiki page. This code is not GPL or BSD it is totally public domain.

Near term plans include adding a predator type which will have no repel script and the other fish will avoid it aggresively. Also I need to fix up the scanning so it doesn't constantly scan at 96m when all the neighbours are less than 1m away. Fix up the notecard reader so it's not so lame. Maybe have a central reader that distributes key/value pairs with link messages.
Long term I may do all the genetic stuff, develop a more complex predator/prey dynamic, find some practical use for a thousand tiny floating balls.
Lavanya Hartnell
Registered User
Join date: 9 Dec 2005
Posts: 55
Surina's Sushi
08-09-2006 07:37
Surina's fishies are not designed explicitly to school / shoal. I've studied their behavior and talked with her quite a bit about them. Each is a free agent.

Surina is more focussed on evolution of behavior than on group dynamics, per se. As such, there is no "cloud center" for fish to loosely follow, as in typical "boids" experiments. Each fish is deciding what to seek out based on its behavioral genes.

Good luck with your experiment though. Sounds cool.