Pac-Man's Ghost Behavior Algorithms
An anonymous reader writes "This article has a very interesting description of the algorithms behind the ghosts in Pac-Man. I had no idea about most of this information, but that's probably because it's difficult to study the ghosts when I die every 30 seconds. Quoting: 'The ghosts are always in one of three possible modes: Chase, Scatter, or Frightened. The "normal" mode with the ghosts pursuing Pac-Man is Chase, and this is the one that they spend most of their time in. While in Chase mode, all of the ghosts use Pac-Man's position as a factor in selecting their target tile, though it is more significant to some ghosts than others. In Scatter mode, each ghost has a fixed target tile, each of which is located just outside a different corner of the maze. This causes the four ghosts to disperse to the corners whenever they are in this mode. Frightened mode is unique because the ghosts do not have a specific target tile while in this mode. Instead, they pseudorandomly decide which turns to make at every intersection.'"
Take note CS professors: writing a Pac Man ghost algorithm would be an awesome exercise.
There's no -1 for "I don't get it."
I've known about this for years, but it's still quite fascinating. A 30-year-old game featured AI more sophisticated than what you'll find in most games today. Or at least AI appears more stupid and easier to foil today.
If I remember correctly Ms. Pac-Man added a randomization factor to avoid ghosts falling into set patterns.
The most interesting behavior that i recall in those arcades was crush roller's. Only 2 "ghosts" but damn clever.
---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
America, Home of the Brave.
the server's slashdotted
Just because you're paranoid doesn't mean they aren't out to get you
FTA
One final special case to be aware of are the four intersections that were colored yellow on the simplified maze diagram. These specific intersections have an extra restriction — ghosts can not choose to turn upwards from these tiles. If entering them from the right or left side they will always proceed out the opposite side (excepting a forced direction-reversal). Note that this restriction does not apply to Frightened mode, and Frightened ghosts may turn upwards here if that decision occurs randomly. A ghost entering these tiles from the top can also reverse direction back out the top if a mode switch occurs as they are entering the tile, the restriction is only applied during “regular” decision-making. If Pac-Man is being pursued closely by ghosts, he can gain some ground on them by making an upwards turn in one of these intersections, since they will be forced to take a longer route around.
is currently in frightened mode
Yawn... This stuff that already been posted on the Pacman Dossier for years. Not really "news for nerds".
Now, what would really be "news for nerds" is the analysis of the ghosts' behavior in Google Pacman, which is very similar, but subtly different.
Of course, since Google Pacman's source is available, this can theoretically be deduced straight from the source, but it's more fun to figure it out by trial and error. Great timekiller. There are definitely notable differences -- like certain directions the ghosts will never turn to if they enter the intersection from one direction, but will if they enter the same intersection from the opposite direction.
I was already slowly working on a clone as a programming exercise, this is a nice coincidental help.
(:
Does that mean you have an upside-down face like that kid on Family Guy? :)
based on being really good at the original pacman, achieving a high score was simply a matter of learning patterns, so they must not really be referring to the original pacman here because I think that algorithm must have been pretty simple. To be a great player on the original pacmac you run pacman through the same pattern every time in every level you've learned, hitting the energizer pellets precisely when you know you can always run the same pattern and eat the four ghosts as the flee. Always the exact same pattern for each level until you finally reach a level where you have to learn the pattern. It was really crazy playing because you could do all the levels you'd memorized pretty much with your eyes closed, so when you got really good; it took a frigging long time to get to a level you did not know.
Did you ever wake up in the morning, with a Zombie Woof behind your eyes? -- FZ
Back in those days, we didn't have fancy graphic systems like CGA so I had to make do with VT100 and NCURSES. My ghosts were reverse video double quotes which looked good enough. Unfortunately, the 9600 baud transfer rate only allowed 2 ghosts to be playable. With that in mind, I put together a really simple chase algorithm:
All of the other rules of the original PAC-MAN (player is faster when no dots, slower when eating them, faster in corners, and ghosts are slower in tunnels) were implemented. The hardest part was the random generator. 128 bit shift-register written in 8080 assembly (my dad helped a bit). By the time it was all done, my 2 ghosts were harder than the 4 in the original. They also seemed to be predictable as well. Every time one of them would hit that random turn it always seemed to be the one that hosed you completely!
"Be grateful for what you have. You may never know when you may lose it."
If you don't want to be this http://www.nextnature.net/2008/01/pacmans-skull/ quit eating this http://truckbearingkibble.com/comic/2008/06/17/pellets-of-langerhans/
I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
...is that the movements of the ghosts are completely deterministic. Expert players eventually learned to exploit this with the rote memorization of "patterns".
Look at that, you make a valid point that the community would do well to heed and the mods try to censor you by modding you down so far (currently Score: -1) nobody will read what you have to say. Then somebody responds by saying, basically, "Men are only sexist because you women are mostly hypocritical bitches" and that poster gets modded up (currently Score:4, Insightful) while the one who responds by pointing out flaws and counterexamples to that "Insightful" post gets modded down and hit with another (Score:4 Insightful) response that presents no insight but more unsupported assertions.
Kinda makes you feel like the mods are compensating for something, doesn't it? Maybe you hit too close to home...
"I don't care about the Constitution!" --Bill O'Reilly, November 17, 2009
If they had named it Puckman, the idiom "Fuckman" would be in wide use, resulting in a very different world. A world without 4chan, mayhaps.
Ghosts returning to their den after they've been eaten by pacman, that's the fourth mode ghosts can be in,
Laurentius de Voltolina meets Pac-Man
Pac-Man's Last Supper
-kgj
... are wildly enthusiastic about porn?
Really? I somehow doubt the PC police and radical feminists will be happy about your support for their causes.
Well said.
-kgj