Skip to content

Self playing user that analyzes the ball's trajectory and moves the paddle to intercept the ball at the game of Pong.

License

Notifications You must be signed in to change notification settings

CandeiasV2/AutoPong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Banner
PyPI - Python Version

Preview

GIF
Self-playing user that analyzes the ball's trajectory and moves the paddle to intercept the ball at the game of Pong.

How does it work

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.

Inspiration

Special thanks to Engineer Man for providing the idea that inspired this project, which focused on ball altitude-based paddle movement.

Code Snippet

Below is a brief code snippet that highlights the project's implementation:

Image

About

Self playing user that analyzes the ball's trajectory and moves the paddle to intercept the ball at the game of Pong.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages