Rock Paper Scissors : Python Game Development Course | Arunnachalam Shanmugaraajan | Skillshare
Search

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Rock Paper Scissors : Python Game Development Course

teacher avatar Arunnachalam Shanmugaraajan

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction To Course

      0:43

    • 2.

      Class 1 : Import Packages

      2:14

    • 3.

      Class 2 : Read Images Using OpenCV

      5:20

    • 4.

      Class 3 : Create Game

      8:42

    • 5.

      Class 4 : Create Game Result

      4:50

    • 6.

      Class 5 : Rock Paper Scissors Game

      12:48

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

7

Students

--

Project

About This Class

Rock Paper Scissors Game Development with Python

Welcome to the Rock Paper Scissors Python Game Development Course! This exciting course is designed to teach you how to build an interactive and fun Rock Paper Scissors game using Python, computer vision libraries like OpenCV, and the powerful CVZone library.

Whether you’re a beginner interested in learning computer vision or an experienced coder looking to create engaging projects, this course will guide you step-by-step in building a game that detects hand gestures in real-time using your webcam.

What You'll Learn:

1. Introduction to Computer Vision

  • Understand the basics of computer vision and how it’s used to process and analyze images.
  • Learn about OpenCV, a leading library for real-time computer vision applications.

2. Setting Up the Development Environment

  • Install Python, OpenCV, and CVZone.
  • Configure your webcam for real-time video input.

3. Hand Gesture Recognition

  • Use CVZone’s HandTrackingModule to detect and track hands in real-time.
  • Identify and analyze hand gestures for "Rock," "Paper," and "Scissors" using landmarks.

4. Game Logic Implementation

  • Implement the core game logic to determine the winner based on player gestures and randomly generated computer choices.
  • Learn to manage scorekeeping and display real-time results on the screen.

5. Real-Time Display with OpenCV

  • Use OpenCV to create a user-friendly graphical interface.
  • Overlay text, shapes, and images on the video feed to enhance the game experience.

6. Project Testing and Optimization

  • Test your game for accuracy in gesture detection and responsiveness.
  • Optimize performance for smoother gameplay.

7. Advanced Features.

  • Add countdown timers, sound effects, or animations to make the game more engaging.
  • Explore multiplayer modes or integrate with external devices.

Why Take This Course?

  • Hands-On Learning: Build a complete project that combines Python programming and computer vision in a fun and interactive way.
  • Industry-Relevant Skills: Gain experience in real-time video processing and gesture recognition, valuable for fields like robotics, gaming, and augmented reality.
  • Beginner-Friendly: Designed for learners with basic Python knowledge, this course provides step-by-step instructions and explanations.
  • Creative Output: Walk away with a fully functional game that you can showcase in your portfolio or play with friends!

Who Should Take This Course?

  • Beginners: Those with basic Python knowledge who want to explore computer vision and game development.
  • Game Developers: Anyone interested in learning how to incorporate gesture-based interactions into their games.
  • Computer Vision Enthusiasts: Students or professionals eager to practice real-time hand gesture recognition.
  • Hobbyists and Creators: Tech enthusiasts looking for a fun project to build and share.

Meet Your Teacher

Hi I am Arunnachalam R S From India. I am a computer science student and I have choosen cybersecurity as my profession. I am youtube content Creater and i teach people about the latest technology and new softwares and I am big cricket fan of MS Dhoni. I can help people with my experienced knowledge about the technology. I am choosing Skillshare to show my passion towards technology and Science..

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction To Course: Come everyone to the complete course of rock pepper SIR using OpenCV and then Python. So this course consists of three different modules. In the first model, we are going to discuss about how to import the package as required for our rock peperR game. In the second module, we are going to discuss about how to create the game using OpenCV and then Python. The third model, we are going to discuss about how to declare the results for our rock pepper SisserGame and also we are going to discuss about the output for our game. So this course is very, very useful for the Python game developers who are trying to create rock pepper sisser using OpenCV and Python. So let's see on the course. 2. Class 1 : Import Packages: Welcome everyone to the first class. In today's class, we are going to discuss about our project that is rock paper scissor, using Python and OpenCV. So the resources will be provided in the description or resource section. So you need to open the folder with the VS code, or you can use any other IDE for your project. So I'm going to use the VS code for my project. So after that, you need to create a new file in the VS code. For that, you have to select the file Opson and then you have to type the file name. I'm going to type game dot py. So that's the format. So in today's class, we are going to discuss about how to import the packages that are required for our rock peppers IR project. So first, we are going to import the random package. So in the second, we are going to import the CV two package. So you have to type Import CV two. So CV two is nothing but open CV for reading the web camera. And then we are going to import a third package that is CV Zone for our rock pepper scissor game. So after that, we are going to import a fourth package that is CV zone. So CV zone dot hand tracking module. We are going to track our hand in the open ZB. For that, you have to type from CVzone dot hand tracking module. So in that, we are going to import a sub package, that is hand detector. So far finding the hands. From the hand, we can identify the fingers. So fingers are very, very important for rock pepper scissor. Last, we are imported the time package. So these five package must be installed for our project that is rock paper scissor using OpenCV and then Python. So CV two is nothing but reading our web camera, and then CV Zone is for tracking our hand. And then we are imported the hand detector module, and then we are imported that time. So for sewing the time for the game, we are imported the time package. 3. Class 2 : Read Images Using OpenCV: Welcome, everyone. In today's class, we are going to discuss about how to capture the video using the OpenCV. That is CV two package. So we are going to discuss about how to capture the video. For capturing the video, you need to create a variable. So for that, you need to type cap equal to CV two dot, Video capture. So that's the core. You need to type Video capture. And then you have to type the bracket. Inside the bracket, you need to type zero. Zero is father web camera. So after that, we need to create the height width for that Kyoto type cap dot set of 3643 comma 640. And then oto type cap dot set of four comma, 480. So these are the height twidth for our camera. And then we are using the variable deductor equal to hand detector. So we are just imported the module in the first class, and then you have to type maximum hand will be one. So we are going to use only one hand for our raw paperR game. So that's why the maximum hand is one. So only one player can play with the AI. So after that, we need to set the time to zero for the starting position. For that Tyoto type, timer equal to zero. And then you to type. So before starting the game, the result will be false. So you need to type state result equal to false. After that, you need to create a variable for starting. So start game equal to false. So before starting our game, everything will be false. So after that, we need to set score for our player. So before starting the game, both players are zero. So that's why you need to type zero comma zero, score equal to zero comma zero. And then you have to type the wild condition while true, these values are true, then we are going to execute the inner commands. So first, you have to create the background image for your game. So this background image will be provided in the description. You have to type image background decter C two dot IMRaD. So we are going to read the image. So you have to type the image name that is resources. So resources is the folder. Inside the folder, background image will be present. So big dot PNG is our background image. So after that, we are going to type SSS, command, image, equal to cat dot read off. So you can see the VS code is very, very, very useful for us. So before typing the code, you can see automatically suggested by the VS code. So that's the use of VS code. So after that, I'm going to type image scale. We are going to create scaling for our background image. So CV two dart resize. We are going to resize image background. Zero comma zero, com None. Ca 0.8. 750.875. So 87 percentage, we are just resizing the image. So after that, you need to type image, scale, equal to image, scale of comet 40 8480. So that's it, guys. In today's class, we are discussed about how to capture the video using the OpenCV. So we just created the web camera, and then we are using the hand detector for finding the hands, and then we are setting the game rules like state results, state game, and then score of the players. After that, we are using the background image for the game. In the next class, we are going to discuss about how to create the game for our project. 4. Class 3 : Create Game: Me, everyone, in today's class, we are going to create the game. So the game will be rock paper scissor. First, you need to tie hands. So that's the hand and then image equal to detector, so detecting the hands, dot, find hand, find hands. So that's the submodule in the image scale. So image scan is nothing but we are just resizing our image. So after that, we are going to create the I. So I start game. So inside that, you need to type the code for the I start result is false. So before starting the game. So that's why we need to type I timer equal to timer time off. We just created the time for our game minus initial time. So after that, you need to type the text for showing the time in our background image, for that you have to type CV to dot, put text for writing the text. You need to type, put text of IMG background. So we are going to type the text in our background image. So you have to use the string It of we are going to convert the integer to string because the time is an integer. For that only we are just converting the string and then into time or comma, six not five, 435, come, CV two dark. You need to type the font. So I'm going to use the font. He plain plain text. Come on. Six, 255, come, 0255. So that's the color. C four, that's the thickness. So after that, I'm going to type the timer. If time are greater than three, the game will be started. So we are going to count from one, two, three. If the time is three, then the game will be started. So you have to type state result equal tive true. So we are just starting our game. And then timer equal to zero. Every position, the timer will be changed. If hands player equal to. None. Hands, equal to hands of zero. So we don't need hand for our game. We just need fingers. So for that you have to type fingers so finger is very, very important for rock peppers is a game. So fingers equal to detector, dart, find fingers. So you are to type, detector dart fingers up hand. So inside the hand, our fingers will be deducted. In the hands, our fingers will be deducted. After that, you are to type if fingers eculte equal te, zero, zero, comma zero, comma zero, comma zero. So five zeros, five zeros are nothing but five fingers. And then player move, equal t one. Fingers, equalte equal te array, one comma, one comma, one, coma one, coma one, five, one. So five fingers. Player move, equal t. Two. I fingers to type if fingers equal to equal to zero comma one comma one comma, zero comma zero, zero comma zero. Y to type five times. So five fingers, Yo to type five values. And then player move equal to three. So after that, you have to type the random number equal to. Integer random integer will be us, so random integer so that's the rand int one Camma three. And then we are going to create the image for the AI D to type Image AI equal t, CV two dot IM read off. So we are going to read the image from the resource folder. So inside the results folder, the image will be present. You have to type random number dot PNG. C CV two dot IMRad unchanged. After that, you have to type IMG, background, equal to, CV Zone dt, you have to type overlay PNG. We are just overlaying the image. In the background, the AI image will be over lay position. IMB G, IMG, AI. So these two images will be overlay. So that's it, guys. In today's class, we have discussed about how to create the game for finding the hands, fingers. So first, we are starting the game. So you can see the if condition, if the state result is false, we just created the time, and then we are using the CV to put text for typing the text in our background image. After that, if the time is greater than three, then the game will be start. So after that, we are going to use the fingers deduction. So we are going to deduct the fingers from the hand zero is nothing but all fingers are closed. One is nothing but all fingers are open, zero, come, zero, come, five zeros are nothing, but all the five fingers are closed. One, one, one coma, five ones are nothing but five fingers are open. So if the five fingers are open, then it is considered as paper. If five fingers are closed, it is considered as so if two fingers are open, it is considered as siR. So that's why the third code shows that zero comma one comma one comma zero, comma zero. That is nothing but two fingers are open. That is the CSR. So after that, we are created the random number for this AI. So AI will saw any random values in the rock pepper Csr game. So that's why we are using the random integer. So in the resources, you can see the image is like one, two, three. So AI will choose any one of the image for the rock pepper Cier. One is father rock, two is father scissor, three is father paper. So AA will choose any one of the inmates, then the game will be started against the player. 5. Class 4 : Create Game Result: Come, everyone. In today's class, we are going to discuss about how to create result for our game. So we are going to discuss that I player more equality equal to one, and random number, that is the AI equality equal to three. Slash, back slash, and then player move. You have to type player move, equal to equal to two, and random number equal to equal to one. So you have to type random number equal to equal to one, backslash, player move, equal to equal to three, and random number equal equal to two. Then score for the player is incremented. So you are to t score of one plus equal to one. So first index for the player, zero index is for the AI. So we are going to create the score for the AI. If the player move equal to equal to three and random number, that's the AI equal t one or backslash. You have to type player move, equal to equal one and random number. Equal to equal to two, slash player move equal to equal t two, and random number equal to equal t three. Then the scare of the AI will be incremented. So you have to type square of zeroth index. That's for the AI square plus equal to one. In the resources, you can see the images like one dot PNG, two dot PNG, and then three dot PNG. One dot PNG is father RC, two dot PNG is father paper, three dot PNG is father CSR. So if the player move is one, and then random number is three, three is father CSR. One is father RC. Then the player is winner. And player move equality equal to two, two is father paper. And then random number is one. So one is the rock. Then the player is the winner. If the player move if the player moves three, so three is for Cisar. And then random number, that is a a value two, two is father paper. So Car cuts the paper, then the player is the winner. So that's how we can increment the score of the player. For the A score, you can see the player number three. So three is father scissor. And then random number that is A one. So one is for Rock Rock is the winner, then A is the winner. And then you can see player move equal to one, one is father rock. And then random number equal to two. Two is the paper. So paper is the winner. Then A is the winner. And then player move cult to two is for paper. And then random number equal to three. So three is for scissor. Then A is the winner. So that's how we can increment the AI score. So that's it, guys. In today's class, we are discussed about how to create a result for our rock pepper Sir game. In the next class, we are going to complete our project. 6. Class 5 : Rock Paper Scissors Game: Number one. In today's class, we are going to complete our rock paper Scissor project. So first, you have to type the image background for our raw paper cssor. So we are going to adjust our image background. For that, you need to type the values inside the bracket. You have to type 234, 654 ama, 795 1195 equal to image scale. After that, you need to type I start result. So inside that, you have to type. Again, the inside that, you have to type the code, image background, equal to CV zone dot, overlay PNG. Olay PNG is nothing but top of the one image. Image background comma, image AI. For sewing the result, we need to overlay the images. So after that, you need to put text for the result. So you have to type Cv to dot, put text of IMG background, comma, string of score. We are going to write the score in the background image. You have to type zero comma. 410 Kama, 215. You have to type the text font font, I'm going to use the plain font, youu to select plain. And then you ought to type the values for coma. You ought to type the color 255, 255, C 255. So that's the color, and then you have to type the thickness. You ought to type C six, so six is the thickness. You are to type CV two dot. Put text of IMG, background, Cam string of score one. So first square is father, AI. So second score is father, player, zero is father AI, one is father player. You have to type the values 11, two, coma 215. Again, you have to type the font. And then you have to type the values, four command and then you have to type the color 255, come 255, come, 255. Come on, six. That's the thickness. So first is father AI. So were created in the previous class. Score of zero is for the AI. And then second is father player. So score of one is father player. So after that, we are going to sew the output, so I have to type C two dt I am so off. Inside that, you have to type your own words. BG that's the background, and then background image. We are going to sew the output of background image. And then you have to type K equal to CV two dt, weight key. We are going to create the weight key for the game of one. So after that, you need to type if K equal to equal to see how to type OR D of. So if you type yes, then the game will be started. So that's why you need to type. Start game equal to true. Game will be started. If you type, then the game will be started. And then you have to initialize the time for the game. And then you have to type the result, state result equaltive falls. So after that, we need to create the exit key for that you have to type I K equality equal ORD of Q. If you type Q, then the game will be exit. So you have to type break. So game will be exited when you type Q. And then we are going to release the windows. So we are going to release everything. And then we are going to destroy all the windows. So if you don't type the code, then your output will not be terminated. So that's why you need to type these codes. So is for starting the game, Q is for finishing the game. So after that, we are going to discuss about how to find the result for our game. For that, you need to type these codes for the result, whether the player wins or the AA wins, we need to declare the result. You need to type the I condition in the result. I score of zero, that is nothing but AI score is greater than the player score. That is one, then the AI wins. You need to print AI wins. So after that, we need to type ALIF score of one. That is, if the player's score is greater than the AA score, then the player wins. You have to type print of player wins. So we need to type the ls condition for Ti. If two scores are same, we need's condition for sewing the ti. So you need to type print of tie So that's it, guys. We are just completed our rock paper SisRGame using CV Zone, OpenCV, and then Python. So in the first class, we are discussed about the packages. So in the second class, we are discussed about how to capture the video using the CVT and how to create the hands deduction. So we are just using only one player for the rock pepper ScisRGame. And then we are just initializing all the results after that, we just create as a score for the player and then AI. And then we created the background images for our game. And then we are just resizing the game. Background. So in the third class, we are just discuss about how to deduct the hands in the open CV. And also, we are just created the time for our game. If the time is three, then the game is started. After that, we just discussed about how to deduct the hands and also we are just deducted the fingers from the hand. So after that, we are just created the code for rock pepper CSR. So zero is nothing but all the fingers are closed. One is nothing but all the fingers are open. So first is for the rock, and then second is for the paper, and then third is for the CSR. So after that, we have created the AI. So AA will be the random numbers using the images in the resources. So in the resources, you can see one, two, three, so AA will choose any one of the images for our rock paper user game. So based on that, we can predict the score. So first is for the player. So if AA chooses the wrong, then the player's score is incremented. So second is for the AA if the player chooses wrong, then the AA score will be incremented. After that, we are just printing the output of the AA and then player score. If you type, then the game will be started. If you type Q, then the game will be entered. So after that, we are just releasing all the windows, and then we are just declaring the result, whether the AA wins or player wins or tie match. So we are going to run our code so you have to open the terminal and then run the code, or you can just run the code from the VS code. So you have to wait for the output. So after that, you can see the output is generated. You can see the webcam is opened. So in that our game is successfully created using our background, you can see my hand is deducted using the CV zone. So inside the hand, we can find the fingers. So by using the fingers, we can predict the rock pepper and scissor. So five is for the paper, two is for the scissor, and then zero is for. So then the game will be started, you have to select any one of the values, whether it is rock, paper or scissor, you can see the AI wins because it chooses rock. So that's why AI wins. You can see the score is incremented. Paper. Then the game will be Ti. And then I'm going to choose scissor. You can see AA wins. I'm going to select paper. You can see my score is incremented. I'm the winner and also same paper. I'm winning again. I'm going to select rock so you can see, again, I'm the winner, same rock. A chooses rock. I'm going to choose scissor. A chooses the same. I'm going to choose scissor, H chooses the same. I'm going to choose paper. So A wins three, and then scissor, I'm the winner, and then scissor I'm the winner again. So I'm going to select Q to quick the game. So you can see the output, the player wins. So for our project, I'm going to give an assignment. So you can see in the game, we can play many rounds, but I need only five rounds. So you have to type the code in the assignment section. So that's the assignment for you. So that's it. We have successfully completed our rock pepper CSR game using CV zone, OpenCV, and then Python. Hope you learn something from this course. If you learn something from this course, please put positive review in the command section. Hope I can see you in the upcoming courses teached by me. Thank you.