PacMan (Continued)
ACO PacMan Curriculum v2.0
Page 15 of 32
Scalable Game Design
Test out the options in the hill climb action.
What happens if the ghosts search in 8 directions?
Can PacMan escape?
Would it help to use fewer ghosts?
After you have run your game several times, choose whether your ghosts will search in 4 or 8
directions and decide on the number of ghosts in your game.
PacMan
ACO PacMan Curriculum v2.0
Page 16 of 32
Scalable Game Design
Student Handout:
Troubleshooting Guide for Diffusion and Hill Climbing –
Part 1: Tracking the Ghost One Step at a Time
To determine what is happening in your game, it is helpful to look at the agent attributes.
1.
On your world, click run until the ghosts move out of the box, and then click stop.
2.
Running the game briefly made PacMan’s scent diffuse across the world.
3.
Check PacMan’s s attribute by double clicking on him with the big arrow tool
.
4.
This window will appear:
5.
Make sure that you erased and redrew PacMan on the world and then SAVED the world.
6.
To see how PacMan’s scent (the value of S) has diffused, double click with the big arrow
tool anywhere on the ground or on a pellet.
7.
A window will appear that lists the S attribute value for that agent.
8.
Click around the world. Is S biggest close to PacMan and smaller far away from PacMan?
Before you do so,
MAKE SURE YOU TEMPORARILY REMOVE THE “once every
0.5” seconds” so you get more immediate feedback.
Check the attributes of the four boxes around the Ghost (up, down, left and right) and then single-
step the game using this button
so you can see if your Ghost is moving towards the agent with
the largest S value.
If the Ghost moves the wrong way or does not move, go back and check your rules in the Chase
PacMan method. Compare your rules with a friend’s rules.
•
Are the conditions correct?
•
Are the arrows in the move actions correct?
•
If you
used the hill climb action, check that you changed “value” in the hill climb action to S.
PacMan (Continued)
ACO PacMan Curriculum v2.0
Page 17 of 32
Scalable Game Design
•
Now put the “once every 0.5 seconds” back in so the ghosts don’t move too fast
9.
You can also try erasing all but one of the ghosts to see if it moves towards PacMan. This
helps because the Ghosts do not propagate the scent.
Critical thinking question: Why don’t you want the Ghosts to propagate the scent? What would
happen if they do?
Part2: Using a plot action to visualize S values:
We can use the plot action to visualize the value of S in the ground agents and the pellets. The
plot action will plot the values of S in a 3D surface above the world. The peak on the plot
represents the highest value of S in the world. What agent should be under the peak?
Make a new rule at the bottom of PacMan’s while-running method and add the plot action:
To make the plot action work
1.
This rule must be the last rule in PacMan’s while-running method!
2.
Enter “S” for the name of the agent attribute.
3.
Edit the row and column numbers so that values from the entire world are plotted.
Remember that the world size for PacMan is 16 rows and 21 columns. Computer
scientists always count from 0 to (Number – 1), in this case, rows 0 to 15 and columns 0
to 20. If you changed the default size, you must count from 0 to (New Size -1).
4.
Pick a color for the plot that will show up against your background.
5.
Change the elevation to 1.0.
6.
Make sure to choose “logarithmically” as the plot type. This option works better than
plotting linearly when some of the values are quite large and others are very close to zero.
7.
Make a test world that just has a layer of ground agents, a layer of pellets, PacMan and
one ghost.
PacMan (Continued)
ACO PacMan Curriculum v2.0
Page 18 of 32
Scalable Game Design
8.
Use the Rotate tool
to tilt your world so that it is nearly horizontal and you can see
the agents below the plot surface.
9.
Run the game and move PacMan around. The peak, which represents the high value, will
follow him. The ghost will move towards the high value (the peak).
10.
Add a couple of rows of wall agents. What happens to the shape of the plot when the
walls are added?
11.
The walls have no S value so the plot gets some wrinkles and valleys.
12.
Watch the ghost go around the walls following the increasing S values towards PacMan!
13.
Now run your PacMan world with the complete maze on it and see what happens to the
plot of the S values!
14.
You may find that reloading the world does not erase the plot surface. Reload your
browser window or click on the AgentCubes Online logo
in the upper right
corner of the AgentCubes Online window and click the edit button for your project again.
Figure 1. Plot of the S values with peak over PacMan.
Why is there a low spot over the ghost? Does the ghost have an S value?