AI Techniques For Games:
Boids Flocking:
In
the natural world, organisms exhibit certain behaviours when travelling in
groups. This phenomenon, also known as flocking, occurs at both microscopic
scales (bacteria) and macroscopic scales (fish). (Gallear, A.I Techniques, 2018) It is based on
three-dimensional computational geometry of the sort normally used in computer
animation or computer aided design. The basic simulated flocking creatures were
designated “Boids” and the standard flocking model is made up of three steering
behaviours which detail how an individual “Boid” manoeuvres based on the
positions and velocities of its nearby flock mates. (Reynolds, 2018) . By using computers, these patterns can
be simulated by creating simple rules and combining them. This is known as
emergent behaviour and can be used in games to simulate chaotic or lifelike
group movement. (Gallear, A.I Techniques, 2018) . This technique
works on three simple components known as cohesion, separation and alignment.
Cohesion:
A
flock is when a group of boids all stay close together. Cohesion is when each
boid will look at the position of every other boid to see if it is within the
neighbour radius. If a fellow boid is within the radius than it becomes a flock
mate. It than takes the average position of each boid and will steer toward
that position. This makes it so each boid is trying to get to the centre
resulting in them staying together. I.E: Steer to move toward the average
position of local flockmates.
Separation:
Even
though each boid is endeavouring to draw near together you don't need them
covering or hitting against as this doesn't this doesn’t simulate real life
which is the place the partition some portion of the calculation comes in. They
do this by having each boid keep a specific measure of room in the middle of
one another. In the event that a boid gets excessively near another boid than
it will add a converse speed to itself to go the other way. I.E: Steer to avoid
crowding local flockmates.
Alignment:
This
is the part of the algorithm which oversees the direction of the flock. The way
it works is that every frame each boid will look at the heading it which it is
heading and those of its flock mate’s aka those inside neighbour radius. It
will than realign itself to match the heading of all its neighbours. It than
averages the velocity vectors of those in the neighbour radius and the
resulting vector point is the way than the boid will head towards. I.E: Steer
towards the average heading of local flockmates.



No comments:
Post a Comment