Beijing-Dublin International College
COMP2011J - Object Oriented Programming
Individual Assignment: PAC-MAN
Assignment Details
Game Description
PAC-MAN is a classic arcade game, where a pac-man moves through a maze consuming the dots and avoiding the coloured ghosts. The player has a limited number of lives and loses one whenever a ghost catches them. The player gets points for eating the dots, power pellets (these give special powers to pac-man) and ghosts. The player can get another life every time their score goes over a multiple of 10,000.
Movement
Pac-man will always move in the direction that he is pointed. He cannot speed up or slow down and when the game starts, he will begin moving. In the maze pac-man can only turn a direction when the way is open, he cannot turn towards a wall. The only buttons used in this game are the directional arrows.
Gameplay Elements
In the game there is the following: A maze that pac man must move through Dots that pac-man must eat Four power pellets, that make pacman invincible for a short amount of time during which he can eat the ghosts (they come back to life a short time later) Four Ghosts that come out and chase after pac-man Fruit that randomly appears for a short amount of time and can be eaten for extra points
Points/Scoring
Pacman gets points for eating each of the following Dots - 10 points each Power pellets - 50 points each Fruit - 500 points each Ghosts - 200 points for the first, 400 points for the second, 800 points for the third and 1600 points for the fourth (count is reset each time you eat a power pellet)
Ghosts
The four ghosts are named Blinky, Pinky, Inky and Clyde and are coloured Red, Pink, Cyan and Orange. The ghosts differ in speed slightly and are listed previously from the slowest to the fastest. In the first level, only one ghost is released and chases after the player, with each increase in level another ghost is added until all of the ghosts are chasing player. When multiple ghosts are released, there should be a constant interval of time between the release of each ghost (15 to 30 seconds). This delay should also be applied to the return of the ghosts after the player has eaten them. When ghosts are returning, they should appear at the original spawning location. When the player eats a power pellet the ghosts should all change colour to blue. At this time there should also be a change in behaviour, the ghosts should try and run away from the player instead of chasing it.
Levels
This game is based on the completion of levels, whenever a level is complete the player is returned to the beginning to play again. Though some details such as the number of ghosts to be released, their movement speed and the delay between their release may be changed. A level is complete when all of the dots and power pellets are eaten.
Difficulty
As mentioned above, some variables should change to increase difficulty. An example of the way that these changes could be made is given in Table 1. The idea behind this is that the speed of the ghosts is increased at a relatively slow pace (increasing about 5% each level) while at the same time there are more ghosts and a shorter delay between the release of ghosts from the spawn point.
Table 1: Example of possible changes to game variables to increase difficulty Level Number of Ghosts Delay Between Ghosts Movement Speedup 1 1 20 1.00 2 2 20 1.05 3 3 20 1.10 4 4 20 1.15 5 4 18 1.20 6 4 16 1.25 7 4 14 1.30 8 4 12 1.35 9 4 10 1.40 10 4 8 1.45 11 4 6 1.50 12 4 5 1.55 13 4 5 1.60 14 4 5 1.60
Level Layout
The version of the game you are creating will allow for the layout of the maze to be defined in a text file. This fill can then be loaded in the game and used to play. The different parts of the maze should be shown using the following characters
W represents that this location is a wall the the player and ghosts may not pass through P represents the location where pac-man spawns at the beginning of the level or when the player dies . represents that there is a dot in this location
- represents that there is a power pellet at this location F represents a location where fruit will occasionally appear here (there is only ever one location on a map) G represents the location where ghosts spawn here at the beginning and after they die (it is usually surrounded by empty spaces)
- represents an empty square that ghosts may pass through, but the player may not Each maze design will be stored as a single text file containing the whole maze. The text file is laid out like a two dimensional grid where each line is the next part of the maze. An example of the format is given in Figure 1.
Figure 1: Example of a level design for the game
1 WWWWWWWWWWWWWWWW
2 W .............. W
3 W*WW. WWWW . WWWW .W
4 W.WW. WWWW . WWWW .W
5 W .............. W
6 WWWWWWWWWWWWWW .W
7 W .............. W
8 W. WWWWW . WWWWWW .W
9 W .............. W
10 W.WW -WW. WWWWWW .W
11 W.W-G-W.W ..*... W
12 W. WWWWW .W. WWWW .W
13 W...F .......... W
14 W... WWWW .W.W.W.W
15 WWW ...... W.W.W.W
16 W... WWWW .W.W.W*W
17 W*W.W .... W.W.W.W
18 W...W.WW.W.W.W.W
19 WWW.W.WW.W.W.W.W
20 W ........ W.W.W.W
21 W*W ...... W.W.W.W
22 W.W. WWWWWW .W.W.W
23 W ...... P ....... W
24 WWWWWWWWWWWWWWWW
The maximum width of any level will 20 and the maximum height (number of lines) will be 24. I will be testing with files that I have created myself, so your code must be able to generate levels based on them.
Example
To get an example of the how the pac-man game plays, go to the http://pacman.platzh1rsch.ch/ and play the game there. Note that only the motion of the characters is required, animation is optional.
Assessment
This section gives a breakdown of the approximate marking criteria for the assignment. The final marking scheme may vary slightly but will be relatively similar. Your submission should contain the following files A zip file containing the entire project code and any other files required for the code to be executed (exported from IntelliJ IDEA or Eclipse) A report explaining what you have achieved for each of the criteria in the marking scheme (estimate fail, pass or excellent) based on the template provided A short video (less than 3 min) showing a screen recording of the game with your explanation voiced over it
Each file should be named only with your UCD student number and the correct file extension (e.g. 1234567.zip, 1234567.pdf, and 1234567.mp4).
Zip File
This must contain all of the code required to execute the project. If I am unable to execute your code, it will reduce your grade. If there are any requirements to setup and execute your code you should include these in the zip file.
I will be testing the code using IntelliJ IDEA (unless you specifically mention that I should use Eclipse). I would recommend that you create the project using the Intellij IDEA IDE and export the entire project to a zip file for submission.
Assignment Report
This document should be in PDF format and contain your name and student number as well as a table explaining what you estimate of how your project will be graded against the marking criteria in the next section. For each of the criteria mark an X under Fail, Pass, or Excellent and optionally include some text to explain why you believe you have merited that level.
The comment is completely optional, however a part of your grade will be based on how accurately you have described your performance compared to how I have graded your project. As such you have an opportunity to convince me that your interpretation is correct or at the very least not score your appraisal lower when there is a difference.
You may also include details in this report of any additional functionality that you have added that you believe should be worth extra credit.
Video
The video should be between 1 and 3 minutes long and show a screen recording you the following steps: You executing your code in the IDE and the game starting Navigating the menu Game play showing the working game
You should speak over and describe these steps (you do not need to speak all of the time). You do not need to include a video of yourself (but you can if you want to). The video must be in mp4 format and must be less than 100 mb.
Marking Scheme The marking scheme shown in table 2 is subject to change. This means that it may be changed at any time without notice if I feel some parts were too easy or too hard and additional criteria may be added. The final grade from this section will be based on a weighted sum of the individual parts. The weights for each part will be based on the difficulty and importance. For example, design and cohesion is very important and will likely be weighted much higher than any other component. The text explaining each can be used as a guide to the amount of work expected for the different parts of the assignment. You should also note that it is required that your project is programmed using one of the two libraries available on moodle (https://csmoodle.ucd.ie/moodle/mod/folder/view.php?id=74336 or https://csmoodle. ucd.ie/moodle/mod/folder/view.php?id=74337). If you do not use one of these libraries, then you will get 0 for your assignment grade.