Below is a series of enemy AI behavior implementations I developed myself in Unreal. They feature heavy use of A* and Dijkstra pathfinding as well as behavior trees and blueprint decision making. Among what I created was an occupancy map adversarial search, an A* implementation for pathfinding in 3D space, a Dijkstra implementation with LoS, distance tracking, and 3 different spatial behaviors, 4 different enemy archetypes and behaviors.
I began by implementing a basic A* pathfinding algorithm basing navigation on a prebuild grid system in Unreal. Once I implemented this algorithm I used raycasting to accomplish a path smoothing system and had the enemy move along the smoothed path instead of the A* path.
Next I created a Dijkstra flood fill distance map, and using blueprints and a spatial function utilizing an evaluation layer to determine best cell choice. I created multiple response curves and created a hold, hide, and flee set of behaviors, as you can see in the implementation to the right.
My last function that I created was a perception system, with the goal of creating an adversarial search function utilizing an occupancy map, an A* path, and a behavior tree for different search states. The enemy waits until the player is within a line of sight function hardcoded to be a 45 degree angle and raycasts towards the player. When the enemy perceives the player, it moves towards them using an A* path. From there, if the enemy ever loses the player, it enters into a search behavior. This search behavior diffuses probability of player occupancy across the grid, decides the highest probability location the player will be, and pursues it. When that cell is perceived, if the player is not found, it will wipe the probability and re-diffuse it across the grid, creating a non-repeating, endless search until the player is located again.
Next, I created behavior trees in blueprints for different types of enemies. I created a boss, which shoots cannonballs at the player, minions which rush the player and self destruct, soldiers which move around the player and charge once minions die, and an ambusher which hides behind the player until it gets a chance to charge them. The boss also waits until there are no friendlies left and increases its fire rate dramatically.