โ Disclaimer
This project is currently a prototype and may not function correctly.
It is a work in progress and is intended for experimental and demonstration purposes only.
NeuroMaze is an AI-powered puzzle game that adapts itself in real-time based on your emotional state and playstyle. Combining Unity game design, AI, and emotion detection, it delivers a truly personalized gameplay experience.
- ๐ค Real-Time Emotion Detection โ Uses your webcam to sense stress, confusion, or excitement
- ๐งฉ Dynamic Puzzle Generation โ Mazes and puzzles evolve in complexity as you play
- ๐ง Player Behavior Profiling โ Learns your style: solver, explorer, rusher, tinkerer
- ๐ฃ๏ธ AI-Powered Game Narrator โ The in-game voice adapts its tone to your behavior and emotions
- ๐ Unity-Based Game โ High-quality 3D experience with WebGL export capability
- Windows 10/11
- Python 3.10 or higher
- Webcam
- Git (optional, for cloning)
- Download the latest release
- Run
main.py- This will automatically:
- Set up the Python environment
- Install dependencies
- Start the AI backend
- Launch the game
- This will automatically:
# 1. Clone the repository
git clone https://github.com/Kira262/NeuroMaze.git
cd NeuroMaze
# 2. Install dependencies
pip install -r requirements.txt
# 3. Start the backend
python ai_backend/main.py
# 4. Launch the game
python main.pyThe game automatically detects and configures settings based on your system, but you can manually adjust parameters as needed:
# Sample configuration
config = {
"backend": {
"host": "127.0.0.1",
"port": 8000
},
"emotion_detector": {
"update_interval": 1.0, # How often to check emotions (in seconds)
"model": "emotion_detector/models/emotion_model.pth"
},
"game": {
"default_difficulty": "Normal",
"enable_emotion_detection": True
}
}NeuroMaze/
โโโ main.py # Main application entry point
โโโ ai_backend/ # FastAPI backend for game logic
โ โโโ main.py # Backend server
โโโ emotion_detector/ # Real-time emotion detection
โ โโโ __init__.py
โ โโโ backend_client.py # Client for communicating with backend
โ โโโ detect_emotion.py # Emotion detection implementation
โ โโโ emotion_detector.py # Core detector class
โ โโโ emotion_model.py # PyTorch model definitions
โ โโโ models/ # Pre-trained emotion models
โ โโโ emotion_album_model.pt
โ โโโ emotion_model.pth
โ โโโ train_model.py # Script for training custom models
โโโ assets/ # Art, audio, and UI assets
โโโ demo/ # Demo builds and gameplay footage
โโโ requirements.txt # Python dependencies
โโโ checkgpu.py # Utility to verify GPU availability
โโโ unity-game/ # Unity game project
โโโ Assets/ # Unity game assets
โ โโโ Scenes/ # Game scenes/levels
โ โโโ Scripts/ # C# game scripts
โ โโโ Settings/ # Unity project settings
โ โโโ Sprites/ # 2D graphics
โโโ ProjectSettings/ # Unity configuration
The project uses Unity as the game engine, with Python-based backend services for:
- Emotion detection through webcam
- AI-driven difficulty adjustment
- Dynamic maze generation
The Unity game communicates with the Python backend via REST API calls.
- Start the AI backend:
python ai_backend/main.py - Run emotion detection tests:
python emotion_detector/detect_emotion.py --test - Open the Unity project in Unity Editor for game development
- For full experience testing, run
python main.py
[Webcam] โ [Emotion Detector] โ [AI Backend] โ [Unity Game]
| | | |
| | | |
+---[Face] +---[Emotion] +---[Difficulty] +---[Adaptive Maze]
The system uses a PyTorch-based neural network trained on facial expressions to detect seven core emotions:
- Happiness
- Anger
- Fear
- Sadness
- Surprise
- Disgust
- Neutral
These emotions are processed in real-time and sent to the AI backend for game adaptation.
| Emotion | Difficulty | Game Adjustments |
|---|---|---|
| Happiness | Easy | Slower enemies, more health, longer time |
| Anger | Hard | Faster enemies, less health, shorter time |
| Fear | Easy | Reduced challenge to ease tension |
| Sadness | Easy | Reduced challenge to improve mood |
| Surprise | Normal | Standard game parameters |
| Disgust | Hard | Increased challenge |
| Neutral | Normal | Standard game parameters |
-
Webcam Not Working
- Check if webcam is properly connected
- Verify camera permissions in Windows Settings
- Try running:
python emotion_detector/detect_emotion.py --test-camera
-
GPU Acceleration Issues
- Run
python checkgpu.pyto verify GPU detection - Update your graphics drivers
- Ensure PyTorch is installed with CUDA support if using NVIDIA GPU
- Run
-
Backend Connection Issues
- Check if backend is running:
curl http://localhost:8000/health - Verify port 8000 is available
- Check for error messages in the console
- Check if backend is running:
-
Unity Game Not Starting
- Verify Unity installation
- Check for error logs in the console
- Try running the standalone build if available
Key dependencies include:
- PyTorch (ML framework)
- OpenCV (Computer vision)
- FastAPI (Backend server)
- MediaPipe (Face detection)
- TensorFlow (Additional ML capabilities)
Run pip install -r requirements.txt to install all dependencies.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a pull request
MIT License โ Feel free to fork, remix, and build on top of this.
Paavan
CSE Student | Full-stack Dev | AI Explorer
Portfolio
- MediaPipe for facial landmark detection
- PyTorch for the emotion recognition model
- FastAPI for the backend server
- Unity for the game engine