How to learn programming Game Enemy AI in C++

Any topic that does not fit elsewhere
Post Reply
Posts: 1
Joined: Wed Nov 09, 2022 7:11 pm

How to learn programming Game Enemy AI in C++

Post by DeVaughn970 »


Currently I'm trying to create my own 2D third person shooter game and the good news is I have most aspects planned from level design, controls, UI, art, and most of the game code.

The problem: I got no idea how to program Game AI for Enemies as this is my 1st time programming game AI period.
What I have tried:
I bought two books to attempt to learn Game AI programming both books in theory cover creating game AI but no concrete way of doing it or tracking the data I need to track
Book1: AI Techniques for Game Programming by Mat Buckland: Teaches Pathfinder and how to modify it and some Game UI
Book2:AI for Games Third Edition by Ian Millington: Covers strictly Game AI in theory not programming Game AI from scratch
After reading those books I was able to complete the following tasks:
Code a sample version of pathfinder :
I could use it but I got no idea how to translate it into useful Game AI outside of creating a basic array path from point a to point b
Code Stubs of Enemy Types:
I was able to create code stubs as I know how many enemy types I want and how many Bosses I want
Enemy AI Logic
I was able to create logic for additional Enemy AI features I want to add

What my questions are:
How do I learn programming Game AI from scratch in C++ or what is the top way to learn programming Game AI from Scratch?
What are the best resources if you want to learn programming Game AI from scratch in C++ from the ground up(Books, Tutorials, CD-Roms, Videos)?
If I want to learn coding spawning enemies from scratch what are some of the top resources (Books, Tutorials, CD-Roms, Videos)?

The top answers you have are valued.
Rémi Coulom
Posts: 219
Joined: Tue Feb 12, 2008 8:31 pm

Re: How to learn programming Game Enemy AI in C++

Post by Rémi Coulom »


welcome to the forum!

I do not know much about books or tutorial about learning what you want to learn, but we may be able to help you if you ask more precise questions to this forum.

My first advice would to try to come up with a solution by yourself. Did you try anything already. What is blocking you?

If you know how to code, then no book is really necessary. For sure, some algorithm are difficult to re-invent by yourself. But the basic ones are easy.

The most basic approach is to hard-code rules by yourself, with plenty of hand-made if-then-else. You can go a long way with this approach.

Otherwise, if you describe more precisely what is blocking you, then we can point to some algorithms or data structures for you to study.

Post Reply