PDA

View Full Version : ai in pacman?


javadi82
01-01-2004, 02:28 PM
Is AI used in pacman? (I remember andre-michelle telling something to that effect). Any URLs explaining AI in pacman would be welcome.

(I also searched gamedev.net but to no avail).

Thanks.

Marz
01-01-2004, 07:07 PM
AI in Pacman is actually a form of the distance AI that I explain about in my AI tutorials founds here...

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=16649

Since the ghosts travel in only up down left and right, you'd wnat to set up the AI to do that as well. If Pac-Man is left of the Ghosts, they try and go left as their first command.. If they can.. Then you might want to throw a little bit of randomness in the array by having them do something stupid by avoiding Pac-Man all together. Which is a little bit of random AI talking :)

pom
01-02-2004, 03:02 AM
Actually the tutorial of tonypa (or something like that) could give you good ideas.

javadi82
01-02-2004, 03:21 AM
here are the two links i found at andre-michelle(should have used the search button at andre's site!)

1.http://members.tripod.com/~pactor/rwilliams.html#Ghost

2.http://www.mameworld.net/pacman/PacGuide.pdf

junahu
01-07-2004, 07:01 AM
mmmm. delicious

but what about the ghosts after you've eaten a power pill and the ghosts all turn blue? Do they have the same behaviour then?

mdipi
01-07-2004, 08:08 AM
they go the opposite when they eat the power pill. So have the ghosts go the opposite.

SeiferTim
01-07-2004, 04:45 PM
It'd make more sense (I think) to make three different sprites for each ghost, one for Normal, and one for Blue, and one for the Eyes. When everything's normal, have the ghosts act accordingly, chase after pacguy! (If you're going to be true to the original, each ghost had it's own personality) When PacPerson eats a PowerPellet, 'kill' off all the ghosts (that are not in their home base), and replace them with the Blue version of them selves, which move slower, and try to flee from the Pacster. after some kind of timer counts down to 0, then the ghosts should blink, and then go back to normal ('kill' the Blues, and replace them with Normals). If PacMan eats (collides with) a blue ghost, after some stunning visual effects, you should 'kill' the blue ghost sprite, and replace it with the eyes, which speed, via the most direct path, to the GhostHouse, where you then 'kill' that sprite, and replace it with a Normal ghost. There you have it, that's how I would do it! Hope it helps you!

Marz
01-07-2004, 05:55 PM
Here is my synapsis on Pac-Man AI...

It's really not that hard to do and alot of people look way too into AI in the first place :D

I'll explain to you guys in pseudo code (not real actionscript code) on how to pull off a Pac-Man AI.

First off. It starts off with the map making process.. I personally like to use a method known as the invisable waypoints to allow the ghosts their *pseudo* AI.

Let's take a gander at this image.. Now, I whipped this one up pretty fast so don't make fun of the maze design :to:

http://www.mentalconcepts.com/game/waypoints.jpg

This will give you an idea behind the waypoint system. Everytime a ghost goes over a waypoint, the waypoint will give the ghost information about where he can go next. A simple function check can then tell the ghost whether to run away if they are blue, or if they aren't to run towards pac-man.

Now... That looks like alot of hitTests all the time though, doesn't it?! It is.. That's why you plan out a grid of waypoints in a better location. It takes time, but it'll save your game alot of computer clock ticks and that'll make things run alot smoother.

Starting from the top and working your way down the list, you will have each waypoint named like such..

wp1, wp2, wp3, wp4, wp5, wp6.... and so on...

With these waypoints, you will have connecting waypoints as well. These connecting waypoints are known to be as waypoint lines. Each waypoint will have a line that connects it with another waypoint.

Kind-a like the such in our example.

http://www.mentalconcepts.com/game/waypointlines.jpg

Now.. That's it for day one.. I';m still hungover a little bit.. And I need a nap.. My stomach is getting a little woozie... :to:

junahu
01-12-2004, 04:45 AM
I'm still confused with the blue ghosts. Do they all run away with the exact same behaviour or do they do the opposite of what they would have done had they been normal ghosts?

Does pacman's movement also use waypoints or do we just hittest with the maze walls?

APDesign
01-12-2004, 04:53 AM
they probably run away with the same behavior, it probably just sets the point for them to run to the point furthest away from pacman, and decreases their speed.. or at least that seems like the easy way to do it.

junahu
01-12-2004, 06:53 AM
what if two points are the same distance away? Does their individual personality behaviours kick in then or would the choice be random?

APDesign
01-12-2004, 07:07 AM
I don't know, it wasn't very well thought out.... you would somehow have to keep track of where pacman is so even if the furthest point is on the other side of him (which would probably eventually happen) the ghost wouldnt just turn around and run into him. Their individual behavious would always be on, they would just be moving towards a different point than the pac man. Then again I've never done anything with AI, so you probably shouldnt take my advice. :thumb: :trout: