Update: The Project for the book has initially been split over a number of GitHub Projects. You can find the main project (which will eventually contain the final source code) in the link at the top of this page. Autonomous movement (e.g. flocking, wandering etc) and genetic evolution/artificial neural networks can be found here. Goal Oriented Action Planning can be found here.

Note: The book is still very much in the planning stage. Release date is expected to be in the first half of next year, although the book won’t be rushed; it will only be released when I believe it:

  • Is sufficiently different from the other AI programming books out there.
  • Can demonstrate a suitable number of different AI techniques and their applications.
  • Is enjoyable to read.
  • Produces a sense of achievement and pride in what is being produced by the reader.

The screenshots included on this page are from a very early build of the project that will be created over the course of the book. You can download the project that accompanies the book (definitely WIP!) from GitHub (link at top of the page).

The goal of the book will be to teach existing (we won’t be touching on basic programming techniques/methodology) programmers a range of AI techniques by bringing a small adventuring village and its surrounding area to life. At first the village is empty and abandoned but as the book progresses, each section of the village is brought to life; from the small town itself (complete with a blacksmith, shop keepers, hunters, and various other NPC’s), to its surrounding areas (including a farm, the obligatory dungeon, and the wilds with free roaming predators and prey).

While the contents are subject to change (which they seem to be doing weekly at this early stage), the core topics that I aim to cover include:

  • Procedural Dungeon Generation: create an interesting environment for your player to explore. Also includes clever methods of populating these environments (not just selecting a random floor tile!).
  • Implementing a modular Finite State Machine (FSM) for enemy AI. With detailed instructions on how this can be implemented in any future game.
  • Goal Oriented Action Planning for NPC AI. We’ll give the towns people their own personal goals and let them work out what they want to do at any given moment.
  • Path finding: it doesn’t matter how clever we make the towns people and dungeon dwellers, if they keep walking into the wall they won’t seem all too smart.
  • Procedural behaviours such as obstacle avoidance, and group behaviours (e.g. flocking) for animals in the game: Let’s create a small farm for the village and give the animals a way to move through the environment.
  • Lastly we’ll populate the wilds with a predator and prey ecosystem: These animals will be controlled by an Artificial Neural Network (ANN) and evolved using a Genetic Algorithm (GA) to simulate natural evolution. The ecosystem will evolve as the game is played and the predators and prey will (hopefully) become more efficient. I say hopefully because things can become a bit difficult to predict when we enter the domain of neural networks and evolutionary computation.

There are already a number of similar sounding books out there (I would know, I’ve read most of them!), so what makes this one different? This book hopes to instil a strong connection between AI and how it can bring a game to life. I hope to build a narrative throughout the book. Rather than just listing code that you can copy and paste into a separate project, we’ll create our own project that goes beyond what is offered in any other AI book. By the end of the book you’ll have a working game that can be extended and released on (nearly) any platform you would like.

As I am (unfortunately) not an artist (I won a finger painting contest when I was a child but that’s about as far as it goes), most of the artwork that will be used in the book will come from the Liberated Pixel Cup (LPC). All artists will be referenced in the book. This has the added benefit that if you want to extend the game, there is already a large number of quality sprites available online that would fit the look and feel of the village exactly.

Further updates will be posted on my blog. When I have progressed significantly (to at least where the contents of the book are set in stone) I will then update this page to reflect that.