ECE287 Final Project for Dr. Jamieson's Fall 2021 Section B
Authors: Rob Lytton ('24) & Erik Johnson ('24)
Our project is a 2-player turn-based strategy game inplementing a PS2 keyboard as an input and a VGA display as output. The goal is to defeat the other player by attacking.
For our project, we wanted to replicate Rob's own personal game he had programmed in Java. The original game was a side-project with the inspration being to further explore the use of Java, and to create a lineup of characters akin to the Marvel Cinematic Universe.
The game is played on a grid of squares output on a VGA output. Each player is a character that has its own unique set of abilities and base stats. The game is played in a turn-based fashion. Each player takes their turn to move and attack. The turn ends when one player is done attacking, allowing the other player a chance to move and attack. The game ends when one player's health reaches 0. The winner is the player with the highest health value.
VGA Output is controlled via a driver module that uses an address translator to translate x and y coordinates to a pixel address in the VGA memory space. It also accepts a color value and writes it to the pixel. (Depending on the size of the color values and the sizes of pixels, the FPGA may run out of memory.) To avoid any issues with memory, the color values are 3 bits, therefore the VGA output is limited to 8 colors. (black, white, red, green, blue, yellow, cyan, and magenta)
The PS/2 Keyboard is connected to the FPGA via its onboard PS/2 port. The signals from the keyboard are sent as 8-bit values to the FPGA. Referencing the datasheet for the keyboard and the PS/2 Protocol, the values for the specific keys we need were hardcoded into the controller. The arrow keys are used to adjust the position of the characters and cycle through attacks. The enter key is used to confirm the attack and movement of the characters.
The Altera DE2-115 FPGA board has an onboard 16 character x 2-line liquid crystal display (LCD). The Hitachi HD44780 (in this instance) has specific controls for different functions and has 36 spaces for 5x8 dot characters. The LCD driver module accepts a 256 bit character string and writes it to the LCD.
Key | Description |
---|---|
Enter | Advance Screen/State |
Backspace | Reset Game |
W/S | Cycle through characters, attacks, aim, and y-axis movement |
A/D | Used to select x movement |
P | Show speed of character (character selection) or spread of attack |
H | Show health of character |
I | Show distance between p1 and p2 |
L | Show ammo left in an attack |
O | Show the dodge value of a player |
R | Show the range of an attack (attack selection) |
1 | Show Player 1 Position |
2 | Show Player 2 Position |
Each player selects their character. Players select be the same character, however it is not recommended as it could create confusion between who is who.
This game is far from perfect. The hardware limits of the Altera DE2-115 FPGA board and verilog in general makes it difficult to implement a fully-functional game with complex graphics even close to the java version. However, this doesn't mean that there aren't other ways to improve the game. A small list of things:
- Add more characters
- Add more attacks
- Improve graphics (centered grid, character models, etc.)
LCD Controller - Isaac Budde
VGA Controller - Sibo