NPC finds a path to goal using A* and follows the path. This program was made using C++.


  • Draws one step of A* each frame
  • A path is always found if it exists
  • The path is optimal with a heuristic weight of 1.0
  • The path is optimal with a heuristic weight of 0.0, and the search grows in a circular pattern
  • The path uses diagonals and does not run into corners
  • Calculate heuristic using both Euclidean and Cardinal / Intercardinal methods
  • Rubberband final path where possible
  • Smooth using a Catmull-Rom spline



A*  Smoothing  Rubberbanding



Finate State Machine and Formations



I implemented a 2 vs 2 basketball game. It starts with the NPCs running out to the court to do a tip off. The offensive team is blue and the defensive team is red. As soon as the offense gets the ball, they try to go for the goal, but were blocked by the defense. Then, they ran the pick and roll. As soon as the NPC scores, all the NPCs go into half-time where they do an imperial march down the court with the NPC who scored leading. In addition, I implemented a crowd where they say De-Fense. Once the offense team scores, they leave the stadium. This program was made using C++.



Finite State Machine Screenshot  Finite State Machine Screenshot  Formation