A unique twist on the classic Flappy Bird game that uses facial emotion detection to control gameplay! Smile to jump higher, and watch out - sadness increases gravity!
- Emotion-Controlled Gameplay: Your facial expressions control the bird
- Happy/Smile: Jump power increases based on your smile intensity
- Sadness: Gravity increases, making the bird fall faster
- Real-time Face Detection: Uses TensorFlow.js and face-api.js for instant emotion recognition
- Adjustable Difficulty: Control pipe speed from 10-30 for varying difficulty levels
- Visual Feedback: Live emotion meters show your current happiness and sadness levels
- Webcam Integration: Your webcam feed becomes the game background
- Allow camera access when prompted
- Smile to charge your jump power (shown on the Jump Power meter)
- Click or tap to make the bird jump - jump height is based on your smile!
- Avoid pipes and try to set a high score
- Don't be sad - sadness increases gravity and makes the game harder!
- React 19 - Frontend framework
- face-api.js - Face detection and emotion recognition
- TensorFlow.js - Machine learning models
- HTML5 Canvas - Game rendering
- Webcam API - Real-time video capture
- Node.js (v14 or higher)
- npm or yarn
- Webcam/camera access
- Clone the repository:
git clone https://github.com/nhannpl/Happy-Flappy.git
cd Happy-Flappy- Install dependencies:
npm install- Start the development server:
npm start- Open http://localhost:3000 in your browser
npm run buildThe optimized production build will be in the build/ folder.
npm run deployHappy-Flappy/
โโโ public/
โ โโโ models/ # TensorFlow.js face detection models
โโโ src/
โ โโโ components/
โ โ โโโ Bird.js # Bird component
โ โ โโโ Pipes.js # Pipe obstacles
โ โ โโโ EmotionMeters.js # Visual feedback for emotions
โ โ โโโ GameOverlay.js # Start/Game Over screen
โ โโโ hooks/
โ โ โโโ useFaceDetection.js # Face detection logic
โ โ โโโ useGameLoop.js # Game physics and collision
โ โโโ App.js # Main game component
โ โโโ constants.json # Game configuration
โโโ package.json
- Jump Power: Based on happiness/smile detection (0-100%)
- Gravity: Increases with sadness detection
- Collision Detection: Accurate hitboxes for pipes and screen boundaries
- Score System: Points awarded for successfully passing pipes
- Screen Shake: Visual feedback on collisions
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is MIT licensed.
Nhan
- GitHub: @nhannpl
- Inspired by the classic Flappy Bird game
- Built with face-api.js by Vincent Mรผhler
- TensorFlow.js models for emotion detection
Note: This game requires camera access to function. Your webcam feed is processed locally in your browser and is never uploaded or stored anywhere.