Hello guys,

Today I am pleased to announce a new package, for everyone who wants to create any kind of shooter style games: the Enemy AI.


Get it now on the Asset Store: Enemy AI

This package features ready to use enemies that can patrol, search, and engage, looking for cover protection, advancing in player direction, and also can alert other enemies of possible threats.

This is the standalone package version, for those who are creating, for example, a FPS, or a top down shooter, or any other shooter game. The demo scenes that comes with the package provides some basic player controllers, focusing on the demonstration of the enemy NPCs.

At any time, if you have acquired the Enemy AI package, and are looking for a professional shooter controller, you can upgrade to the Third Person Shooter Bundle, obtaining the Cover + Shooting System with a discount, comparing to the standalone prices for the packages.

Tutorial: How to setup the enemy NPCs
Tutorial: Mastering Enemy AI: Building Custom FSMs for NPCs

For any support related issues, to ensure the faster response possible, please use the official support channel:

Support for the Enemy AI package

This is the official forum for suggestions, comments, etc. Please fell free to provide any feedback.



We've just released a new video tutorial on creating custom Finite State Machines (FSMs) for hostage NPCs using our Enemy AI system. If you're interested in enhancing your game's AI, this video might be helpful.

What You'll Learn:

  • Building a custom FSM for a hostage NPC
  • Creating states and transitions
  • Implementing actions to enhance your game's AI
  • Practical examples and demonstrations

Watch the Video:

New Tutorial Video: Mastering Enemy AI: Building Custom FSMs for NPCs

Feel free to watch and share your thoughts or questions in the comments.

Happy learning!

The Enemy AI package figures a FSM (finite state machine) AI model for the enemy NPCs (non player characters).
The main decisions are based on tridimensional senses, like the view sense, the hear and focus, etc. They are basically defined by a radius and, if applicable, an angle (ex.: field of view angle for the view sense):

The following animations highlight some of the main states in the FSM. The patrol state is a clear alert level state, where the NPC guards a route or a fixed position:

The search state is a warning alert state, where the NPC navigate to a suspicious position to investigate it:

The take cover state is an engage state, in which the NPC seeks for a cover spot to protect itself from direct fire:

There is a chance (customizable) for the NPC to avdance to a cover there is near the player, defining a more agressive approach:

Finally, another enemy behavior that is important to highlight refers to the focus movements. This kind of behavior is triggered when the enemy is in close combat situation, making the NPC to focus on the target while moving, avoiding turning his back to the player:

1 Like

This looks like exactly what I'm looking for!
Before I purchase, my question is: Is there a way for me to modify the attack behavior?
For certain enemies, is it possible for me to replace the animations to make it attack with a sword instead of shooting?

The actual attack action is basically a ranged attack behaviour, I don't know if it shares many code similarity with a melee type attack, but maybe it does, and you can take advantage of some part of code in the existing attack action.

The point here is that, due to the modularity of the solution, you can easily create new states and actions to expand the FSM. In that case, you just need to create a new attack action for the melee attacks type.

I am working on a next video on the tutorial series that will show how to expand the FSM with new behaviors. This will for sure provide a good overview for those who still haven't got the package (and also will clarify some stuff for those who already has it).

1 Like

Sounds fantastic, looking forward, thank you!

1 Like

Hello guys.

A day 1 patch for the Enemy AI package is already online. It fixes some minor bugs regarding the enemy aim calibration, and also isolates scripts with common classes names under the Enemy AI namespace, to avoid conflicts.

So please update your packages under the asset store.

This looks great. Can we see some video examples of the AI in action in a FPS? Would love to see the AI take some tactical approaches to the player, beyond seeking cover (flanking, moving more often to avoid shots). Or how it behaves in a deathmatch scenario.

The AI features some more than reactive actions, like engage in movement when closer to the target, advance to another cover near the player, using a tightening up strategy, evading a compromised cover, among others.

A strategy for flanking, not by a single enemy but using divide and conquer, is being studied and are considered to be included indeed.

Anyway, you can try it by yourself: Try the Demo

The above demos are focused on the AI only. For a more professional experience, you can check the Third Person Shooter Bundle demo, which includes the Enemy AI package too: Try the Demo (here you can also download the binaries).

Thanks for your reply. I understand that it's integrated with a third person controller, but what solutions are available for any currently first person assets? Thanks.

I didn't understand well your question. You want to know if it is possible to integrate the Enemy AI within a FPS project? If so, yes it is.

The Third Person Shooter Bundle is integrated with the Cover + Shooting System, a third-person controller. The Enemy AI contais 3 demonstration scenes: a FPS, a light gun and a top down shooter. This scenes in the standalone package are just to demonstrate the integration, and are focused on the Enemy AI features. The bundle contais a more polished, professional shooter controller, since it is a complete project.

If you intend to integrate it with a third party player controller, the Enemy AI is you choice. Following the setup video tutorial, you can integrate it with any kind of shooter project, FPS included.

Thanks for your reply, I'll definitely have to check the demo out.

Hi, any further info on expanding the FSM of the AI you mentioned previously? Thanks.

I am editing the video, adding audio for steps description, and it will come online as soon as I finish it, thanks.

I'd like to use this in VR. Can the HUDs be omitted without breaking the system?

Nevermind, was too easy. I modified the Enemy AI package for VR (Oculus Quest w/ Link) with the XR Interaction Toolkit in about 30 minutes. This is a very nice, simple but powerful AI for Unity.


Hey Viniterra, I've been building a VR game for a few weeks using your EnemyAI. Slow progress at times, but really enjoying using your asset (Thank you!!).

I occasionally come across small little issues that I can't work out, especially as I'm not the greatest dev, if you could help me - that would be brilliant!

I cannot work out how to change the parameters of the 'One shot audio' gameobjects that are generated for each gun shot. The volume is fine, but they quickly become quiet over distance, how can I change their 3D sound setting to have a greater minimum distance?

And I have an enemy on a first floor, he will spot the player and react by running down the stairs to shoot, rather than shoot from where he is. Is there anything you can suggest?


Nice demo! Aren't you using patrol way points for the enemies? They will sure guarantee a more dynamic environment.

1) The shot is a 3D sound, where you can manage its volume and origin. The shot sound is triggered in the ShootBehaviour script, on the line 215 (the last parameter, with value 5, is the current volume):

AudioSource.PlayClipAtPoint(weapons[weapon].shotSound, gunMuzzle.position, 5f);

2) The enemy will try to look for a near cover to protect himself. If that cover is stairs down, and there is a navmesh path trough the stairs, the enemy will run down the stairs. The enemy also advances in cover towards the player eventually (the change cover chance parameter), so he may start by shooting the player from upstairs, and then try to change to a cover at the lower level. It is basically a composition of the enemy states in the FSM and the level design, specifically the covers and the current player positions.

1 Like

That was the FPS demo from the package so whatever was driving the AI there. I didn't change anything on the Enemy side except for the character bodies.