A complete pipeline for real-time 3D character customization and streaming, built with Unreal Engine 5.5, secure WebSocket bridge, and modern web technologies.
Mannequin enables users to customize 3D characters in real-time through a web interface, with ultra-low latency streaming powered by Livepeer. The system features comprehensive character controls including facial expressions, outfits, body proportions, camera positioning, and environmental settings.
End User → Vercel Web App → WebSocket Bridge → Unreal Engine TCP → WebRTC/UDP → Livepeer → Stream
- Facial Expressions: 20+ emotions (Happy, Sad, Angry, Surprised, etc.)
- Outfits: Multiple clothing options (Kimono, Space Suit, Anime Armor, etc.)
- Physical Attributes: Skin tone, hair color (RGB), eye customization
- Body Proportions: Adjustable bone scaling for head, chest, arms, legs, etc.
- Hair Styles: Various hair cuts and styles
- Real-time Controls: Smooth XYZ positioning and rotation
- Preset Shots: Default, Close-up, Wide, High/Low angle views
- View Modes: Desktop and mobile optimized layouts
- Continuous Updates: Real-time camera streaming with configurable rates
- Basic Animations: Dance, speaking states
- Gesture Emotes: Wave, bow, salute, thumbs up
- Expression Emotes: Plotting, nervous, confident, etc.
- Scene Levels: Home, Lofi room, DJ booth, Medieval castle, Space orbit
- Split Screen: Multi-camera views (2, 3, or 4 way splits)
- Classroom: Educational environment setup
- Authentication: HMAC-SHA256 token-based security
- Origin Validation: Configurable allowed domains
- Rate Limiting: Per-connection and global request limits
- Command Validation: Whitelist of safe command patterns
- Connection Management: Automatic cleanup and monitoring
- Ultra-Low Latency: Sub-3 second end-to-end latency
- Dual Protocol: WebRTC (0.5-3s) and HLS (~10s) support
- Automatic Fallback: Seamless protocol switching
- Quality Control: Adaptive bitrate and resolution
Mannequin/
├── websocket-bridge/ # Secure WebSocket to TCP bridge
│ ├── server.js # Main bridge server
│ ├── package.json # Dependencies
│ ├── .env.example # Configuration template
│ └── README.md # Bridge documentation
├── frontend/ # Next.js React application
│ ├── app/ # Next.js 14 App Router
│ ├── components/ # React components
│ ├── hooks/ # Custom hooks
│ ├── package.json # Frontend dependencies
│ └── README.md # Frontend documentation
├── WebRTCBridge/ # Existing streaming infrastructure
│ └── livepeer_player.html # Reference Livepeer player
├── Controller/ # Reference controller interface
│ └── tcp_controller2.html # Original HTML controller
└── README.md # This file
- Node.js 16+
- Unreal Engine 5.5 project with TCP/WebRTC components
- npm or yarn
cd websocket-bridge
npm install
cp .env.example .env
# Configure your .env file
npm startcd frontend
npm install
cp .env.local.example .env.local
# Configure your environment variables
npm run dev- Load your Unreal Engine project with the provided TCP/WebRTC components
- Ensure TCP server is listening on port 7777
- Configure WebRTC bridge for video streaming
- Start the game/editor
- Frontend: http://localhost:3000
- Bridge API: http://localhost:3001
- WebSocket: ws://localhost:8080
WEBSOCKET_PORT=8080
TCP_HOST=127.0.0.1
TCP_PORT=7777
SECRET_KEY=your-secret-key
ALLOWED_ORIGINS=https://mannequin.vercel.app,http://localhost:3000
MAX_CONNECTIONS=10NEXT_PUBLIC_WEBSOCKET_URL=ws://localhost:8080
BRIDGE_API_URL=http://localhost:3001- Connect GitHub repository to Vercel
- Configure environment variables:
NEXT_PUBLIC_WEBSOCKET_URL=wss://your-bridge-domain.comBRIDGE_API_URL=https://your-bridge-domain.com
- Deploy automatically on push
- Deploy to cloud provider (AWS, Google Cloud, DigitalOcean)
- Configure SSL/TLS certificates
- Set up reverse proxy (nginx)
- Configure firewall rules
- Use process manager (PM2)
# PM2 deployment example
pm2 start server.js --name mannequin-bridge
pm2 startup
pm2 save- Use strong SECRET_KEY
- Configure proper ALLOWED_ORIGINS
- Enable HTTPS/WSS in production
- Set up firewall rules
- Configure rate limiting
- Monitor connection logs
- Regular security updates
- Use reverse proxy with security headers
- WebSocket bridge acts as security barrier
- No direct access to local TCP ports
- Command validation prevents injection
- Rate limiting prevents abuse
- Authentication required for all commands
// Continuous camera positioning
"CAMSTREAM_X_Y_Z_RX_RY_RZ"
// Preset shots
"CAMSHOT.Default"
"CAMSHOT.Close"
"CAMSHOT.WideShot"
// View modes
"View.Desktop"
"View.Mobile"// Facial expressions
"FACE.Happy"
"FACE.Sad"
"FACE.Surprised"
// Outfits
"OF.Kimono"
"OF.SpaceSuit"
"OF.ANIME"
// Physical attributes
"SKIN_0.75"
"HAIR.Red_0.5"
"BONE.Head_1.2"// Basic animations
"ANIM.Dance"
"startspeaking"
"stopspeaking"
// Emotes
"EMOTE.Wave"
"EMOTE.Bow"
"EMOTE.Salute"// Scene levels
"LVL.Medieval"
"LVL.Orbit"
"LVL.Classroom"
// Character presets
"PRS.Masc"
"PRS.Fem"- Update
VALID_COMMAND_PATTERNSin bridge server - Add UI controls in
MannequinControls.tsx - Implement corresponding logic in Unreal Engine
- Test end-to-end functionality
- WebSocket bridge supports custom command patterns
- Frontend components are modular and extensible
- Unreal Engine TCP handler can be extended
- Livepeer streaming supports custom configurations
Bridge Connection Failed
- Verify bridge server is running
- Check firewall settings
- Confirm TCP server in Unreal Engine is active
Authentication Errors
- Check SECRET_KEY configuration
- Verify ALLOWED_ORIGINS includes your domain
- Ensure system time is synchronized
Streaming Issues
- Confirm Livepeer playbook ID is correct
- Check WebRTC bridge in Unreal Engine
- Try switching between WebRTC/HLS protocols
Commands Not Working
- Verify WebSocket connection is authenticated
- Check command format against patterns
- Monitor bridge server logs for errors
Enable debug logging in bridge server:
// In server.js, add:
const DEBUG = process.env.DEBUG === 'true'
if (DEBUG) console.log('Debug info:', data)- Debounce slider updates for smooth performance
- Use React.memo for expensive components
- Implement virtual scrolling for large lists
- Optimize bundle size with code splitting
- Connection pooling for TCP connections
- Memory monitoring and cleanup
- Request queuing for high traffic
- Load balancing for multiple instances
- Adjust video quality based on connection
- Implement adaptive bitrate streaming
- Use CDN for global distribution
- Monitor latency and adjust protocols
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
- Follow TypeScript best practices
- Add proper error handling
- Write tests for new features
- Update documentation
- Maintain backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
- Unreal Engine 5.5 - 3D rendering and character system
- Livepeer - Ultra-low latency streaming infrastructure
- Next.js - React framework for production
- WebSocket - Real-time communication protocol
- Tailwind CSS - Utility-first CSS framework
- 📧 Email: support@mannequin.app
- 💬 Discord: Mannequin Community
- 📖 Documentation: docs.mannequin.app
- 🐛 Issues: GitHub Issues
Built with ❤️ for interactive 3D experiences