Enemy AI things to consider

I am making a first person shooter something like cysis where you navigate a terrain and enemies will attack you when you get close.Now, i have an enemy soldier with animation ready to use. I want the soldiers to have a small designated area they stay in. Like they patrol a small area and when im in range they take cover and fire at me. I dont need for them to follow me beyond the designated area.

What are things i need to consider using for the enemy AI? Waypoints? Raycasting?
Im just not sure. Thank you

Well, not only do you need to consider Waypoints and definitely Raycasting, you need the actual essence of life.

For instance, vision/sight, hearing/range-detection. Things like how to find a target ( Perhaps you should look into NavMesh, or purchase a cheap unity asset. There are plenty ).

There are actually lots of Unity assets to get these jobs done spontaniously, but, if you prefer to code your own classes and what not, here are a few starter tutorials from YouTube.

Here is my own ZombieAI . Keep in mind that this is by no means standard code practice, and I only persuade you to use this as a starting point if you need. But none the less, compile-able.

ZombieMotor - Pastebin.com Zombie Motor

ZombieController - Pastebin.com Zombie Controller

But what I believe you really want is Zombie AI - Pastebin.com AI . You can at least gain an understanding of what’s needed to be known, and improve the flaws it currently has. (ps: runs smoothly though)

Even if you don’t want to watch the videos, just skim through them, and point out the parts of the AI system.

Best video I have seen is here : FPS1.32 AI Path Finding Intro/Theory. Unity3D FPS Game Design Tutorial. - YouTube


Hi icelated,

You seem to have asked this question twice. It might be a good idea to remove one of them :wink:

Here is my answer in your other post:

To be honest all the above are generally needed. I’ve looked at this a number of times, and the conclusion I always come to is the keep up the creative flow and reduce development time is to use one of the pre-built ones from the asset store. Here is a selection of the ones I think look good:

I know they seem a little expensive but considering the time saved it works out to be a massive cost saver!

Hope this little list helps!

Paul