← Back to all projects

Ms. Pac-Man vs Ghosts AI

2012-2013
AIGame AIJavaPythonPathfindingTactical PlanningMs. Pac-ManCompetitive Programming

The Ms. Pac-Man vs Ghosts League is a prestigious series of academic AI competitions and a standard framework for game AI research, regularly featured at major conferences like IEEE CIG (Computational Intelligence and Games) and WCCI. Originating from the CEC 2011 competition, it quickly became a benchmark for AI agents, with over 60 Ms. Pac-Man agents participating in the 2012 edition alone.

The Challenge

The competition utilizes a Java-based simulator that closely mimics the original arcade game physics but introduces non-deterministic elements (ghost behavior, pill spawning). The core objective is to develop an autonomous controller capable of navigating the maze, surviving against a team of four ghosts, and maximizing the score through strategic pill consumption and 'ghost hunting' combos (200, 400, 800, 1600 points).

Technical Constraints & Complexity

  • Real-Time Limits: Agents must make decisions within a strict 40ms time window per game tick.
  • Observability: While initially granting full observability, later iterations introduced Partial Observability (PO), where the agent only sees within a line-of-sight radius, requiring memory and prediction models.
  • Adversarial Environment: The ghosts operate as a coordinated multi-agent system (or individual controllers), making the environment highly dynamic and hostile.

My Implementation

My strategy focused on a hybrid approach suitable for the Full Observability track:

  • Dynamic Pathfinding: Utilizing optimized A* search to find safe routes while predicting ghost trajectories.
  • Risk Assessment (Influence Maps): Developing a real-time 'heat map' of the maze where ghost positions projected negative influence (danger zones) and pellets/power pills projected positive influence (opportunity zones).
  • State-Based Tactics: Implementing a sophisticated state machine to switch between 'Foraging' (efficient eating), 'Evasion' (survival), and 'Hunting' (aggressive pursuit of vulnerable ghosts) modes based on distance metrics and timer states.

This project not only achieved top-tier rankings in the league but also served as a practical exploration of techniques widely cited in research papers, such as MCTS and influence fields.

Media Gallery

Ms. Pac-Man vs Ghosts AI media 1
Ms. Pac-Man vs Ghosts AI media 2