Alright, I have posted up the source code and project files for Flutterby, which is an AI Flocking demo and experiment. I wanted to create some automated entities that would all flock together and move towards a common goal. Doing a lot of looking around and I found some resources and with a lot of help from the community, here it is..
The system will generate a random number of flutterbys whose behavior is governed by 4 rules.
Rule 1: Fly towards the percieved center of mass of other flutterbys
Rule 2: Keep a small distance away from objects including each other
Rule 3: Try to match velocity with others
Rule 4: Try to reach the goal point
This is based off of Conrad Parker’s Boids Psuedocode with a few tweaks here and there from the community.
I have also started to add in some routines to allow the flutterby’s to land on the ground and then take off after a set point, but it doesnt work the way it should and is mostly disabled. Later I will be adding in animations, a larger area, landings, acceleration and other things to help give a more natural behavior and break up the ‘formation flying’. I am also thinking of implementing more than 1 ‘group’ and maybe having some single stragglers that can join a group or leave one. Once basic functionality is all in there, I might ‘pretty’ it up a bit.. For now though, enjoy!
Please keep in mind this is a demo, the code is not that pretty, and Im a newb. Thanks for looking!