You probably don't need any instructions concerning the game play but here they are anyway. Your objective is to eat as many pills as you can and to avoid being touched by the wandering ghosts. If you have collected all the 101 green points you win. If you can eat the blue power pills the ghosts you can ‚ for a limited time ‚ attack the ghosts. The ghosts will try to escape from you.
This is a pretty challenging and quite complete version of the pacman game including smart ghosts, score keeping, power pills, and multiple lives. If you think the game is still too simple you can make the ghosts even more aggressive to the point where the game probably becomes impossible to play.
Besides being fun to play this main purpose of this game is to show you how to make your own game. This game will show you:
The basic idea behind the pacman is quite simple. The pacman is user controlled. Pressing a cursor key will make the pacman change its orientation. The pacman will try to move in the direction that it is facing but cannot move through walls. If the pacman finds a point in the direction that it is moving it will eat the point and your score will go up. What makes the behavior of the pacman a bit more complex than you may have expected is that the pacman will not only change it's look after eating a power pill but will also behave slightly different. To find out more about how the pacman works start by reading the documentation built in to the pacman.
The ghosts need to be able to track the pacman. Tracking is at the core of most arcade style games. The good person tracks the evil one ‚ or is it maybe the other way around ‚ missiles track space ships, hungry people track food, etc. Tracking deserves some special attention. A large number of projects got created using the tracking approach described below got built as part of the 1998 Artificial Intelligence course at the University of Colorado. We may publish some additional projects if people are interested in getting more examples.
The tracking approach described here is so powerful that in most cases, when used as part of game for instance, tracking needs to be slowed down to keep the game enjoyable. Otherwise if the ghosts would race as fast as they can towards the pacman the game would be immediately over and not much fun.
A simple approach would be to have the ghost compare its position with the position of the pacman and move towards that position. This works well if there are no obstacles between that ghost and the pacman. However, in games such as the pacman there are obstacles such as walls that would be hard for the ghost to navigate around. For instance in the Figure below the ghost is very close to the pacman except there is a wall between the pacman and the ghost. The ghost can only move left or right at the moment. Moving either way will move the ghost to a position further away from the pacman and not closer.
How can we make the ghosts smarter? The approach described here, called hill climbing, will take a little explaining but at the same time is so general that it can be used for a wide variety of games and simulations. The basic idea is to think of the game world as a 3 dimensional world in which the location of the object to be tracked, in our case the pacman, is the top of a hill. A ghost will climb the hill by comparing its current elevation with the elevations of 4 neighboring places around it. The ghost will select the location with the highest elevation. Step by step it will climb to the top of the hill and eventually reach the pacman. The figure below is the 3d version of the figure above illustrating the increasing elevation towards the pacman.
How do we create these hills and take the walls of the maze into account? First we give the pacman an attribute called "P" (short for pacman) with a value of a 1000 to represent the hill peek value. Then we use a technique called diffusion to spread that value around in the simulation world. This is simple. Each background agent just needs to compute the average value of P of its 4 neighbors around it. In the Visual AgenTalk formula language this is expressed as:
Background Agent: P = 0.25 * (p[up]+p[down]+p[left]+p[right])
Now all the ghosts need to do is to follow the increasing value of P towards the pacman. This works well for cases in which there are no obstacle such as walls between the pacman and a ghost. We need to define what to do with walls in terms of diffusion. This is not necessarily obvious but surprisingly simple. Obstacles should just set their value of P to 0
Wall agent: P = 0
Walls will clamp down any kind of hill abruptly. Our diffusion value will now flow around walls attracting ghosts like similarly to the way the scent of a fresh backed pie diffuses around in a house. In the Figure below the ghost is able to follow the pacman using the shortest route considering it cannot walk through the walls.

This approach combining diffusion with hill climbing will still work with complex mazes and will even work with multiple pacman and any number of ghosts.
Make you own level. Simply create a new worksheet and draw your own game world. Save the worksheet and share it with your friends.
For this part you need to have QuickTime Virtual Reality (QTVR) installed. Have a close look at the part of the worksheet that the ghost needs to sneak around. The incline at the location around the ghost is hard to see with the naked eye but no problem for the ghost to see.