I'm trying to make a Pac-Man game with some decent AI (don't worry- it's not nearly as bad as Pac-Man XP- in fact, other than AI it's going pretty well.) I need some help coding some basic ghost AI. I intend on each ghost having their own 4 sensors, so they can have custom engines.
" * each ghost has its unique behaviour
* the first ghost will move following to a preprogrammed pattern of
movements through the maze (e.g. right, up, left, down, left, ...).
This pattern is always the same for a level.
* the second ghost (the red one) moves using a pathfinder routine, trying
to minimize x/y-distance to the pacman (this we described earlier as
"strategic movement")
* the third ghost moves on pure random
* the forth ghost uses another pathfinder routine, trying to predict the
next movements of the pacman (trying to intercept him)
While this garantees an interesting and quite predictable gameplay, this
approach has some drawbacks: First, for the first ghost, you have to design
carefully an extensive path (movement pattern) per level. Second, the movement
of the forth ghost can only be implemented by defining some key crossings (as
entrances to loops) and by tracking the pacman's movement. So you could
predict the key position the pacman will be likely to be next. But in order to
do this, each level-layout has to tribute to these key positions, meaning that
it has be modelled around these crossings, which will obviously limit the
range of possible designs."
And contains a different method of AI: http://www.masswerk.at/JavaPac/pacman-howto.txt
The first (masswerk.at) and last (gamedev) ones should give you a good starting point if you want the ghosts to be authentic. The first one's suggested movement is a universal movement for each ghost that combines pathfinding with randomness.
For the pathfinding, because pacman levels are relatively simple (assuming, again, you're attempting to be authentic), it would be possible simply to build an array that has each intersection (because ghosts only need to make decisions on intersections) on one axis, and each 'tube' (or whatever, the confined sections between two intersections) on the other axis. Each cel in the array would indicate which node the ghost should move towards at any intersection depending on the current 'tube' pacman is in at the time.
That covers Blinky.
Pinky though also uses pathfinding, but tries to predict pacman's movement. For him use could use a similar table, but double the size, because pacman can move one of two directions in each tube. So instead of Tube A, Tube B, Tube C etc. on one axis you would have Tube A heading towards Intersection A, Tube A heading towards Intersection B, Tube B heading towards Intersection B, Tube B heading towards Intersection C, ...
On second thought you could in fact use the double-sized array for both ghosts (Inky and Clyde move randomly or follow a set path), and simply swap the 'heading towards' lookup for Blinky. That way Blinky seeks the intersection behind pacman, and Pinky seeks the intersection aftwerwards.
Then to finish off, when either of those two are on an intersection attached to the tube pacman is currently on, the simply move towards him (you'd have that in the array, so the cel at [Intersecion A, Tube A] would direct the ghost towards Intersection B because that would pass through pacman on the way).
'" * each ghost has its unique behaviour
* the first ghost will move following to a preprogrammed pattern of
movements through the maze (e.g. right, up, left, down, left, ...).
This pattern is always the same for a level.
* the second ghost (the red one) moves using a pathfinder routine, trying
to minimize x/y-distance to the pacman (this we described earlier as
"strategic movement")
* the third ghost moves on pure random
* the forth ghost uses another pathfinder routine, trying to predict the
next movements of the pacman (trying to intercept him) '
I actually know that the first ghost, on the top of the list, does not move preprogrammed, but they all move weird-like. The cyan one, for example, will do what the red one does if the red one is closer than pac-man, but if he's close to pac-man, he'll try to follow him.
I'm not trying to be authentic; I need an AI that will work in a custom maze. I'll try the pathfinding object.
I can do a simple grid based movement so that the ghosts will try to follow the player... But as Radix said all ghosts isn't supposed to act this way...
I noticed that in the origional game, the ghosts follow a set path until about 7 or so seconds into the level (depends on the round) then they try to get Pac-Man. They keep alternating every 7 seconds or so
nope not really - each ghost in pacman has its own specific AI routine.
i found out what each were, and did something similar in pacz, apart from that i added abilities to each one. the basic AI routines are more or less what they're supposed to do.
I know they're each different- but for a while at the start of the level they do go in certain areas- Blinky goes to the top-right corner, pinky the top-left, inky the lower-right and clyde the lower left. Then after a while the AI gains control. Then once many dots have been eaten, they temporarily go back to this set movement, then go back to AI.
I noticed that in the origional game, the ghosts follow a set path until about 7 or so seconds into the level (depends on the round) then they try to get Pac-Man. They keep alternating every 7 seconds or so
They alternate between scatter and normal mode. I think it's something like evey 7 seconds, 4 seconds, 7 seconds. One of those links I posted goes into depth on the AI.
They alternate between scatter and normal mode. I think it's something like evey 7 seconds, 4 seconds, 7 seconds. One of those links I posted goes into depth on the AI.
Yeah, that's what I meant. I saw an article on Wikipedia.
n/a
Deleted User
8th September, 2006 at 14:46:44 -
The apoptotic index (AI) was significantly higher in emphysematous lungs compared to the control group (p ≤ 0.01), particularly if only lungs with AAT-deficiency emphysema were considered (p ≤ 0.01 vs p = 0.09). The proliferation index was similar in patients and controls (1.9 ± 2.2 vs 1.7 ± 1.1). An increased number of T lymphocytes was observed in AAT-deficiency lungs than smoking-related cases (p ≤ 0.05). TGF-β1 expression in the alveolar wall was higher in patients with smoking-associated emphysema than in cases with AAT-deficiency emphysema (p ≤ 0.05). A positive correlation between TGF-βRII and AI was observed only in the control group (p ≤ 0.005, r2 = 0.8 ). A negative correlation was found between the TGF-β pathway (particularly TGF-βRII) and T lymphocytes infiltrate in smoking-related cases (p ≤ 0.05, r2 = 0.99)