A revolutionary face-controlled Flappy Bird game with GPU-accelerated computer vision, enemy AI, and mouth-based mechanics!
This project is a heavily enhanced fork of TexZ-GenZ/flappy-pushups, taking the original face-controlled gameplay concept to the next level with:
- 🎯 Advanced Enemy AI - LGBT-themed enemy fly with multiple attack patterns
- 🌈 Rainbow Bullet System - Physics-based bouncing projectiles
- 👄 Mouth Detection - Eat bullets and boost speed by opening your mouth
- 🚀 GPU Acceleration - Smooth 120 FPS with OpenCL-accelerated face detection
- 🎨 Enhanced Graphics - Smooth animations, scrolling background, and visual effects
- 🕹️ Full Directional Control - Move in X and Y axes with your face
- Full 2D Movement: Control your fly in all directions (X + Y) with natural face tracking
- Dynamic Speed Boost: Open your mouth wide to move up to 3x faster!
- Increased Pipe Spacing: More forgiving gameplay for better experience
- Smooth Animations: Wing flapping at 4-frame intervals for fluid motion
- Scrolling Ground: Dynamic base movement synced with game speed
- LGBT Enemy Fly: Animated enemy using
lgbtbase_1.pngandlgbtbase_2.png - Dual Attack Modes:
- Charge Attack (Even Scores): Enemy locks onto your position, shows warning line, winds up, then charges at high speed
- Bullet Attack (Odd Scores): Shoots rainbow bullets that bounce off walls
- Heart Pattern: After charging, enemy flies in a heart-shaped pattern before exiting
- Alternating Sides: Enemy attacks from left and right alternately
- Physics-Based Bouncing: Bullets bounce off walls with realistic physics
- 7-Color Rainbow Cycle: Smooth color transitions through the spectrum
- Smart Collision: Tight hitboxes for fair gameplay
- Max 2 Bounces: Bullets disappear after bouncing twice
- Bullet Eating: Open your mouth to catch and destroy bullets for +1 bonus point
- Speed Boost: Mouth openness directly controls movement speed (1x - 3x)
- Visual Feedback: Green circle shows mouth detection area when active
- Real-time Display: On-screen speed multiplier indicator
- GPU Acceleration: OpenCL backend for DNN face detection
- 120 FPS Target: Smooth gameplay on powerful hardware
- Full Resolution Detection: PROCESSING_SCALE = 1.0 for maximum accuracy
- Every-Frame Detection: DETECTION_INTERVAL = 1 for zero lag
- Optimized Collision: Efficient hitbox calculations
- Python 3.7+
- Pygame 2.0+ - Game engine and rendering
- OpenCV (cv2) - Face detection with DNN (GPU-accelerated)
- NumPy - Numerical operations and array processing
- Caffe DNN Model - res10_300x300_ssd for accurate face detection
- Python 3.7 or higher
- Webcam (built-in or external)
- GPU (NVIDIA/AMD recommended for best performance)
- Windows/Linux/Mac OS
git clone https://github.com/YOUR_USERNAME/flappy-pushups-enhanced.git
cd flappy-pushups-enhanced# Create virtual environment
python -m venv .venv
# Activate (Windows)
.venv\Scripts\activate
# Activate (Linux/Mac)
source .venv/bin/activatepip install pygame opencv-python numpyEnsure these files exist:
assests/bug_1.png&assests/bug_2.png- Player fly spritesassests/lgbtbase_1.png&assests/lgbtbase_2.png- Enemy fly spritesassests/base.png- Ground textureassests/pipe.png- Pipe texturesrc/res10_300x300_ssd_iter_140000.caffemodel- Face detection modelsrc/deploy.prototxt.txt- Model config
cd src
python main.py| Action | Control |
|---|---|
| Move Up/Down | Move your head vertically |
| Move Left/Right | Move your head horizontally |
| Speed Boost | Open your mouth wide (up to 3x speed) |
| Eat Bullets | Open mouth when bullet is near (+1 point) |
| Toggle Fullscreen | Press F11 |
| Restart Game | Click "Restart" button when game over |
| Exit | Press ESC or close window |
- Position your face in the center of the camera view
- Good lighting improves face detection accuracy
- Open your mouth wide to move faster when dodging
- Catch bullets with your mouth for bonus points
- Watch for warnings - red dashed line means charge attack incoming!
- Odd vs Even scores - Different enemy attack patterns
-
Score 1+: Enemy activates
-
Even Scores (2, 4, 6...):
- Enemy enters from side at target height
- Shows warning line (1 second)
- Winds up (pulls back)
- Charges at locked position
- Flies heart pattern
- Exits to opposite side
-
Odd Scores (1, 3, 5...):
- Enemy hovers at far edge
- Shoots 1 rainbow bullet
- Waits 1 second
- Slowly exits
- Player Hitbox: 50% of sprite size (forgiving)
- Bullet Hitbox: 40% of radius (tight but fair)
- Mouth Eating: 120% of mouth radius (generous)
- Pipe Collision: Pixel-perfect mask detection
- Pass Pipe: +1 point
- Eat Bullet: +1 bonus point
- Progressive Difficulty: Pipe speed increases with score
Edit src/main.py to customize:
# Performance Settings
FPS = 120 # Target frame rate
PROCESSING_SCALE = 1.0 # Face detection resolution (0.5-1.0)
DETECTION_INTERVAL = 1 # Frames between detection (1-3)
# Gameplay Settings
PIPE_SPEED_BASE = 4 # Initial pipe speed
PIPE_SPACING_FACTOR = 0.1 # Pipe spacing (lower = more space)
BUG_ANIMATION_SPEED = 4 # Wing flapping speed
# Mouth Detection
MOUTH_DARK_THRESHOLD = 70 # Pixel darkness (60-80)
MOUTH_OPEN_RATIO = 0.10 # Openness trigger (0.05-0.20)
BASE_SPEED = 100 # Base movement speed
MAX_SPEED_MULTIPLIER = 3.0 # Max speed boost- Close other apps using the camera (Zoom, Teams, etc.)
- Try changing
cv2.CAP_DSHOWtocv2.CAP_ANYin main.py
- Lower
FPSto 60 - Increase
DETECTION_INTERVALto 2 or 3 - Reduce
PROCESSING_SCALEto 0.8
- Improve lighting in your room
- Adjust camera position (face should fill 30-50% of frame)
- Increase confidence threshold in code (line ~354)
- Better lighting on your face
- Adjust
MOUTH_DARK_THRESHOLD(try 60 or 80) - Lower
MOUTH_OPEN_RATIOto 0.08
TODO: Add gameplay GIF/video here
- Face Detection: ~16ms @ 1.0 scale (GPU)
- Game Logic: ~2ms per frame
- Rendering: ~6ms @ 1920x1080
- Total Frame Time: ~8ms (120+ FPS capable)
- TexZ-GenZ/flappy-pushups - Original concept and base implementation
- This fork includes extensive modifications and new features (see "New Features" section)
- OpenCV DNN Face Detection - res10_300x300_ssd Caffe model
- Pygame - Game engine
- OpenCL - GPU acceleration
This project is licensed under the MIT License - see the LICENSE file for details.
Original project by TexZ-GenZ is also MIT licensed.
If you enjoy this project, please give it a ⭐ on GitHub!
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest features
- 🔧 Submit pull requests
- 📖 Improve documentation
For questions or suggestions, please open an issue on GitHub.
Made with ❤️ and 🐛 | Enhanced from flappy-pushups