I just write arcade games as a hobby. In my new game I wanted to include a visual effect of swarming in the alien creatures. I’ve seen BIOD swarming algorithms which look perfect but I can’t see how to translate them into the data structures I use elsewhere in the code. The published algorithm speaks about a general heading for the local flock mates but I just have an X & Y delta for each alien rather than a heading as such. Also, they talk about local flock mates but if I have say 50 aliens, would that mean I’d have to work out which alien is closest and then which aliens are then all together. This seems like a lot of processing for something that’s not central to the game. I just can’t quite see the best way to approach the problem.
The rules for swarming BIODs are :
- separation: steer to avoid crowding local flockmates
- alignment: steer towards the average heading of local flockmates
- cohesion: steer to move towards the average position (center of mass) of local flockmates
Thanks for any suggestions
Mike