Hacker News new | past | comments | ask | show | jobs | submit login
Understanding Pac-Man Ghost Behavior (2010) (gameinternals.com)
79 points by shawndumas on Oct 2, 2015 | hide | past | favorite | 7 comments



One nice approach to programming the ghosts is "collaborative diffusion": http://sgd.cs.colorado.edu/wiki/Collaborative_Diffusion

- Associate each tile with a "pacman-ness" value, which will be calculated iteratively

- The tile containing pacman is held at the maximum value

- Tiles containing walls or ghosts are held at zero

- Every other tile's value is the average of its neighbours' on the previous iteration

By hill-climbing this value, the ghosts will follow the shortest path to pacman. Also, since the ghosts act like walls, they will avoid following each other and instead converge on pacman via different routes.

I made a Python implementation years ago, and it was impossible to avoid capture!


What about a Bayesian search?




This page: http://gameinternals.com/post/2072558330/understanding-pac-m... has even more on Pac-Man ghost behavior (and many fewer ads).


Ok, we changed the url to that from http://www.todayifoundout.com/index.php/2015/10/ghosts-pac-m.... Thanks.

Edit: It was posted at the time: https://news.ycombinator.com/item?id=1963553.


I was confused as to why just today I found two separate links on the same subject. Probably clicked the initial link.

The todayifoundout version credits the older article though.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: