Code Monkey home page Code Monkey logo

flappyblink's Introduction

FlapPyBlink

This project has been created for a class in our computer science study called AI in robotics.

This is an extension of the base game called FlapPyBird. This extension has a blink detection implemented, which works as a control for the bird and basically simulates a space bar press when it notices a blink. The blink detection doesn't care about how many persons are in the image, so multiple persons can play this in theory.

Requirements and customization

You will need on top of the base game requirements CV2 installed on your machine, so that the face recognition can work. The Haarcascade files are from OpenCV and uses for face recognition. If you want to use your custom files, you can replace the files under haarcascades.

Select the correct camera by its ID

My camera ID was 2, yours is most likely 0. If your camera doesn't work simply replace the CAMERA_ID variable at the very beginning of flappy.py in line 14 to the ID you got. If you don't know it, just try by incrementing beginning from 0 (like 0, 1, 2, 3, ...)

Instructions on how to get this game running

  • Install Python on your machine
  • Run in the terminal these commands in order to install pipenv and cv2:
    pip install pygame
    pip install pipenv
    pip install opencv-python
  • Now install the game with pipenv using in the root directory:
    pipenv install
  • After you installed everything with the previous two commands, run as a non-glasses user:
    pipenv run python flappy.py flappy.py
  • And as someone who wears glasses, run:
    pipenv run python flappy.py -glasses
  • Now the game should start running. If not, you might need to add to your PATH variable the freshly installed pipenv command.

Change to your own haarcascades

  • For face recognition replace haarcascades/haarcascade_frontalface_default.xml
  • For eye recognition replace haarcascades/haarcascade_eye.xml
  • For eye recognitioin for people with glasses haarcascades/haarcascade_eye_tree_eyeglasses.xml

Tips:

  • Stand still during gameplay and don't move your head too much, otherwise the camera has to recognize your face first again and then your eyes
  • When game won't stop, force kill it by using a task manager or something similar
  • Use glasses mode, when you wear glasses (e.g. use start-for-glasses-users.cmd) or basically start flappy.py with the flag -glasses (e. g. py flappy.py -glasses)

Known issues:

Note that this is just an experimental project and not a real game. You can have fun using it, but don't bother when it has issues.

Credits

Many credits go out to the original creator sourabhv of the base game used in this project.

flappyblink's People

Contributors

sero583 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.