Networking & Multiplayer
Build multiplayer 3D web experiences with shared state, voice chat, and real-time synchronization.
Needle Engine includes a full networking solution for multiplayer experiences. Shared world state, voice chat, session persistence, and more can be achieved with our networking components and APIs.
Quick Start
Get your first multiplayer scene running in 5 minutes:
- Add a
SyncedRoomcomponent to your scene - Add
SyncedTransformto an object - Add
DragControlsto make it interactive - Open in two browser windows and drag the object!
Follow the complete setup guide →
What Can You Build?
- Collaborative Spaces - Multiple users exploring and interacting together
- Multiplayer Games - Real-time games with synchronized state
- Virtual Meetings - Persistent meeting spaces with voice chat
- Interactive Experiences - Shared AR/VR experiences across devices
- Collaborative Design - Real-time 3D design collaboration
Choose Your Path
🎯 First Time with Networking?
Start with the basics:
- Enable Networking - Add multiplayer to your project (5 min)
- Sync Component State - Use
@syncFieldfor automatic networking - Understanding Networking - Learn how it works
🔧 Building Something Specific?
Jump to practical guides:
- Sync Component State - Automatic networking with
@syncField - Manual Networking - Send and receive custom messages
- Host Your Own Server - Deploy custom networking infrastructure
📚 Want to Understand How It Works?
Learn the concepts:
- Networking Architecture - Rooms, ownership, and state
- Message Types - JSON vs Binary (Flatbuffers)
- WebRTC for Voice - How voice chat works
📖 Looking for Reference?
Find specific information:
- Networking Events - Complete event reference
- Built-in Components - Networking component catalog
- API Documentation - TypeScript API docs
Built-in Networking Components
| Component | Description |
|---|---|
SyncedRoom | Handles networking connection and room management |
SyncedTransform | Synchronizes object transforms (position, rotation, scale) |
SyncedCamera | Spawns a prefab for each user showing their viewpoint |
VoIP | Voice-over-IP audio connections between users |
ScreenCapture | Screen sharing via web APIs - Example |
Networking | Customize server backend URL or use local server |
DragControls | Drag objects with automatic ownership transfer |
Duplicatable | Duplicate objects across the network |
Deletable | Delete objects across the network |
DeleteBox | Delete objects when dragged into a volume |
PlayerSync | Instantiate an object for each connected player |
PlayerState | Component for objects instantiated by PlayerSync |
PlayerColor | Assign each user a random color |
WebXR | Synchronize VR/AR avatars (hands and heads) |
Default Networking Infrastructure
By default, Needle scenes connect to cloud infrastructure managed by Needle:
- ✅ No additional setup needed
- ✅ Currently no additional cost
- ✅ Works fine for 15-20 concurrent users per room
- ✅ Perfect for prototyping and small deployments
For production or larger deployments, you can host your own server.
Common Questions
How many users can connect?
Default servers: Around 15-20 concurrent users per room works well.
Custom servers: Scalable to hundreds or thousands of users depending on your infrastructure.
Is voice chat included?
Yes! Use the VoIP component for voice chat and the ScreenCapture component for screen sharing. Both use WebRTC (peer.js) for direct peer-to-peer connections.
Can I use my own server?
Absolutely! The networking server is available as an NPM package and can be deployed anywhere. See Custom Servers for details.
How is state persisted?
Room state is automatically saved on the server as JSON. When new users join, they receive the current state. You can configure storage to use disk (default) or S3-compatible services.
Can I send custom messages?
Yes! Use manual networking for complete control over messages. You can send JSON or binary (Flatbuffer) messages with custom data.
How-To Guides
Setup & Basics:
- Enable Networking - Add multiplayer to your project
- Sync Component State - Use
@syncFielddecorator
Advanced:
- Manual Networking - Send custom messages
- Host Your Own Server - Deploy custom infrastructure
Learn More
Understanding:
- Networking Architecture - How networking works
- Built-in Components - Component catalog
Reference:
- Networking Events - Complete event reference
- API Documentation - TypeScript API
Resources:
- Networking Package - NPM package
- Local Server Setup - Development server
Next Steps
- Enable Networking - Get started with your first multiplayer scene
- Sync Component State - Learn automatic networking
- Understanding Networking - Learn the concepts