I am always interested in game AI programming, specially autonomous game agents which move around and act on their own will but based on a set of pre-defined rules of course. After reading the first chapter of Programming Game AI by Example by Matt Buckland, I can understand the magic behind those intelligent behaviors. I am very impressed to know how simple it is to create those behaviors. But it’s definitely not simple if one is not familiar with trigonometry and geometric algebra.
The code presented in this book is all C++. And I have a hard time to make those code built in Visual C++ 2008. It is guaranteed to work with Visual C++ 2005 only! So I rolled up my sleeves and wrote my own code in Java. And I think this is the best way to test how much I understand the book.
So far, I have finished coding the following behaviors: arrive, seek, avoid, wandering and obstacle avoidance.
I put those behaviors in a single applet illustrated here. It’s just a bunch of flies flying around trying to avoid their predator, a spider may be!