Single-player version of the game called "Pong", implemented by using the LandTiger Emulator available on Keil uVision, that reproduce the behaviour of the classic table tennis-themed arcade game, originally released in 1972 by Atari.
For this project, start by implementing a single-player version of the game where the player must not let the ball fall below the paddle. The paddle can only move horizontally, and the player operates it through the potentiometer available in the LandTiger board.
The game field should be implemented vertically, i.e., the paddle will be in the bottom portion of the LCD display with red walls (5px thick) on the left, upper and right portion of the display for the ball to bounce on.
When the ball hits a wall, it should bounce with a reflection angle equal to the incident one. For instance, if a ball going downwards hits the left wall with an incident angle of 30°, then it will bounce downwards with the same 30° angle.
When the ball hits the paddle, the reflection angle must not always be equal to the incident one, for example, depending on what part of the paddle is hit by the ball. The choice on how fast the ball moves is left unconstrained.
The paddle should be 32px high from the bottom part of the screen and 10px thick, and the ball should be a 5x5px square.
Whenever the ball hits a wall or the paddle, the buzzer should emit a lower pitched note (when bouncing on the wall) and a higher pitched note (when bouncing on the paddle).
Every time the ball hits the paddle, the score is incremented by 5. If the score is greater than 100, whenever the paddle touches the ball, it is incremented by 10 points. The score must be printed on the left side of the screen, at mid high (160px from both the bottom and top part of the LCD). The score is saved in between games, and the new record (the maximum score since the board was last reset) is displayed in the top right corner. The initial record to beat is 100 points. Whenever the board is powered off or the RESET button is pressed, the score is reset as well. If the ball falls below the paddle, a message “You lose” should be displayed.
The user should start the game by pressing the button KEY1. When the game starts, the ball should be touching the right wall at mid high (160px from both the bottom and top part of the screen) and go downwards with an angle of 45°. To pause the game and later resume it, the user should press the button KEY2. In case of game over, to prepare a new game the player should press the INT0 button, followed by KEY1 to start it.
Having to use the emulator and not the physical board, all the non-ideality behaviors must be enabled and considered by your software and the RIT and Timers scaling switches can be enabled for debugging faster the project.
A template was used as a starting project, built during the course, ready to manage the interaction with the hardware components on the board. In particular, three new libraries have been created to manage the paddle, ball and GUI functionalities respectively. Furthermore, the handlers of the components' interrupts have been modified to manage the events foreseen by the requests given.
Looking at the sample.c
file, we find the main function, i.e. the starting point of the software, where all the hardware components and the GUI software component are initialazied.
The complete documentation of each library is found within the library itself. Here the linked list of the available documentation:
- GLCD - Graphical Liquid Crystal Display
- GUI - Graphical User Interface
- RIT - Repetitive Interrupt Timer
- ADC - Analog-to-Digital Converter
- Ball
- Button EXINT - Button External Interrupt
- Paddle
- Timer
This project has been developed by Andrea Deluca for the course of "Architetture dei sistemi di elaborazione", attended during the academic year 2021/22 at Politecnico di Torino, Master's Degree in Computer Engineering.