Automated Pacman


Overview:

Automated Pacman is a game that showcases the use of AI to control the movements of the player and the enemies. The game was developed using C# and Unity, and features a finite state machine for game logic, as well as A* pathfinding for the enemies to navigate the maze. The player's movement is automated as well, with the use of an algorithm that aims for pills while avoiding the enemies. When a pill is eaten, it will target the enemies.

  • Solo project
  • Finite state machine
  • A* pathfinding
  • Raycast
  • Automation

Completion: November 2022

Duration: 3 day

Platform: Unity 2D


Contribution:

AI: State machine & A* pathfinding

To demonstrate my understanding of state machines in AI, I chose to create an automated Pacman game as my project for the AI in video game class. I implemented two types of finite state machines to govern the behaviors of both the player and the enemies. Additionally, to enable efficient movement for all characters on the map, I integrated the A* pathfinding algorithm using a node system. This algorithm calculates optimal routes, considering walls as obstacles, allowing characters to navigate the environment intelligently. The combination of state machines and A* pathfinding enhances the gameplay experience, providing autonomous and strategic behaviors for the player and enemies, as well as smooth movement across the game world.

Behaviour optimizations

In order to enhance the natural and intelligent gameplay of the characters, I implemented behavior optimizations. This involved incorporating distinct targets and a line of sight mechanic using raycasts. By utilizing these techniques, the enemies were able to prioritize high-priority objects, such as pills and pellets, while also reacting strategically based on their current state. For instance, the player character would target pills and pellets while evading enemies when in the wandering state. However, after consuming a power pellet, the player character would switch to a chasing behavior, actively pursuing and attacking the enemies. This implementation adds depth and complexity to the gameplay, creating a more realistic gamplay style.


closing thougths:

Automated Pacman is a solo project developed using Unity and C#, demonstrating the application of AI in controlling player and enemy movements. The game features a finite state machine for game logic, A* pathfinding for efficient navigation, and behavior optimizations including distinct targets and a line of sight mechanic. With automated player movement, strategic decision-making, Automated Pacman was for me a nice challenge that I am pround of having completed.