#### Archived

This topic is now archived and is closed to further replies.

# PacMan ghost AI

This topic is 5407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to build a pacman ghost AI that is completely not dependent on anything random. One of the parts I want to write for the ghost AI is to be able to tell it to go to a specific tile, and then have it figure out automatically how to get there. Does anyone know how I could do this? So I could write Ghost.GoToTile(13,5); and it would do it.

##### Share on other sites
just an other proposition idea:
what if you would just make a "follow the direction where pacman is" ai?
I mean, every time it has the choices between 2 or more pathes, it''ll take the one corresponding to pacman''s direction. If pacman is on the left, then go to the left path, that''s all.
Some ghosts could also have a "horizontal move" priority, or a vertical one or just some compromizes like the direction in which lies the most distance between him and the pacman.
just an idea...

##### Share on other sites
thats a pretty good idea.

##### Share on other sites
quote:
Original post by misterX
just an other proposition idea:
what if you would just make a "follow the direction where pacman is" ai?
I mean, every time it has the choices between 2 or more pathes, it'll take the one corresponding to pacman's direction. If pacman is on the left, then go to the left path, that's all.
Some ghosts could also have a "horizontal move" priority, or a vertical one or just some compromizes like the direction in which lies the most distance between him and the pacman.
just an idea...

It'll be too easy. The ghost will just follw pac-man around.

Or it'll be too hard

As for the direction stuff, you can look up A* (A-star), but that might be overboard for a pacman clone. Other than that, I would think just a little bit of thinkig, and you should be able to solve it.

[edited by - beernutts on February 26, 2004 10:38:42 PM]

##### Share on other sites
at every junction in your map, place a node, and create a path-map by connecting all nodes that ''adjacent''

then use a Shortest-Path algorthm to find the best way to get from where you are to where you want to go.

Add a filtering system that lets you weight edges depending on arbitrary characteristics (i.e. defined by the caller of SPT) and then you can have ghosts who prefer to move horizontally rather than vertically and vice versa. Another thing you should try is mark nodes where pacman has been recently, and have one ghost interpret those nodes as very expensive, that way, that ghost will always try to get to pacman using a route that pacman did not come from (i.e. cut him off from the front)

George D. Filiotis

##### Share on other sites
if you search the AI forum, you can find the exact behavior of the ghosts in pacman (each one has a different way of chasing pacman)... this has been asked a billion times already.

##### Share on other sites
It should be noted that the original pacman''s AI had 3 different ghost AI''s..

There was the smart ghost, the not so smart ghost, and the dumb as a stump ghost. And they never did anything "randomly" - that is.. if you repeated the exact same moves on a particular level the ghosts would also repeat their exact same moves. Once you got up to the highest level you could repeat the exact same pattern and win level after level...

- Rockoon

##### Share on other sites
1) A gohst that moves about at random
2) A ghost that tries to follow pacman
3) A ghost that tries to cut pacman off
4) A ghost that goes where the majority of the pellets are

I think this sums up pacman ai.

##### Share on other sites
I''ve read that Pac-man AI, everything from 1 - 3 from try_catch_this is what I heard, and then for the 4th ghost, he stays around the centre of the map close to the portals that put pac-man on the other side of the screen.

##### Share on other sites
I also heard of a pacman where you could beat the game by performing the same exact actions.

""
pongv0.1.7.7

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633759
• Total Posts
3013720
×