Here’s a Unity project I wrote with two classmates for a Game Programming AI class. The project demonstrates A* pathfinding and steering behaviors. I had a great time working on these functionalities because they’re simple yet powerful. Below are two descriptions and videos of some of the work.

This video below shows A* pathfinding using grids. In the scene, ten zombies are all using A* to find paths to the player. To reduce lag and improve runtime, I:

  1. Spread the processing of each zombie into separate frames
  2. Utilized our own Priority Queue class to better handle the retrieving of the Node with the lowest F-cost
  3. Used HashMaps/Dictionary classes to reduce the cost of checking if a node was contained in open or closed sets
  4. Only recalculate paths if the target has moved to a new node or location

I find it exciting to be able to see the feedback of each zombie path changing as the main player moves around various obstacles.

You can check out the code @
Be sure to look at Pathfinding.cs for the A* Algorithm.

The next video is about creating autonomous behavior by calculating steering forces. Steering is about calculating the force required to achieve a desired movement behavior for AI characters. All movement is handled through our own calculations of acceleration, velocity and position. Unity’s collision detection is also turned off to best show obstacle avoidance. I helped implement many behaviors such as:

  1. Seeking a target
  2. Fleeing from a target
  3. Wandering
  4. Avoiding Obstacles

Below you can see this project’s implementation of Wandering along with Obstacle Avoidance.

You can check out the code @
Look at the MoveController.cs for the behaviors mentioned.
Look at the Flocking Anchor.cs to see algorithms for shape-based flocking.