A gesture-controlled fruit cutting game using webcam hand tracking, built with Three.js and MediaPipe. Now optimized for Aliyun ESA deployment!
๐ Language / ่ฏญ่จ: English | ไธญๆ
- Modern MediaPipe: Upgraded to
@mediapipe/tasks-visionv0.10.22-rc.20250304 for better reliability - Performance Optimization: Device-adaptive configurations for smooth gameplay
- Enhanced Error Handling: Better fallback mechanisms for production environments
- Fluorescent Trail Effects: Beautiful neon-style hand tracking visuals
- Production-Ready: Optimized specifically for Aliyun ESA deployment
- ModernHandTracker: New architecture based on proven gesture-control patterns
- Performance Monitoring: Real-time FPS and performance metrics (Press 'P')
- Adaptive Quality: Automatically adjusts based on device capabilities
- Better Fallbacks: Mouse/touch controls when camera fails
- โ Slice Fruits: Move your hands to cut flying fruits
- ๐ซ Avoid Bombs: Don't touch the black bombs!
- โฑ๏ธ Time Challenge: 60 seconds to get the highest score
- ๐ฏ Progressive Difficulty: Spawn rate increases over time
- ๐ Neon Trails: Fluorescent hand tracking trails
- ๐ฅ Particle Effects: Explosive fruit cutting animations
- ๐จ 3D Graphics: Beautiful Three.js rendered fruits and effects
- ๐ Real-time Stats: System info and performance monitoring
- Node.js 16+
- Modern browser (Chrome/Edge/Firefox recommended)
- Webcam device
- HTTPS connection (required for camera access)
# Clone the repository
git clone <repository-url>
cd esa-project02
# Install dependencies
npm install
# Start development server
npm run dev
# Visit http://localhost:3000# Build for production
npm run build
# Preview production build
npm run preview- Modern MediaPipe: Uses latest
@mediapipe/tasks-visioninstead of deprecated packages - CDN Reliability: Multiple fallback CDN sources for model loading
- HTTPS Ready: Proper secure context handling for production
- Error Recovery: Graceful fallbacks when MediaPipe fails to load
- Performance Adaptive: Automatically adjusts to server environment
The project includes esa.jsonc configuration:
{
"build": {
"command": "npm run build"
},
"assets": {
"directory": "dist"
},
"routes": [
{
"src": ".*",
"dest": "/index.html"
}
]
}- Build the project:
npm run build - Upload to Aliyun ESA: Upload the
dist/folder - Configure HTTPS: Ensure your domain uses HTTPS
- Test camera access: Use the built-in debug tools
- Allow Camera Access: Grant permission when prompted
- Hand Positioning: Hold your hands in front of the camera
- Start Game: Hover hand over "START GAME" button for 3 seconds
- Slice Fruits: Move your hands to cut flying fruits
- Avoid Bombs: Don't touch the black spheres!
- Hand Gestures: Primary control method
- Mouse/Touch: Fallback when camera unavailable
- SPACE: Pause/Resume game
- P: Toggle performance monitor
- ๐ Fruits: +10 points each
- ๐ฃ Bombs: -20 points each
- โฑ๏ธ Time Bonus: Higher scores for quick cuts
src/
โโโ components/
โ โโโ ModernHandTracker.js # New MediaPipe implementation
โ โโโ TrailRenderer.js # Fluorescent trail effects
โ โโโ GameScene.js # Three.js game logic
โ โโโ ScoreSystem.js # Game scoring
โโโ config/
โ โโโ performance.js # Device-adaptive settings
โโโ utils/
โโโ SystemInfo.js # Real-time system stats
โโโ AudioManager.js # Sound effects
The game automatically detects device capabilities and adjusts:
| Device Type | Detection FPS | Particles | Target FPS | Post-Processing |
|---|---|---|---|---|
| Low-end | 20fps | 15 | 30fps | Disabled |
| Medium | 30fps | 25 | 60fps | Enabled |
| High-end | 60fps | 30 | 60fps | Full Quality |
Problem: Camera not working on Aliyun ESA Solutions:
- Ensure HTTPS is enabled on your domain
- Check browser permissions for camera access
- Try different browsers (Chrome recommended)
- Use the built-in camera debug tool
- Check browser console for detailed errors
Problem: Low FPS or stuttering Solutions:
- The game auto-adjusts quality based on device
- Press 'P' to view performance metrics
- Close other applications using GPU
- Try reducing browser window size
Problem: "MediaPipe initialization failed" Solutions:
- Check network connection
- Verify CDN access (jsdelivr.net, unpkg.com)
- Game will fallback to mouse/touch controls
- Refresh page to retry initialization
Edit src/config/performance.js to modify:
- Detection frame rates
- Particle counts
- Quality presets
- Device capability thresholds
Modify src/components/TrailRenderer.js for:
- Trail colors and effects
- Glow intensity
- Trail length and fade
Update src/components/GameScene.js for:
- Fruit spawn rates
- Difficulty progression
- Collision detection sensitivity
Press P during gameplay to view:
- Real-time FPS
- Frame time breakdown
- Gesture detection performance
- Game update timing
- Render performance
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- gesture-control - The proven architecture this project is based on
- MediaPipe - Hand tracking technology
- Three.js - 3D graphics library
โญ Now production-ready for Aliyun ESA! โญ
This project is accelerated, computed, and protected by Alibaba Cloud ESA

