francoisadt's Feed

Ms. Pac-Man step by step
05-22-2016 at 02:10 PM
0 Comment
Rate this Entry

Part 1 -Summary of Ms. Pac-Man Artificial Intelligence vs Pac-Man Artificial Intelligence (AI) Blog Entry at 05-22-2016 11:09 PM

Part 1 - Ghost Behaviour - A summary:


The behaviour of the ghost for pacman play was carefully analyzed by various experts but not that of mspacman.

Most people assume that the behavior and artificial intelligence of the ghost in two games are the same becuase mspacman is sort of a sequal or spin-off of pac-man.

A quote by someone on the Atari thread at:

By the way, the main difference in the Monster AI between Pac-Man and Ms. Pac-Man, is that in Ms. Pac-Man, Blinky and Pinky randomly move about the maze while in the first 7 seconds instead of going into their corners.

This was probably done to make patterns almost impossible. Also, there is no more 'disperse mode' (other than the initial 7 seconds). When the monsters reverse direction, they still chase you.

The above are the most common conclusion most people will come up with. So other than the two ghost Blinky, Pinky randomly move out, this is taken as the root of the difference in behaviour and the common behaviour as described by

Jamey Pitman and Don Hodges are taken as "gospel" that in mspacman its exactly the "same" - 'its only the mazes that look differently and so on..

But those that do not accept that their are differences and the behaviour is not ALLWAYS the same will fall into the trap of trying to play mspacman with the strategy and grouping techniques as a pacman player would. This is the number one reason why even seasons pacman players struggle to group the ghost in mspacman and struglle to outsmart the ghost. It is allmost like going to the AA Clinic. You first have to ackowledge and admit the problem before you can fix it.

Two of the most prominent people that have analyzed pacman ghost behaviour were Don Hodges and Jamey Pitman.

Don has written at a very low technical code level about pac-man killscreen, the fixes and also shed some light on the PINK ghost behaviour. Jamey Pitman describe the behaviour a levele higher up so that "non programmers"

can follow and understand. He also do give some background on the development history and design principals of the game.

Don Hodges:

"Pac-man split screen analyzed & fixed" :

"ms pacman kill screen & fixed" :

"pac-man's ghost behaviour analyzed and fixed" :

"Why do Pinky and Inky have different behaviors when Pac-Man is facing up" :

Jamey Pitman (new links, previous links to hist site does not exist anymore):

There are a summary of Jamey Pitmans explanation of pacman behaviour at:

Printed version:

Summary of The Ghosts Behaviours:


The key point here as Pittman describes, is that, "Every ghost has a distinct method for calculating its target tile in chase mode, resulting in their unique personalities."

I am quoting deliberately from a master mspacman player Darren Harris (DH) from Statten Island who wrote his summary on a TG thread "Pac-Man ghost behavior revealed" at:

Also from the same thread JamieVegas and Dav (J&D) did some additional explanations in addition to Jamey and Don did.

"If the monster behavior in Pac-man is the same as that in Ms.Pac-man then there are some things left out of the A.I. document."

This is an important statement. Have we really start to think what this means without assumming the behaviour of mspacman is exactly the same as pacman and what if not?


DH:"Blinky" is the aggressor, and generally will take the shortest route to get to Ms.Pacman.

J&D:"Input is Pac-Man's location. He doesn't consider which direction Pac-Man is going. He attempts to reduce the distance between himself and Pac-Man. He will turn in the direction that will immediately reduce whichever is GREATER of the horizontal distance or vertical distance between himself and Pac-Man. This usually has him tenaciously following Pac-Man, but will occasionally lead to a "stupid" choice."


Don Hodges pinky behaviour explanation:

DH:"Pinky" is as aggressive as "Blinky", but is the easiest monster to scare/fool into changing or continuing in various directions

J&D: "Input is four tiles in front of Pac-Man. Therefore direction Pac-Man is facing as well as actual location of Pac-Man determine Pinky's "target." Pinky attempts to home in on this target using the same logic as the Red ghost uses to home in on Pac-Man. This does indeed effectively "set up an ambush" if Pinky manages to get in front of you. At close range, the direction you face can mean life or death. If you're facing away from Pinky, he will chase you (his "target" is now in front of both you and him). If you face him or turn off to a side, he may turn away from you if that provides a shorter route to the target than running through you. Note that if the space four tiles in front of you is on the other side of a wall, he will go over there in preference to the side you are on."


DH:"Inky" is the only ghost that can be unpredictable/complicated, and will "change" it's habits depending on it's proximity to "Blinky" as well as it's height in the maze relative to "Blinky", along with your proximity and movement direction.(No other ghost affects the habits of any other ghost).

J&D: "Inputs, are the square two tiles in front of Pac-Man, and the location of the Red ghost. To envision Inky's target, draw a line from the Red ghost to the spot 2 tiles in front of Pac-Man. Now extend that line twice as far in the same direction and draw an "x" where it winds up. Inky wants to reach that "x." The fact that Inky's AI has two inputs instead of one makes his behavior more complex. On a fast-moving playing field with Pac-Man and the red ghost constantly changing position, that "x" can be jumping all over the place and sometimes Inky's behavior seems completely random - but it's not. No wonder his alternate name on the Puck-Man

rom is "Stylist"! His regular name, Kimagure ("Whimsy") is also appropriate. It makes sense that the closer the red ghost is to Pac-Man (technically, the closer he is to the spot two spaces in front of Pac-Man), the more predictable Inky's behavior appears."


DH:"Sue" will stay to the bottom left of Ms.Pacman and try to maintain a set distance.(Not too far, and not too close).

J&D: "Has two modes, "near" (within 8 tiles of Pac-Man) and "far" (farther away than 8 tiles). In "far" mode, heheads toward Pac-Man using Blinky's logic. This gets him in the same general area of the maze, but then in "near" mode, he has a bizarre change of heart and decides to head for his corner of the maze (lower left island). Unless you happen to be in the lower left region, his about-face will soon take him into "far" mode again, and he will circle back toward your area. If you are in the lower left, he will circle his favorite island indefinitely. He will usually only "chase" you if you happen to be in the path between him and the lower left of the screen. Orange's "far" mode rarely leaves him doubled up on top of Red due to the fact that their home quadrants are on opposite sides of the map and "scatter" mode repeatedly separates them. Plus, red is usually close enough to you that orange will go into "near" mode if he gets close to red."

ghost corners:

DH:"The maze shape in combination with the exact positions of the characters within the maze and in the maze relative to you are just as important. "

As mentioned in various post and also described by one of the authors of mspacman that pacman ghost behaviour is deterministic and that of mspacman is non-deterministic.

A game player also confirmed this at:

Pac-Man is very basic and has the same maze for all the levels. The ghosts also follow a set pattern which means if you can memorise the patterns, it is easy to get a high score. Also the fruit bonus always appear in the same place. In Pac-Man the ghosts follow a set pattern that, once learned, can be avoided consistently. That’s not an exploit most gamers take advantage of , but play Pac-Man enough and you’ll see that the movements of Blinky, Pinky, Inky and Clyde can get very predictable.

Oppositely, Ms. Pac-Man’s AI creates ghosts that act similar to how they did in Pac-Man, but aren't as easy to anticipate. This time Blinky, Pinky, Inky, and Sue--Clyde changed some in the sequel--will make course corrections based on the player’s movements, which means repetitive patterns wouldn’t work on them

"The ghosts' behavioral patterns are different, and include semi-random movement, which prevents the use of patterns to clear each round."

Interesting point here "semi-random movement" - could this be the crutz of the matter. Let us explore further......

Part 2,3,4, 5 to follow.
Join us