AI Game Programming Wisdom

Steve Rabin

Mentioned 4

Learn how AI experts create intelligent game objects and characters with this first volume in the AI Game Programming Wisdom series. This unique collection of articles gives programmers and developers access to the insights and wisdom of over thirty AI pros. Each article delves deep into key AI game programming issues and provides insightful new ideas and techniques that can be easily integrated into your own games. Everything from general AI architectures, rule based systems, level-of-detail AI, scripting language issues, to expert systems, fuzzy logic, neural networks, and genetic algorithms are thoroughly covered. If you're a game programmer (AI/logic, front-end, user interface, tools, graphics, etc.) this comprehensive resource will help you take your skills and knowledge to the next level.

More on

Mentioned in questions and answers.

What is the worst real-world macros/pre-processor abuse you've ever come across (please no contrived IOCCC answers *haha*)?

Please add a short snippet or story if it is really entertaining. The goal is to teach something instead of always telling people "never use macros".

p.s.: I've used macros before... but usually I get rid of them eventually when I have a "real" solution (even if the real solution is inlined so it becomes similar to a macro).

Bonus: Give an example where the macro was really was better than a not-macro solution.

Related question: When are C++ macros beneficial?

AI Game Programming Wisdom has a chapter where macros were used to create a scripting language for finite state machines.

Since the book and code are copyrighted material, here's a Google book link to the page detailing the macros (The resulting script language can be found on page 324.)

I would like to learn about games (strategy) algorithms especially about how do enemies algorithms works ?

Is there any good place for beginners?

Wow, that's quite the question.

I'd start with the O'Reilly book, 'AI for Game Developers'.

Also explore the Game Programming section on There's a lot out there on strategic computation, game theory, random responses, etc.

There are many aspects for AI in strategy games, but keep in mind that there is a big difference between Realistic AI and AI that makes a game fun to play. Cheat where you can while not making it obvious to the player that the enemy is cheating.

AI Game Programming Wisdom books

Also has a huge collection on AI articles and a good forum with lots of information. (

Game Programming Gems feature a section on AI as well, but when AI is what you want, go with the AI Game Programming Wisdom books.

Here is an overview on RTS specific articles: Also look at Pathfinding, possibly some neural networks / genetic algorithms when you want to play with that, although it might be a bit overkill when you're just starting out.

I am working on a space invaders clone in unity game engine. I want to make the enemies intelligent. One approach I tried was using a min max algorithm. I took the x-coordinates of player and made the min max tree from it and the used it to make the enemy turn away from that position after specific time intervals. However this did not work well. Now I want the enemies to learn and evolve to avoid the player using a neural network. How can I implement this in space invaders? Are there other algorithms better then neural networks to use in space invaders?

Almost any learning algorithm would be better than neural networks. However it is a very deep topic -- what you need is a book and a few months, not a quick answer on SO.

So I'll recommend a few:

I don't recommend neural networks for this because they take a very long time to learn, even with the most modern learning-optimization techniques (which I don't think you're going to find in any book yet anyway). You want these invaders to learn on the fly, so you need something much more responsive.

I would probably use a decision tree, and keep a limited-length memory vector so that the critters can adapt quickly to changes in the player's strategy.

I want to make a turn base strategy game. I was just curious if anyone had any sources or books that explains the concept and architect of designing a turn based strategy game or any turn based game. thanks!

There's a series of books with short articles on Game AI (1, 2, 3, 4). You might be able to find one or more at a local library too.