I was inspired by Andos' wonderful Flocking Extension (http://community.clickteam.com/showthread.php?t=66009&highlight=flocking) and as an experiment I made a very basic flocking project to see if this could be done from within MMF itself, without the extension. It is pretty much entirely based on the pseudocode found here:
Download it: Attachment 6635
- Velocity Limit
- Move to Target
- Set Angle
- ForEach version
- Normal FastLoop version
Basically it runs a bunch of nested loops:
1. Set up positions for distance checks, set velocities
--------2. Check each boid's distance away from every other boid (using positions stored in 1st loop)
----------------3. Add positions and velocities of neighboring boids in range to be averaged and set by Loop 1.
- Separation is wrong, boids bounce off each other rather than incrementally move away (stumped on this one!)
- Sometimes one boid thinks it belongs between 0,0 and the center of the rest of the flock
- Ability to set:
+ Speed (min, max, idle)
+ All weights
+ More stuff
Any contributions and bugfixes are most welcome! If I have gone about this entirely inefficiently (or have totally screwed something up) please let me know, it's my first time doing something like this. The ForEach version only gives me 5 more objects before the framerate drops drastically so any solutions to this would be fantastic.
Hope this is useful/informative to someone and looking forward to any feedback.