Skip to content

A browser-based Pac-Man clone built with HTML5 Canvas and vanilla JavaScript, featuring Dijkstra pathfinding for intelligent ghost AI.

Notifications You must be signed in to change notification settings

gurung-sekai/Pacman-Pathfinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Pac‑Man Web Game

A modern browser-based recreation of the classic Pac‑Man arcade game.
Built entirely with HTML5 Canvas, CSS, and vanilla JavaScript — no frameworks.

animations ghost


Overview

This project faithfully reproduces the original Pac‑Man experience while demonstrating core front‑end development and game‑programming skills:

  • Smooth keyboard controls (Arrow keys / WASD)
  • Intelligent Ghost AI using a shortest‑path algorithm
  • Collision detection for walls, pellets, and ghosts
  • Scoring and lives system displayed in real time
  • Classic “waka‑waka” pellet‑chomp sound effects

The full development process, from research through testing, is documented in
PacmanProjectReport.pdf
Presentation slides: PacmanPresentation.pdf


Features

  • HTML5 Canvas Rendering – all visuals drawn directly to the canvas
  • Game Loop Architecture – 30 FPS rendering and state updates handled in game.js
  • Pac‑Man & Ghost Classes – modular ES6 classes (pacman.js, ghost.js) for movement, animation, and AI
  • Dijkstra‑style Pathfinding – ghosts dynamically calculate the shortest route toward Pac‑Man
  • Responsive Browser Play – works in Chrome, Firefox, Edge, and Safari with no build tools
gameplay image

Gameplay Screenshots and Live Demonstration

live gameplay
Live.Demonstration.mp4

Repository Structure

├── index.html              # Main page and canvas setup
├── game.js                 # Game loop, map, collision logic, scoring
├── pacman.js               # Pac‑Man class: movement, animation, pellet eating
├── ghost.js                # Ghost class: AI pathfinding and movement
├── assets/
│   ├── animations.gif      # Pac‑Man animation frames
│   ├── ghost.png           # Ghost sprite sheet
│   └── sounds/
│       └── waka.mp3        # Pellet sound effect
└── docs/
    ├── PacmanProjectReport.pdf  # Full technical report & testing
    └── presentation.pdf         # Slide deck

How to Run

  1. Clone or download this repository.
  2. Open index.html in any modern web browser.
  3. Use Arrow keys or WASD to move Pac‑Man.
  4. Eat all pellets to win while avoiding ghosts.

No build step or server required.


Skills Demonstrated

  • Front‑End Web Development – HTML5 Canvas graphics and responsive layout
  • JavaScript Game Programming – real-time rendering, collision detection, state management
  • Artificial Intelligence – Dijkstra-based pathfinding for adaptive enemy behaviour
  • Software Engineering – modular code structure, documentation, and testing
additional gameplay

Future Enhancements

  • Complete power‑pellet mode (ghosts turn blue and flee)
  • Add mobile touch controls and multiple maze layouts
  • Improve audio and background music

Note: I have other major projects to pursue before returning to finish these enhancements.


Developed as an Individual Computing Project and Project Competition
to showcase strong programming, problem‑solving, and documentation skills.

Author: Pritam Gurung

About

A browser-based Pac-Man clone built with HTML5 Canvas and vanilla JavaScript, featuring Dijkstra pathfinding for intelligent ghost AI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors