ICE Flocking, a Start

Next step on from meshcrawling particles (here) was going to be some loose motion control using curves to control flow of particles over the surface. But then I got to thinking that maybe proper flocking, a la Craig Reynolds (see here) might not be so hard and, since the crawler node was designed to work within the particle sim loop, I could design it as a general purpose flocking tool and still have it work with the mesh tool.

Basic flocking requires three steering nodes and a neighbour finding node. Steering nodes modify velocity and are; Align, try to make particles move in the direction of their neighbours. Separate, which tries to prevent particles from colliding with neighbours and Cohesion, which keeps particles within the flock. Neighbours are defined as all particles within a distance and within sight of the particle in question. ‘Within sight’ means within a cone aligned along the particle’s direction of travel.

Flocking is essentially very simple, the steering nodes are really no more than a bit of vector math and handily ICE already has a find neighbouring particles node – sometimes I think the guys at Soft have a ‘Guess what Kim Wants Next and Build It’ node they work so far ahead of us - so getting going was pretty quick. I had a sticky start, trying to figure out how to loop through the arrays that pop out of the neighbouring particles node but it turns out that most of the vector math nodes in ICE take arrays of vectors as well as single vectors as input; once I'd got that worked out it really was quick, around 2 hours start to finish.

A couple of test videos you’ll find here and here. I'll also be adding some more nodes - follow path and walls, obstacle avoid, meander, predator and prey, etc - and I'll try to release the whole lot as a package around the time 7.0 hits the streets. I'll also be going through the details of how it all works in a later blog in a few days. In the meantime, enjoy the video: