Skip to content

About

EmotionEngine Hackathon Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

3 Commits

Folders and files

Repository files navigation

๐Ÿง  NeuroMaze: Adaptive Puzzleverse ๐ŸŽฎ

โš  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.

Python FastAPI PyTorch Unity MIT License Made with Love Development Status

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.

โœจ Features

  • ๐Ÿค– 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

๐Ÿš€ Quickstart

Prerequisites

  • Windows 10/11
  • Python 3.10 or higher
  • Webcam
  • Git (optional, for cloning)

Installation Options

Option 1: One-Click Launch (Recommended)

  1. Download the latest release
  2. Run main.py
    • This will automatically:
      • Set up the Python environment
      • Install dependencies
      • Start the AI backend
      • Launch the game

Option 2: Manual Setup

# 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.py

Configuration

The 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
    }
}

๐Ÿ› ๏ธ Development

Project Structure

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

Unity Integration

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.

Development Workflow

  1. Start the AI backend: python ai_backend/main.py
  2. Run emotion detection tests: python emotion_detector/detect_emotion.py --test
  3. Open the Unity project in Unity Editor for game development
  4. For full experience testing, run python main.py

๐Ÿง  How It Works

System Architecture

[Webcam] โ†’ [Emotion Detector] โ†’ [AI Backend] โ†’ [Unity Game]
      |             |                  |                |
      |             |                  |                |
      +---[Face]    +---[Emotion]      +---[Difficulty] +---[Adaptive Maze]

Emotion Detection

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.

Difficulty Levels

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

๐Ÿ†˜ Troubleshooting

Common Issues

  1. 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
  2. GPU Acceleration Issues

    • Run python checkgpu.py to verify GPU detection
    • Update your graphics drivers
    • Ensure PyTorch is installed with CUDA support if using NVIDIA GPU
  3. 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
  4. Unity Game Not Starting

    • Verify Unity installation
    • Check for error logs in the console
    • Try running the standalone build if available

Dependencies

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.

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a pull request

๐Ÿ“œ License

MIT License โ€“ Feel free to fork, remix, and build on top of this.

๐Ÿ‘ค Author

Paavan
CSE Student | Full-stack Dev | AI Explorer
Portfolio

๐Ÿ™ Acknowledgments

  • MediaPipe for facial landmark detection
  • PyTorch for the emotion recognition model
  • FastAPI for the backend server
  • Unity for the game engine

About

EmotionEngine Hackathon Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages