Sponsored By

GCG Feature: 'AI For Game Developers: Flocking'

Gamasutra sister educational website <a href="http://www.gamecareerguide.com">Game Career Guide</a> has published <a href="http://www.gamecareerguide.com/features/282/book_excerpt_ai_for_game_developers.php">an extended book extract</a> from O'Reilly's 'A

Simon Carless, Blogger

October 4, 2006

2 Min Read

Gamasutra sister educational website Game Career Guide has published an extended book extract from O'Reilly's 'AI For Game Developers' book, written by David M. Bourg and Glenn Seemann, and featuring techniques for creating 'flocking' AI in video games. This segment of the introduction explains the concept of flocking - the extract then goes into much detail on the specifics of how to achieve flocking: "Often in video games, nonplayer characters must move in cohesive groups rather than independently. Let's consider some examples. Say you're writing an online role-playing game, and just outside the main town is a meadow of sheep. Your sheep would appear more realistic if they were grazing in a flock rather than walking around aimlessly. Perhaps in this same role-playing game is a flock of birds that prey on the game's human inhabitants. Here again, birds that hunt in flocks rather than independently would seem more realistic and pose the challenge to the player of dealing with somewhat cooperating groups of predators. It's not a huge leap of faith to see that you could apply such flocking behavior to giant ants, bees, rats, or sea creatures as well. These examples of local fauna moving, grazing, or attacking in herds or flocks might seem like obvious ways in which you can use flocking behavior in games. With that said, you do not need to limit such flocking behavior to fauna and can, in fact, extend it to other nonplayer characters. For example, in a real-time strategy simulation, you can use group movement behavior for nonplayer unit movement. These units can be computer-controlled humans, trolls, orcs, or mechanized vehicles of all sorts. In a combat flight simulation, you can apply such group movement to computer-controlled squadrons of aircraft. In a first-person shooter, computer-controlled enemy or friendly squads can employ such group movement. You even can use variations on basic flocking behavior to simulate crowds of people loitering around a town square, for example. In all these examples, the idea is to have the nonplayer characters move cohesively with the illusion of having purpose. This is as opposed to a bunch of units that move about, each with their own agenda and with no semblance of coordinated group movement whatsoever." You can now read the full Game Career Guide feature on the subject to learn more details about AI and flocking (no registration required, please feel free to link to this column from external websites).

About the Author(s)

Simon Carless


Simon Carless is the founder of the GameDiscoverCo agency and creator of the popular GameDiscoverCo game discoverability newsletter. He consults with a number of PC/console publishers and developers, and was previously most known for his role helping to shape the Independent Games Festival and Game Developers Conference for many years.

He is also an investor and advisor to UK indie game publisher No More Robots (Descenders, Hypnospace Outlaw), a previous publisher and editor-in-chief at both Gamasutra and Game Developer magazine, and sits on the board of the Video Game History Foundation.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like