Self-playing user that analyzes the ball's trajectory and moves the paddle to intercept the ball at the game of Pong.
The automated Pong game was developed on the NVIDIA Jetson TX2 Developer Kit, utilizing a screen mirroring technique to capture video feed from a phone running the Pong game downloaded from the Google Pay Store. This was achieved through the use of a screen mirroring software called 'scrcpy'. The self-playing user analyzes the trajectory of the incoming ball and moves the paddle to its predicted destination. This is accomplished by leveraging an ADB Client to simulate swipes on the screen, effectively controlling the paddle's movement.
The development of the game involved the utilization of the following libraries:
- scrcpy: To mirror the video feed of the phone via USB.
- ppadb: To simulate screen swipes for controlling the paddle.
- mss: For capturing screenshots of the phone mirror video feed, which were then processed for image analysis.
- cv2: For performing image processing tasks, including ball and paddle detection.
- threading: To enable parallel execution of swipe movements and image processing, without introducing delays.
Special thanks to Engineer Man for providing the idea that inspired this project, which focused on ball altitude-based paddle movement.
Below is a brief code snippet that highlights the project's implementation: