An interactive browser-based escape room game with AI guidance, voice commands, and 3D isometric graphics built for hackathon rapid prototyping.
- Isometric 3D room rendering with React Three Fiber
- AI-powered hints via Gemini Live API (voice inputs)
- Voice output support using Web Speech API
- Text chat fallback for AI interaction
- Interactive objects with visual feedback
- Responsive UI with TailwindCSS
- Framework: Next.js 16 (App Router)
- UI Library: React 18
- 3D Rendering: React Three Fiber + Drei
- Styling: TailwindCSS
- State Management: Zustand
- AI Integration: Google Gemini API
- Voice Input: Web Speech API
- TypeScript: Full type safety
- Deployment: Vercel
codekada-hackathon/
├── public/
│ ├── textures/ # 3D texture files
│ ├── models/ # 3D model files (.glb, .gltf)
│ ├── sounds/ # Audio files
│ └── favicon.svg # Site icon
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ └── ai/
│ │ │ └── route.ts # Gemini AI API endpoint
│ │ ├── layout.tsx # Root layout
│ │ ├── page.tsx # Main game page
│ │ └── globals.css # Global styles
│ ├── components/
│ ├── scenes/
│ ├── hooks/
│ └── types/
│ └── index.ts # TypeScript definitions
├── .env.local.example # Environment variables template
├── .gitignore
├── package.json
├── tsconfig.json
├── tailwind.config.js
├── next.config.js
└── README.md
- Node.js 18+ and npm 9+
- Google Gemini API key from Google AI Studio
- Clone or download this repository
cd codekada-hackathon- Install dependencies
npm install- Set up environment variables
Create a .env.local file in the root directory:
cp .env.local.example .env.localEdit .env.local and add your Gemini API key:
NEXT_PUBLIC_GEMINI_API_KEY=your_actual_api_key_here
NEXT_PUBLIC_GEMINI_MODEL=gemini-1.5-flash- Run the development server
npm run dev- Open your browser
Navigate to http://localhost:3000
- Safe - Locked with a 4-digit code (answer: 7392)
- Painting - Contains a hidden clue
- Desk - Can be searched for items
- Click on objects in the 3D room to interact
- Use voice input (microphone button) or type messages to talk to the AI
- Ask the AI for hints when stuck
- Solve puzzles to progress
- Try to escape the room
The AI assistant:
- Provides contextual hints based on your actions
- Validates puzzle solutions
- Gives atmospheric descriptions
- Never reveals full solutions directly
- Responds to both voice and text input
npm run type-checknpm run lintnpm run buildnpm start- Install Vercel CLI
npm install -g vercel- Deploy
vercel- Add environment variables in Vercel dashboard
- Go to your project settings
- Add
NEXT_PUBLIC_GEMINI_API_KEYandNEXT_PUBLIC_GEMINI_MODEL
- Push code to GitHub
git init
git add .
git commit -m "initial commit"
git branch -M main
git remote add origin YOUR_GITHUB_REPO_URL
git push -u origin main- Connect to Vercel
- Go to vercel.com
- Import your GitHub repository
- Add environment variables
- Deploy
In Vercel dashboard, add:
NEXT_PUBLIC_GEMINI_API_KEY = your_gemini_api_key
NEXT_PUBLIC_GEMINI_MODEL = gemini-1.5-flash
- Voice Input: Chrome, Edge, Safari (latest versions)
- 3D Graphics: All modern browsers with WebGL support
- Fallback: Text input works on all browsers
- Edit
src/scenes/IsometricRoom.tsx - Add new
<InteractableObject>components - Update AI prompt in
src/app/api/ai/route.ts
Edit the system prompt in src/app/api/ai/route.ts:
const systemPrompt = `Your custom AI personality here...`;Update puzzle logic in:
src/hooks/useGameState.ts- Game statesrc/app/api/ai/route.ts- AI responsessrc/scenes/InteractableObject.tsx- Object interactions
- Ensure you're using HTTPS (required for Web Speech API)
- Check browser microphone permissions
- Use Chrome or Edge for best compatibility
- Fallback to text input if needed
- Check browser console for WebGL errors
- Ensure browser supports WebGL 2.0
- Try updating graphics drivers
- Use a different browser
- Verify
.env.localhas correct Gemini API key - Check API key has quota available
- Check browser console for fetch errors
- Verify internet connection
# clear cache and reinstall
rm -rf node_modules .next
npm install
npm run build- Multiple rooms/levels
- Inventory system
- More complex puzzles
- 3D models instead of basic shapes
- Sound effects and background music
- Multiplayer support
- Save/load game state
- Mobile touch controls
- AI voice output (text-to-speech)