3.8 KiB
3.8 KiB
Network Mode Selection Guide
New Features
1. Network Mode Dropdown (PC Only)
On PC builds, you'll now see a dropdown in the main menu:
- ENet (PC/LAN): Traditional IP-based networking for PC players
- WebRTC (Browser/Web): Web-compatible networking using room codes
The dropdown is automatically hidden on web builds (WebRTC is auto-selected).
2. --webrtc Command Line Flag
Force WebRTC mode on PC builds:
# Start as host with WebRTC
godot --path . -- --host --webrtc
# Join with WebRTC
godot --path . -- --join --webrtc --address=ABC123
# Example with room code
godot --path . -- --join --webrtc --address=XYZ789
Usage Examples
PC to PC (Same LAN) - ENet Mode
PC 1 (Host):
- Select "ENet (PC/LAN)" in dropdown
- Click "Host Game"
- Note your IP (e.g., 192.168.1.100)
PC 2 (Join):
- Select "ENet (PC/LAN)" in dropdown
- Enter host IP in "Server Address"
- Click "Join Game"
PC to PC (Internet) - WebRTC Mode
PC 1 (Host):
- Select "WebRTC (Browser/Web)" in dropdown
- Click "Host Game"
- Share the 6-character room code (e.g., "ABC123")
PC 2 (Join):
- Select "WebRTC (Browser/Web)" in dropdown
- Enter room code in "Server Address"
- Click "Join Game"
PC to Browser - WebRTC Mode
PC (Host):
- Select "WebRTC (Browser/Web)" in dropdown
- Click "Host Game"
- Share room code
Browser (Join):
- Enter room code (WebRTC auto-detected)
- Click "Join Game"
Browser to Browser - WebRTC Mode
Browser 1 (Host):
- Click "Host Game"
- Share room code
Browser 2 (Join):
- Enter room code
- Click "Join Game"
Command Line Examples
Test with WebRTC
# Terminal 1 - Host with WebRTC
godot --path . -- --host --webrtc
# Terminal 2 - Join with WebRTC (room code from Terminal 1)
godot --path . -- --join --webrtc --address=ABC123
Test with ENet (Default)
# Terminal 1 - Host
godot --path . -- --host
# Terminal 2 - Join
godot --path . -- --join --address=127.0.0.1
Test with Multiple Local Players
# Host with 2 local players using WebRTC
godot --path . -- --host --webrtc --players=2
# Join with 2 local players
godot --path . -- --join --webrtc --address=ABC123 --players=2
When to Use Each Mode
Use ENet When:
- Playing on same LAN (local network)
- Both players are on PC (Windows/Linux/Mac)
- You want lower latency
- You have direct network access
Use WebRTC When:
- Playing over the internet (through NATs/firewalls)
- Playing with browser users
- Playing on mobile browsers
- You want easy room code sharing (no IP addresses)
Technical Details
ENet
- Protocol: UDP
- Connection: Direct IP:Port
- Latency: Lower (direct connection)
- NAT Traversal: Requires port forwarding
- Compatibility: PC only
WebRTC
- Protocol: UDP/DTLS via WebRTC
- Connection: Room codes via signaling server
- Latency: Slightly higher (STUN/relay)
- NAT Traversal: Automatic (STUN/TURN)
- Compatibility: PC, Browser, Mobile
Your Servers
- Matchbox Signaling:
ws://ruinborn.thefirstboss.com:3536 - STUN Server:
stun:ruinborn.thefirstboss.com:3578
Troubleshooting
Dropdown not visible:
- This is normal on web builds (WebRTC auto-selected)
Can't connect in ENet mode:
- Check firewall (port 21212)
- Verify IP address is correct
- Try WebRTC mode instead
Can't connect in WebRTC mode:
- Verify room code matches exactly
- Check matchbox server is running
- Try ENet mode for LAN play
Room code not showing:
- Only shown in console when hosting with WebRTC
- Will be displayed in UI in future updates
Future Improvements
- Display room code in UI (not just console)
- Copy room code to clipboard button
- Lobby browser (see active rooms)
- Remember last used network mode
- Auto-detect best mode for connection