Archived

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

Rodrigox17

Pacman AI

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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 this post


Link to post
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




Share this post


Link to post
Share on other sites