Setting Up Learning Mode
After choosing UDP as the optimal communication protocol for my sign language learning game, I've finally successfully implemented the full communication pipeline between the Python hand detection system and the Unity game interface. In this blog, I will go through on how I build my learning mode!
Python Side Implementation
Unity Side Implementation
For the Unity side, I used the UDP receiver script provided in the YouTube tutorial and customized it to fit my specific needs. The script already contained most of the functionality I needed, which saved me significant development time. Thank you so much Mr. Murtaza! My customizations focused on:
- Adapting the script to work with my specific JSON data format
- Adding the event system to notify game components about new detections:
- Implementing the thread-safe queue system to safely pass data from the UDP thread to Unity's main thread
Game System of Learning Mode
In learning mode, I want my game system to teach users to make sign language gestures through guided and interactive lessons.
Core Components
The learning mode consists of several key components:
- UDPReceiver: Handles incoming hand sign detections from Python (based on the tutorial's code)
- LearningModeManager: Controls the learning flow and game logic
- UI Components: Display the current letter, instructions, feedback, and camera feed
Flow of Learning Mode
- The system displays the webcam feed in Unity so users can see their hands
- A sequence of letters to learn is pre-loaded (currently A-C in my implementation)
- The LearningModeManager subscribes to the UDPReceiver's OnLetterDetected event
- A letter is presented along with a demonstration image showing the correct hand sign
- The user attempts to form the correct hand sign on the camera view
- Python detects the gesture and sends the recognized letter to Unity
- When the correct letter is detected:
- Visual feedback: The letter flashes green
- Audio feedback: A success sound plays
- Character feedback: The guide congratulates the user
- The character then explicitly asks the user to lower their hand before continuing
- After the user lowers their hand, the system advances to the next letter
- For incorrect signs, the character provides helpful tips and encouragement
- The system generates a personalized certificate with the user's name
Key Codes
Character Guide System
Handling Letter Detection
HandleLetterDetection method, which is triggered by the UDP event system:Completion
Key Technical Challenges
Addressing the Hypersensitive Detection
Setting Up User Interface
1. The Classroom
2. The Book
3. Card Design (Final)
Why the Final Design Worked Best
The simpler card design proved superior for several reasons:
- It maintained visual consistency with the rest of the app
- The cleaner layout reduced distractions and kept focus on learning
- Instructions were more readable in the dedicated text area
- The character felt more like a helpful companion than a formal instructor
- The design adapted better to different screen sizes
This shows how educational interfaces often benefit from simplicity and clarity over thematic design elements. I think by removing unnecessary visual metaphors, the final design better served the primary goal.
Moving Forward
With this foundation in place, I'm now planning to start developing duel mode which allows two players will compete to sign the correct letter first with a fun and competitive element.
Comments
Post a Comment