Permainan interaktif untuk mendeteksi ekspresi wajah secara real-time!
Fitur โข Instalasi โข Cara Bermain โข Dokumentasi โข Tim
Expressify adalah permainan interaktif berbasis deteksi ekspresi wajah yang menantang pemain untuk menunjukkan berbagai ekspresi dengan cepat dan akurat! Dalam waktu yang terbatas, Anda akan diberi instruksi acak seperti senyum lebar ๐, cemberut sedih ๐ข, kaget maksimal ๐ฒ, atau wajah datar ๐. Setiap ekspresi yang benar akan menambah skor Anda!
Game ini dikembangkan sebagai Tugas Besar untuk mata kuliah Sistem Teknologi Multimedia menggunakan teknologi MediaPipe Face Mesh untuk deteksi landmark wajah tanpa deep learning. Project ini mendemonstrasikan implementasi Computer Vision dan Human-Computer Interaction dalam bentuk aplikasi interaktif yang menarik.
- ๐ฏ Real-time Face Detection - Deteksi wajah instan menggunakan MediaPipe Face Mesh (478 landmark points)
- ๐ 4 Ekspresi Berbeda - Happy, Sad, Surprised, Neutral dengan deteksi akurat
- ๐๏ธ 3 Tingkat Kesulitan
- ๐ข Easy: 30 detik, 2 ekspresi
- ๐ก Medium: 20 detik, 4 ekspresi
- ๐ด Hard: 15 detik, 4 ekspresi (cooldown lebih cepat)
- ๐ Leaderboard System - Simpan top 10 scores untuk setiap tingkat kesulitan
- ๐ค Player Profiles - Nama pemain kustom (maksimal 15 karakter)
- ๐ Performance Metrics - Feedback performa berdasarkan persentase skor
- ๐ผ๏ธ UI Interaktif - Antarmuka modern dengan Pygame & animasi smooth
- ๐ต Audio Support - Sound effects & background music (optional)
- ๐จ Visual Effects - Particle system, gradient backgrounds, glow effects
- ๐ Rainbow Animations - Animated title dengan warna dinamis
- โก Optimized Performance - Target 30 FPS untuk gameplay yang smooth
- ๐ฎ Intuitive Controls - Navigasi keyboard yang mudah dipahami
- ๐พ Data Persistence - Leaderboard tersimpan di JSON
- ๐ง Modular Architecture - Clean code dengan separation of concerns
- ๐ฆ Package Structure - UI components organized in modular package
- ๐จ Reusable Components - Shared rendering utilities across screens
![]() ๐ Happy Sudut mulut naik |
![]() ๐ข Sad Sudut mulut turun |
![]() ๐ฒ Surprised Mulut & mata terbuka |
![]() ๐ Neutral Wajah rileks |
| ๐จโ๐ป Developer | ๐ฏ Role | ๐ง Contact |
|---|---|---|
| Hamka Putra Andiyan | Lead Developer & Face Detection | @hamka |
| Bayu Ega Ferdana | Game Logic & Sound System | @bayu |
| Falih Dzakwan Zuhdi | Integration & UI Design | @falih |
graph TB
A[main.py<br/>Game Controller] --> B[face_detector.py<br/>MediaPipe Face Mesh]
A --> C[game_logic.py<br/>Score & Timer]
A --> D[ui/<br/>Modular UI Package]
A --> E[sound_manager.py<br/>Audio System]
A --> F[leaderboard_manager.py<br/>JSON Storage]
B --> G[Camera Feed]
C --> H[Expression Matching]
D --> I[Screen Renderers]
D --> J[Animation Systems]
E --> K[Sound Effects & BGM]
F --> L[leaderboard.json]
I --> M[Menu Screen]
I --> N[Game Screen]
I --> O[Results Screen]
J --> P[Particles]
J --> Q[Floating Images]
graph LR
A[UIManager<br/>Orchestrator] --> B[MenuScreen]
A --> C[GameScreen]
A --> D[ResultsScreen]
A --> E[OtherScreens]
A --> F[ImageManager]
A --> G[Animations]
B --> H[BaseRenderer]
C --> H
D --> H
E --> H
H --> I[Constants]
F --> I
G --> I
- ๐ป OS: Windows 10/11, macOS, Linux
- ๐ฅ Webcam: Built-in or external (minimum 480p)
- ๐ Python: 3.8 atau lebih baru
- ๐พ Storage: ~500 MB untuk dependencies
- ๐ฅ๏ธ RAM: Minimum 4 GB (8 GB recommended)
Semua dependencies sudah terdaftar di requirements.txt:
mediapipe==0.10.14 # Face landmark detection
opencv-python==4.10.0.84 # Video processing
numpy==1.26.4 # Numerical operations
pygame==2.6.0 # Game engine & UI
Pillow==10.4.0 # Image processing๐ช Windows (PowerShell/CMD)
# 1. Clone repository
git clone https://github.com/Yuuggaa/Expressify.git
cd Expressify
# 2. Jalankan installer otomatis
setup.bat
# 3. Jalankan game
venv\Scripts\activate
python src\main.py๐ง Linux / ๐ macOS
# 1. Clone repository
git clone https://github.com/Yuuggaa/Expressify.git
cd Expressify
# 2. Jalankan installer otomatis
chmod +x setup.sh
./setup.sh
# 3. Jalankan game
source venv/bin/activate
python src/main.pyClick to expand manual installation steps
# 1. Clone repository
git clone https://github.com/Yuuggaa/Expressify.git
cd Expressify
# 2. Buat virtual environment
python -m venv venv
# 3. Aktifkan virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# 4. Upgrade pip
python -m pip install --upgrade pip
# 5. Install dependencies
pip install -r requirements.txt
# 6. Jalankan game
python src/main.pyUntuk pengalaman terbaik, tambahkan file audio di folder assets/sounds/:
bgm.wav- Background music untuk menuclick.wav- Sound effect untuk button clickhigh_score.wav- Sound untuk skor tinggitrue_answer.wav- Sound untuk jawaban benar
Note: Game akan berjalan normal tanpa file audio (graceful fallback)
# Pastikan virtual environment aktif
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Jalankan game
python src/main.py| Tombol | Fungsi | Screen |
|---|---|---|
โ โ |
Navigasi horizontal | Menu |
โ โ |
Navigasi vertikal | Difficulty |
SPACE |
Konfirmasi / Main lagi | All |
ENTER |
Submit nama | Name Input |
ESC |
Kembali / Keluar | All |
1 2 3 |
Ganti difficulty | Leaderboard |
BACKSPACE |
Hapus karakter | Name Input |
๐ Menu Utama โ ๐ค Input Nama โ ๐๏ธ Pilih Kesulitan โ ๐ฎ Gameplay โ ๐ Results โ ๐ Leaderboard
-
๐ Menu Utama
- Pilih PLAY untuk mulai bermain
- Pilih LEADERBOARD untuk melihat top scores
- Pilih QUIT untuk keluar
-
๐ค Input Nama
- Masukkan nama Anda (maksimal 15 karakter)
- Nama akan muncul di leaderboard
- Tekan
ENTERuntuk lanjut atauESCuntuk skip
-
๐๏ธ Pilih Kesulitan
- ๐ข MUDAH: 30 detik, 2 ekspresi (Happy & Sad)
- ๐ก SEDANG: 20 detik, 4 ekspresi (semua)
- ๐ด SULIT: 15 detik, 4 ekspresi (cooldown cepat)
-
๐ฎ Gameplay
- Lihat instruksi ekspresi di layar
- Tunjukkan ekspresi yang diminta ke kamera
- Skor bertambah jika ekspresi benar
- Perhatikan timer - waktu terus berjalan!
-
๐ Results
- Lihat skor akhir dan performa Anda
- Rating otomatis berdasarkan persentase:
- ๐ Rank S (80%+): LUAR BIASA! โญโญโญโญโญ
- ๐ฅ Rank A (60-79%): BAGUS SEKALI! โญโญโญโญ
- ๐ฅ Rank B (40-59%): CUKUP BAIK! โญโญโญ
- ๐ฅ Rank C (<40%): TERUS BERLATIH! โญ
-
๐ Leaderboard
- Top 10 pemain untuk setiap difficulty
- ๐ฅ Gold - ๐ฅ Silver - ๐ฅ Bronze medals
- Tekan
1,2,3untuk ganti difficulty
๐ฏ Cara Mendapat Skor Tinggi
- โ Pastikan pencahayaan baik - Hindari backlight
- โ Posisikan wajah di tengah - Jaga jarak ~50cm dari kamera
- โ Ekspresi yang jelas - Lebih ekspresif = lebih mudah terdeteksi
- โ Fokus pada instruksi - Jangan terlalu cepat berganti ekspresi
- โ Latihan mode Easy dulu - Pahami mekanisme sebelum Hard mode
Expressify/
โ
โโโ ๐ src/ # Source code utama
โ โโโ ๐ฎ main.py # Entry point & game controller
โ โโโ ๐๏ธ face_detector.py # MediaPipe face detection
โ โโโ ๐ฏ game_logic.py # Game rules & scoring
โ โโโ ๐ sound_manager.py # Audio system
โ โโโ ๐ leaderboard_manager.py # Score persistence
โ โ
โ โโโ ๐ ui/ # Modular UI components
โ โโโ ๐จ ui_manager.py # Main UI orchestrator
โ โโโ ๐ญ constants.py # Colors, fonts, dimensions
โ โโโ ๐๏ธ base_renderer.py # Base rendering utilities
โ โโโ โจ animations.py # Particle & animation systems
โ โโโ ๐ผ๏ธ image_manager.py # Expression image loader
โ โโโ ๐ menu_screen.py # Main menu renderer
โ โโโ ๐ฎ game_screen.py # Game screen renderer
โ โโโ ๐ results_screen.py # Results screen renderer
โ โโโ ๐๏ธ other_screens.py # Difficulty, leaderboard, name input
โ โโโ ๐ README.md # UI module documentation
โ โโโ ๐ ARCHITECTURE.md # UI architecture diagram
โ โโโ ๐ฆ __init__.py # Package initialization
โ
โโโ ๐ assets/ # Game assets
โ โโโ ๐ sounds/ # Audio files (optional)
โ โ โโโ bgm.wav
โ โ โโโ click.wav
โ โ โโโ start.wav
โ โ โโโ true_answer.wav
โ โ โโโ high_score.wav
โ โ โโโ botHigh_score.wav
โ โ โโโ upLow_score.wav
โ โ โโโ low_score.wav
โ โโโ ๐ผ๏ธ images/ # UI icons
โ โ โโโ icon.ico # Application icon (Windows .exe)
โ โ โโโ exchange.png # Navigation icon
โ โ โโโ up-down.png # Selection icon
โ โโโ ๐ธ photo/ # Expression reference images
โ โโโ Senang.png # Happy expression
โ โโโ Sedih.png # Sad expression
โ โโโ Kaget.png # Surprised expression
โ โโโ Datar.png # Neutral expression
โ
โโโ ๐ docs/ # Dokumentasi tambahan
โ โโโ BUILD_GUIDE.md # Build executable guide
โ โโโ FEATURES.md # Detailed features
โ โโโ GAME_FLOW.md # Game flow diagram
โ โโโ SOUND_GUIDE.md # Audio setup guide
โ
โโโ ๐ reports/ # Project reports & documentation
โ โโโ ๐ report.tex # LaTeX project report
โ โโโ ๐ Referensi.bib # Bibliography references
โ โโโ ๐ Readme.MD # Template usage guide
โ โโโ ๐ LICENSE # Template license
โ โโโ ๐ Figure/ # Report figures & images
โ
โโโ ๐ scripts/ # Build & utility scripts
โ โโโ ๐จ build_exe.bat # Build portable .exe (Windows)
โ โโโ ๐จ build_exe_dir.bat # Build install folder (Windows)
โ โโโ ๐จ build_both.bat # Build both versions (Windows)
โ โโโ ๐จ create_icon.py # Generate icon.ico from PNG
โ
โโโ ๐ leaderboard.json # Leaderboard data (auto-generated)
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ setup.bat # Windows installer
โโโ ๐ setup.sh # Linux/Mac installer
โโโ ๐ .gitignore # Git ignore rules
โโโ ๐ README.md # Project documentation (this file)
โโโ ๐ DOWNLOAD_README.md # Download & usage guide for .exe
โโโ ๐ LICENSE # MIT License
โโโ ๐ฎ QUICKSTART.md # Quick start guide
src/ui/
โโโ ui_manager.py # Main orchestrator - coordinates all UI components
โโโ constants.py # Configuration (Colors, Dimensions, FontManager)
โโโ base_renderer.py # Reusable rendering utilities (gradients, text effects)
โโโ animations.py # Animation systems (ParticleSystem, FloatingImages, Confetti)
โโโ image_manager.py # Expression image loading & rendering
โโโ menu_screen.py # Main menu screen renderer
โโโ game_screen.py # Game playing screen renderer
โโโ results_screen.py # Results & ranking screen renderer
โโโ other_screens.py # Additional screens (Difficulty, Leaderboard, NameInput)
Key Features of Modular UI:
- โ Separation of Concerns - Each module has single responsibility
- โ Maintainability - Easy to update individual screens
- โ Reusability - Shared utilities in base_renderer
- โ Scalability - Simple to add new screens or features
- โ Clean Code - Well-organized with clear dependencies
graph LR
A[๐น Camera Input] --> B[๐ Face Detection]
B --> C[๐ 478 Landmarks]
C --> D[๐ Geometry Analysis]
D --> E{Expression?}
E -->|Mouth Up| F[๐ Happy]
E -->|Mouth Down| G[๐ข Sad]
E -->|Mouth Wide| H[๐ฒ Surprised]
E -->|Neutral| I[๐ Neutral]
Game ini menggunakan MediaPipe Face Mesh yang mendeteksi 478 landmark points pada wajah secara real-time:
# Key landmarks used:
- Mouth: landmarks 61, 291 (corners), 13, 14 (lips)
- Eyebrows: landmarks 70, 63 (left), 300, 293 (right)
- Eyes: landmarks 159, 145 (left), 386, 374 (right)-
Happy ๐:
- Mouth corners elevated (y-position)
- Slight mouth opening
- Distance ratio:
mouth_width / mouth_height > 2.0
-
Sad ๐ข:
- Mouth corners depressed
- Eyebrows lowered
- Mouth curvature negative
-
Surprised ๐ฒ:
- Mouth height > 20 pixels
- Eyes wide open (eyebrow distance increased)
- Jaw dropped significantly
-
Neutral ๐:
- Default state
- Minimal facial muscle activation
- Balanced landmark positions
# Confidence thresholds
HAPPY_THRESHOLD = 0.02 # Mouth corner elevation
SAD_THRESHOLD = -0.02 # Mouth corner depression
SURPRISED_THRESHOLD = 20 # Mouth height in pixels| Metrik | Value |
|---|---|
| Detection FPS | ~30 FPS |
| Landmark Detection | 478 points |
| Expression Accuracy | ~85-90% |
| Latency | <50ms |
๐ฅ Kamera tidak terdeteksi
Problem: Failed to open camera error
Solutions:
# 1. Check kamera tidak digunakan aplikasi lain
# Tutup Zoom, Teams, Skype, dll
# 2. Restart aplikasi
python src/main.py
# 3. Check permission kamera
# Windows: Settings โ Privacy โ Camera
# Mac: System Preferences โ Security & Privacy โ Camera
# 4. Test kamera dengan script sederhana
python -c "import cv2; cap = cv2.VideoCapture(0); print('OK' if cap.isOpened() else 'FAIL')"๐ฆ Dependencies error
Problem: ModuleNotFoundError atau import errors
Solutions:
# 1. Pastikan venv aktif
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# 2. Reinstall dependencies
pip install --upgrade -r requirements.txt
# 3. Clear cache dan reinstall
pip cache purge
pip install --force-reinstall -r requirements.txt
# 4. Check Python version (min 3.8)
python --version๐ Virtual environment issues
Problem: venv corrupted atau tidak bisa aktif
Solutions:
# 1. Hapus venv lama
# Windows:
rmdir /s venv
# Linux/Mac:
rm -rf venv
# 2. Buat venv baru
python -m venv venv
# 3. Aktifkan dan install
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
pip install -r requirements.txt๐ฎ Game lag atau FPS rendah
Problem: Performance issues
Solutions:
- โ Close aplikasi lain yang berat
- โ Update graphics driver
- โ
Kurangi resolusi kamera (edit di
main.py) - โ
Disable particle effects (comment di
ui_manager.py) - โ Check CPU usage (<80% recommended)
๐ Audio tidak keluar
Problem: No sound atau audio error
Solutions:
# 1. Check file audio ada di assets/sounds/
ls assets/sounds/ # Linux/Mac
dir assets\sounds\ # Windows
# 2. Test pygame audio
python -c "import pygame; pygame.mixer.init(); print('OK')"
# 3. Game berjalan normal tanpa audio (graceful fallback)
# Pastikan file .wav format PCM๐ Ekspresi tidak terdeteksi akurat
Problem: False positives atau ekspresi salah
Solutions:
- โ Pencahayaan: Pastikan ruangan cukup terang
- โ Posisi: Jaga wajah di tengah frame
- โ Jarak: 40-60 cm dari kamera ideal
- โ Background: Hindari background yang ramai
- โ Ekspresi: Buat ekspresi lebih jelas dan ekstrem
- โ Kacamata: Lepas jika deteksi terganggu
- ๐ QUICKSTART.md - Quick start guide
- โจ FEATURES.md - Detailed features list
- ๐ฎ GAME_FLOW.md - Game state diagram
- ๐ SOUND_GUIDE.md - Audio setup guide
- ๐๏ธ BUILD_GUIDE.md - Build executable guide
Mau main tanpa install Python?
Download versi executable (.exe):
- ๐พ Expressify v1.0 - Windows
- ๐ Download Guide
Tinggal download, double-click, dan main! ๐ฎ
Ingin build sendiri? Lihat panduan lengkap di BUILD_GUIDE.md
Quick Build (Windows):
# Build portable .exe (single file)
.\scripts\build_exe.bat
# Build install version (folder)
.\scripts\build_exe_dir.bat
# Build both versions at once
.\scripts\build_both.batOutput:
dist/Expressify.exe- Portable version (~150-200 MB)dist/Expressify/- Install version (~180 MB unzipped)dist/Expressify.zip- Zipped install version (auto-created)
- ๐ MediaPipe Face Mesh Documentation
- ๐ OpenCV Python Tutorials
- ๐ Pygame Documentation
- ๐ NumPy User Guide
Contributions are welcome! Please feel free to submit a Pull Request.
# 1. Fork & clone
git clone https://github.com/YOUR_USERNAME/Expressify.git
# 2. Create branch
git checkout -b feature/amazing-feature
# 3. Make changes & commit
git commit -m "Add amazing feature"
# 4. Push & create PR
git push origin feature/amazing-feature- Follow PEP 8 guidelines
- Add docstrings to functions
- Use type hints where applicable
- Comment complex logic
- Write descriptive commit messages
This project is created for academic purposes (Tugas Besar Sistem Teknologi Multimedia).
MIT License - feel free to use for educational purposes.
Jika project ini membantu Anda, berikan โญ di GitHub!
Tim Expressify
Hamka Putra Andiyan โข Bayu Ega Ferdana โข Falih Dzakwan Zuhdi
Sistem Teknologi Multimedia - 2025






