5.0 KiB
5.0 KiB
Multiplayer Testing Guide
Quick Automated Testing
I've created easy testing scripts for you!
Windows
Option 1: Use the Batch Script
# Edit TEST_MULTIPLAYER.bat and set your Godot path
# Then just double-click it or run:
TEST_MULTIPLAYER.bat
Option 2: Manual Command
# Terminal 1 (Host)
"C:\Program Files\Godot\godot.exe" --path "C:\dev\godot\multiplayer-coop" -- --host
# Terminal 2 (Client 1)
"C:\Program Files\Godot\godot.exe" --path "C:\dev\godot\multiplayer-coop" -- --join
# Terminal 3 (Client 2)
"C:\Program Files\Godot\godot.exe" --path "C:\dev\godot\multiplayer-coop" -- --join
Linux/Mac
Option 1: Use the Shell Script
# Make it executable (already done)
chmod +x TEST_MULTIPLAYER.sh
# Run it
./TEST_MULTIPLAYER.sh
Option 2: Manual Command
# Terminal 1 (Host)
godot --path "$(pwd)" -- --host
# Terminal 2 (Client 1)
godot --path "$(pwd)" -- --join
# Terminal 3 (Client 2)
godot --path "$(pwd)" -- --join
Command-Line Arguments
Basic Arguments
--host- Automatically start as host--join- Automatically join game--address=IP- Server address (default: 127.0.0.1)--players=N- Number of local players (default: 1)
Examples
Host with 2 local players:
godot --path "path/to/project" -- --host --players=2
Join specific server with 1 player:
godot --path "path/to/project" -- --join --address=192.168.1.100
Join with 3 local players:
godot --path "path/to/project" -- --join --players=3
Testing Scenarios
Scenario 1: Simple 1v1
# Instance 1
godot -- --host
# Instance 2
godot -- --join
Scenario 2: 1 Host + 2 Clients
# Instance 1
godot -- --host
# Instance 2
godot -- --join
# Instance 3
godot -- --join
Scenario 3: Multiple Local Players
# Instance 1 (host with 2 local players)
godot -- --host --players=2
# Instance 2 (client with 2 local players)
godot -- --join --players=2
Scenario 4: Maximum Chaos
# Instance 1 (host with 4 local players)
godot -- --host --players=4
# Instance 2-7 (each with 4 local players)
godot -- --join --players=4
Result: 8 machines × 4 local players = 32 total players!
From Godot Editor
You can also test from the editor:
-
Run the main instance from editor:
- Just press F5 normally
- Host or join manually from the menu
-
Run additional instances:
# From terminal, run additional instances godot --path "C:\dev\godot\multiplayer-coop" -- --join
Troubleshooting
"Connection Failed"
- Make sure host is running first
- Wait 1-2 seconds after starting host
- Check firewall settings
"Can't find godot.exe"
- Edit the .bat or .sh script
- Set the correct path to your Godot executable
- On Linux/Mac, make sure
godotis in your PATH
"Players not spawning"
- Check the console/Output tab for errors
- Verify NetworkManager is loaded
- Make sure you're using matching project versions
"Script won't run"
- Windows: Right-click .bat → Run as Administrator
- Linux/Mac: Make sure it's executable (
chmod +x TEST_MULTIPLAYER.sh)
What You Should See
When Testing Works:
- Host window opens, immediately shows game world
- Client 1 opens, connects, spawns in game world
- Client 2 opens, connects, spawns in game world
- All players visible to each other
- All players can move and interact
Debugging
- Press ESC in any instance to see debug overlay
- Shows network status, peer ID, player counts
- Check Output tab in Godot for connection logs
Performance Testing
Test Network Sync
- Start host + 2 clients
- Move players around
- Grab objects
- Throw objects
- Verify smooth sync (no jittering)
Test Stress
- Start multiple instances
- Add many local players
- Spawn many objects
- Test with rapid interactions
- Monitor FPS (press ESC for debug)
Batch Testing Tips
Quick Restart
# Windows: Create restart.bat
@echo off
taskkill /F /IM godot.exe
timeout /t 1 /nobreak
call TEST_MULTIPLAYER.bat
Different Configurations
# Test different player counts
godot -- --host --players=1
godot -- --join --players=2
godot -- --join --players=3
godot -- --join --players=4
Network Testing
# Test over network (replace IP with actual host IP)
godot -- --host # On machine 1
godot -- --join --address=192.168.1.100 # On machine 2
CI/CD Testing
You can integrate these commands into automated testing:
# Start host in background
godot --path "$PROJECT" -- --host &
HOST_PID=$!
sleep 2
# Start client
godot --path "$PROJECT" -- --join &
CLIENT_PID=$!
# Wait and cleanup
sleep 10
kill $HOST_PID $CLIENT_PID
Summary
✅ Easiest: Just run TEST_MULTIPLAYER.bat (Windows) or ./TEST_MULTIPLAYER.sh (Linux/Mac)
✅ Custom: Use command-line arguments for specific scenarios
✅ Flexible: Combine with editor for debugging
✅ Fast: No clicking through menus, instant testing!
Happy testing! 🎮