Skip to content

In this "Rock Paper Scissors" game, your hand signals face off with a robot, combining street smarts with smart machines in an interactive showdown of wits and technology. Experience the thrill as your gestures are swiftly recognized by the Mediapipe AI model, delivering seamless gameplay and immersive engagement.

Notifications You must be signed in to change notification settings

chaitanya566/Rock-Paper-Scissors

Repository files navigation

Real-Time Hand Gesture-Based Rock Paper Scissors Game

This project presents a captivating rendition of the classic game "Rock Paper Scissors," employing hand gesture recognition through the Mediapipe AI model. Users can engage in dynamic gameplay against the computer, with seamless navigation facilitated by an intuitive user interface.

Installation Instructions

To get started with the project, follow these steps:

  1. Clone the repository to your local machine.

  2. Navigate to the root folder of the project.

  3. Install the required dependencies using the following command:

        pip install -r requirements.txt
  • Optional:
    1. If you want to store the streak in a database, create a MySQL database using the database.sql file located in the database folder. You can use the following command in the MySQL command line interface:

      source database\db.sql
    2. After creating the database, modify the values related to the database connection in the main.py file. Update the mydb variable with your database credentials.

How to Start

  1. Navigate to the start folder located inside the root folder.
  2. Run index.html located in the start folder to initiate the experience.
  3. If you haven't created an account yet, run signup.py located in the signup folder to create an account. Alternatively, if you already have an account, proceed to the next step.
  4. If you have an account, run login.py located in the login folder to log in to your account.
  • Alternatively, you can skip the entire process by simply running index.html in the root folder. This allows you to play the game directly with the computer without using any additional features.

Output Images

Sign-Up Page Login Page
Gaussian Blur test
Main Page Data stored in a Database
Gaussian Blur test

Features

  • Gesture Recognition: Utilizes Mediapipe's AI model to detect hand gestures, enabling intuitive gameplay.

  • User Authentication: Users can log in, sign up, or directly start playing without authentication.

  • Automatic Page Navigation: Upon launching index.html, users are seamlessly directed to their desired pages.

  • Database Integration: Stores user scores, including streak, in a MySQL database, ensuring persistence and scalability.

  • Cookie-Based Session Management: Account information is transmitted across pages using browser cookies.

File Structure Explanation

  • database: Contains the database file database.sql for storing user scores.

  • images: Stores PNG images used to display the computer's decisions (rock, paper, etc.).

  • login: Holds files related to the login page, including index.html, styles.css, and script.js.

  • menu_page: Contains files for the menu page, including index.html, styles.css, and script.js.

  • signup: Includes files for the signup page, including index.html, styles.css, and script.js.

  • start: Consists of files for the start page, including index.html, styles.css, and script.js.

  • main.py: Python script responsible for backend logic and database interaction.

  • index.html: HTML file for the root page of the project.

Game Play Images

User Win Image System Win image
Gaussian Blur test

Advantages

  • Immersive Experience: The project offers an immersive gameplay experience through gesture-based interaction.

  • Efficiency: Leveraging asynchronous I/O and real-time communication enhances performance and responsiveness.

  • Scalability: With database integration, the project can scale effectively to accommodate a growing user base.

  • Accessibility: Users can seamlessly navigate through the interface, fostering an inclusive and enjoyable experience.

Libraries Used

  • Mediapipe: Facilitates hand tracking and gesture recognition. Detects hand gestures from the user's camera for intuitive interaction in the game Using a machine learning model. Website

  • Asyncio: For asynchronous I/O, enabling efficient handling of concurrent operations. Website

  • Websockets: Facilitates real-time communication between client and server. Website

  • MySQL Connector: Connects Python to MySQL database for data storage and retrieval. Website

  • JSON: Utilized for data interchange between client and server. Website

About

In this "Rock Paper Scissors" game, your hand signals face off with a robot, combining street smarts with smart machines in an interactive showdown of wits and technology. Experience the thrill as your gestures are swiftly recognized by the Mediapipe AI model, delivering seamless gameplay and immersive engagement.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published