UNO card game web app (Node.js/React) with Miku bot integration. Previously an independent git repo (fork of mizanxali/uno-online). Removed .git/ and absorbed into main repo for unified tracking. Includes bot integration code: botActionExecutor, cardParser, gameStateBuilder, and server-side bot action support. 37 files, node_modules excluded via local .gitignore.
3.3 KiB
3.3 KiB
UNO Bot Integration - Setup Notes
Node.js Version Compatibility
This project was originally developed with Node.js 14-16.
IMPORTANT: Due to PostCSS compatibility issues, this project requires Node.js 16 or 18.
Current System Issue
- ❌ Node.js v25.3.0 - PostCSS subpath export errors
- ✅ Node.js 18.x - Recommended
- ✅ Node.js 16.x - Also works
Solution: Use nvm to switch Node version
# Install nvm if not already installed
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node 18
nvm install 18
# Use Node 18
nvm use 18
# Verify version
node --version # Should show v18.x.x
After switching to Node 18, proceed with the setup below.
Quick Start
1. Install Dependencies
Server:
cd /home/koko210Serve/docker/uno-online
npm install
Client:
cd /home/koko210Serve/docker/uno-online/client
npm install
2. Start Server (Terminal 1)
cd /home/koko210Serve/docker/uno-online
npm start
Server runs on: http://localhost:5000
3. Start Client (Terminal 2)
cd /home/koko210Serve/docker/uno-online/client
npm start
Client opens at: http://localhost:3000
4. Test Bot Integration
Create a game:
- Open
http://localhost:3000 - Click "CREATE GAME"
- Note the room code (e.g., "ABCDEF")
Open browser console (F12) to see game state logs
Test API:
# Get game state (replace ABCDEF with your room code)
curl http://localhost:5000/api/game/ABCDEF/state
# Play a card (after joining as Player 2)
curl -X POST http://localhost:5000/api/game/ABCDEF/action \
-H "Content-Type: application/json" \
-d '{"action":"draw_card"}'
What to Look For
Browser Console Output
When you play as Player 2, you'll see:
🎮 UNO GAME STATE (Simplified): { turn: "Player 2", currentCard: "5 red (5R)", ... }
🤖 FULL GAME STATE (For Bot): { game: {...}, currentCard: {...}, ... }
📋 JSON for Bot API:
{
"game": { ... }
...
}
Server Console Output
[Bot Game State] Room: ABCDEF
{
"game": { ... }
}
Files Modified for Bot Integration
New Files
/client/src/utils/cardParser.js- Parse card codes to JSON/client/src/utils/gameStateBuilder.js- Build comprehensive game state/BOT_INTEGRATION_GUIDE.md- Full integration documentation/BOT_QUICK_REF.md- Quick reference guide/SETUP_NOTES.md- This file
Modified Files
/client/src/components/Game.js- Added state export and logging/server.js- Added HTTP API endpoints and Socket.IO handlers
Common Issues
Port Already in Use
If port 5000 or 3000 is busy:
# Kill process on port 5000
lsof -ti:5000 | xargs kill -9
# Kill process on port 3000
lsof -ti:3000 | xargs kill -9
npm Install Failures
If you get peer dependency warnings, use:
npm install --legacy-peer-deps
Module Not Found Errors
Clear cache and reinstall:
rm -rf node_modules package-lock.json
npm install
Next Steps
- ✅ Game state exports to console
- ✅ HTTP API endpoints created
- ⏭️ Test manual API calls
- ⏭️ Integrate with Miku bot
- ⏭️ Create Discord command
/uno join [room_code] - ⏭️ Implement LLM decision-making
See BOT_INTEGRATION_GUIDE.md for Miku bot integration details.