Public Group

#### Archived

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

# Pacman AI

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

## Recommended Posts

I''ve been trying to code a pacman ai, but i can''t get the ghost to find their way around the walls. So sometimes they get stuck. Is there anyone who has coded a pacman ai that could help me out????

##### Share on other sites
I know there are documents detailing the AI used in pacman lurking somewhere on the net. You should search for them via google.

One thing you could do to resolve the getting stuck difficulty is have the ghosts only change their path when they reach an intersection. Otherwise they just keep following the passageway they are currently in. The only problem I can forsee is them getting stuck going back and forth from one intersection to another. Better than not moving I guess and you could have them never backtrack twice or something.

##### Share on other sites
umm, only decide where the ghosts are going to move at the corners..(both on the map and in your corners)

now whatever way the ghost came from, make that an invalid choice..

         |  2 |--------    --------     1   GG->  3--------------------

SO GG(our green ghost) is going towards 3, so he must now make a choice, make 1 an invalid choice, because GG just came from 1.

       ------       |  ^ |       |  | |          | GG |--------    --------     1         3--------------------

our GG will continue intil he hits the wall, then reverse, when he gets to the corner, since he came from 2, he can only goto 1 or 3.

Hopefully, this helps...

##### Share on other sites
generally, at least one ghost follows the general path of the pacman- so if its path changes suddenly, so should the ghost''s. therefore, 1 should NOT be an invalid choice

ahh, I love TI-83 games.

##### Share on other sites
If I remember correctly, one ghost always tried to follow the pacman. another tried to get the player at intersections, another watched those holes that you could go to reappear on the other side of the map, and the last one moved more or less randomly, just in the general direction of the player.

I may be wrong, but this is what I remember reading some time ago.

##### Share on other sites
quote:

generally, at least one ghost follows the general path of the pacman- so if its path changes suddenly, so should the ghost''s. therefore, 1 should NOT be an invalid choice

umm, nope, ghosts don''t back track, they do reverse every so many seconds, but if a ghost is going forwards, it will never turn around and go in the reverse direction. If they reversed, it would be impossible to trick them

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009401
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!