Pacman
From Ece
Contents |
Team Pacman
Our goal is to create a game similar to Pacman using a external USB controller to control the movement of the character in the maze.
Team Members
Nashlie H. Sephus - Coordinator
Jonathan R. Bryant - Recorder
Taffa L. Porter - Checker
Ridzky (Angga) Riyadi - Checker
Phase 1
Introduction
The Pegasus board will run a game similar to Pacman, in which the user controls Pacman and tries to eat all the white dots while avoiding the opponents in the maze. The user will use a USB controller to control the movements of Pacman. A USB to PS/2 converter will be used to connect the controller to the Pegasus board.
Concept
The USB controller has a directional pad and six buttons. The controller also contains a start and select button. A USB to PS/2 converter will be connected between the USB controller and the board's PS/2 port. A PS/2 converter module will be included on the Pegasus board to decode the signals from the USB controller into signals that the board can understand. The signals from the controller will be used to control the movements of the Pacman character, and possible user interface functions. These functions may allow the user to pause or restart the level. The board will use a VGA module to display the entire maze and characters to a VGA monitor. Another module on the board will be used to control the Pacman opponents automatically. An additional module will keep up with the user's score and display it to the seven-segment displays and/or the LED's on the board.
Proposed Work
1. PS/2 Module - decodes the signals from the PS/2 port
2. VGA Module - takes in inputs from modules and displays to VGA monitor
3. Pacman Opponents Control Module - controls movements of opponents in maze and outputs to VGA module
4. Pacman Control Module - takes in input from PS/2 Decoder and controls Pacman movement
5. Maze Module - creates the borders and white dots to display on the monitor
6. Score Module - keeps the user's score and displays it to seven-segment displays and/or LED's
?
Required Parts
1. Spartan III development board
2. USB controller
3. USB to PS/2 converter
4. VGA monitor
Expected Deliverables
The user will use the joystick interface to play the Pacman game. The joystick will allow the users to control the movements of Pac-man through the different level(s) in the game. The objective of Pacman is to move in such a way as to consume all of the dots while avoiding four opponents intent on killing him.
Phase 2
Introduction
The Pegasus board will run a game similar to Pacman, in which the user controls Pacman and tries to eat all the white dots while avoiding the opponents in the maze. The user will use a USB controller to control the movements of Pacman. A USB to PS/2 converter will be used to connect the controller to the Pegasus board.
Concept
The USB controller has a directional pad and six buttons. The controller also contains a start and select button. A USB to PS/2 converter will be connected between the USB controller and the board's PS/2 port. A PS/2 converter module will be included on the Pegasus board to decode the signals from the USB controller into signals that the board can understand. The signals from the controller will be used to control the movements of the Pacman character, and possible user interface functions. These functions may allow the user to pause or restart the level. The board will use a VGA module to display the entire maze and characters to a VGA monitor. Another module on the board will be used to control the Pacman opponents automatically. An additional module will keep up with the user's score and display it to the seven-segment displays and/or the LED's on the board.
Proposed Work
1. PS/2 Module - decodes the signals from the PS/2 port
- - Input: Opcode from controller module.
- - Output: Next location signal to the Pac-man control module.
- 2. VGA Module - takes in inputs from modules and displays to VGA monitor
- - Input: Pac-man location from the Pac-man control module
- - Input(4): Location of Pac-man's opponents from the Pac-man opponent module (4 instances).
- - Input: The information regarding the level's structure from the maze module.
- - Output: Information to be passed back to the maze module to edit maze (when Pac-man consumes a dot).
- - Output: Information to be passed to the score module.
- - Output: Outputs signals to the VGA monitor for display.
3. Pacman Opponents Control Module - controls movements of opponents in maze and outputs to VGA module
- - Output(4): Location of Pac-man's opponents to the VGA module (4 instances).
4. Pacman Control Module - takes in input from PS/2 Decoder and controls Pacman movement
- - Input: Next movement of Pac-man from the PS/2 module.
- - Output: Pac-man location to the VGA module.
5. Maze Module - creates the borders and white dots to display on the monitor
- - Output: Location of the walls on the maze to the VGA module.
6. Score Module - keeps the user's score and displays it to seven-segment displays and/or LED's
- - Output: Score to the SSGs and/or LEDs.
Required Parts
1. Spartan III development board
- - Datasheet: [1]
- - Price: Already owned
2. Kensington/Gravis Gamepad Pro (USB controller)
- - Price: Already owned
3. USB to PS/2 converter
- - Price: Already owned
4. VGA monitor
- - Price: Available in lab
Expected Deliverables
The user will use the joystick interface to play the Pacman game. The joystick will allow the users to control the movements of Pac-man through the different level(s) in the game. The objective of Pacman is to move in such a way as to consume all of the dots while avoiding four opponents intent on killing him.
Phase 3
Review of Proposed Work
- 1. A module to decode signals from the PS/2 port. Assigned: Nashlie Sephus
- 2. A module to display to VGA monitor. Assigned: Collective
- 3. A module to control Pac-Man's opponents. Assigned: Ridzky Riyadi
- 4. A module to control Pac-Man. Assigned: Ridzky Riyadi
- 5. A module to create the walls and borders of the level. Assigned: Taffa Porter
- 6. A module to read the score and to keep track of the vitamins on screen. Assigned: Jonathan Bryant
Modules
1. ps2core
- - Input: ps2_data - data input from the PS/2 port
- - Input: ps2_clock - clock input from the PS/2 port
- - Output: hexcode(15:0) - hex code corresponding to the data from the PS/2 port
- - Description - outputs the raw keyboard code received on the PS/2 port.
2. ps2_decode
- - Input: ps2_raw(15:0) - raw PS/2 keyboard code
- - Output: opcode(2:0) - movement code of keyboard/controller
- - Description - combinational circuit which converts hexcode into a simpler opcode.
- - Input: clock - 50MHz clock
- - Input: opcode(2:0) - reads in opcode from PS/2 Decoder
- - Output: pacX(9:0) - Pacman's X coordinate on the maze
- - Output: pacY(9:0) - Pacman's Y coordinate on the maze
- - Output: vitamins(X:0) - each bit corresponds to a white dot in the maze. Bit goes high when Pacman passes white dot. Undetermined size of bus because unsure of number of white dots in maze.
- - Description - movement signals from PS/2 port controls the movement of Pacman around the maze.
4. draw_vga
- - Input: clock - 50MHz clock
- - Input: video_on - high when row/col are valid
- - Input: pacX(9:0) - Pacman's X coordinate
- - Input: pacY(9:0) - Pacman's Y coordinate
- - Input: oppX(9:0) - opponent's X coordinate (possibility of more opponents)
- - Input: oppY(9:0) - opponent's Y coordinate (possibility of more opponents)
- - Input: row(9:0) - currently drawn pixel's Y coordinate
- - Input: col(9:0) - currently drawn pixel's X coordinate
- - Input: vitamins(X:0) - reads in which white dots have been passed by Pacman
- - Output: red - red signal to VGA port
- - Output: green - green signal to VGA port
- - Output: blue - blue signal to VGA port
- - Description - determines the RGB values for the color of the pixel being drawn from the col/row inputs. If video_on is low, then pixel should be black. When the bit of a corresponding white dot goes high in the vitamins input, the module blacks out the dot.
- - Input: clock - 50MHz clock
- - Input: pacX(9:0) - current X coordinate of opponent
- - Input: pacY(9:0) - current Y coordinate of opponent
- - Output: oppX(9:0) - opponent's X coordinate on the maze
- - Output: oppY(9:0) - opponent's Y coordinate on the maze
- - Description - controls the movement of one of Pacman's opponents in the maze. If opponent reaches a wall, uses a random number generator to determine which direction to turn. If time permits, multiple opponents will be included in the game.
6. vga_sync
- - Input: clock - 50MHz clock
- - Output: h_sync - horizontal sync for VGA port
- - Output: v_sync - vertical sync for VGA port
- - Output: video_on - high when row/col are valid
- - Output: pixel_row(9:0) - value of currently drawn Y coordinate
- - Output: pixel_column(9:0) - value of currently drawn X coordinate
- - Description - computes pixel coordinates currently drawn and manages horizontal and vertical sync signals to VGA output. Also includes a video_on signal which should cause the RGB outputs to display black when low.
7. score
- - Input: clock - 50MHz clock
- - Input: vitamins(X:0) - corresponds to white dots in the maze
- - Output: score(7:0) - outputs user's current score
- - Description - increments the user's score whenever it detects a change, or bit high, in the vitamins bus.
8. binary2bcd
- - Input: score(7:0) - user's current binary score
- - Output: bcdscore(15:0)
- - Description - converts the binary score to bcd for the segdecode module
9. segdecode
- - Input: clk - 50MHz clock
- - Input: char3(3:0) - fourth seven-segment display digit
- - Input: char2(3:0) - third seven-segment display digit
- - Input: char1(3:0) - second seven-segment display digit
- - Input: char0(3:0) - first seven-segment display digit
- - Output: anode(3:0) - outputs to seven-segment displays
- - Output: sevenseg(7:0) - outputs to seven-segment displays
- - Description - displays user's score to the seven-segment displays.
Phase 4
Review of Work
The final game allows the user to use a joystick and a few buttons to control Pacman on a blue maze. The buttons allow the user to pause, resume, and restart the game. The maze contains three vitamins that Pacman must all eat in order to win the game. The maze also contains three opponents that will chase down and stop Pacman if they near him. The seven-segment displays on the Pegasus board keeps the score for the user throughout the game. If the user presses the reset button, Pacman and his opponents will return to their original locations, and all the eaten vitamins will return to the maze, which will also reset the user's score.
Last Minute Changes
1. Pacman control
- - The USB controller could not be used for the game because we were unable to interface the controller with the Pegasus board. We decided to instead take a keyboard and turn it into a joystick controller. In order to do this, we had to tear down the keyboard until only the necessary buttons remained
2. Pacman_movement module
- - The Pacman_movement module was not necessary because Pacman's movement could be implemented in the draw_vga module.
3. Opponent module
- - The opponent module was simplified and several instances of it was used to create the opponents.
Top Level Schematic




