#!/bin/bash
# Easy Multiplayer Testing Script for Linux/Mac
# This script launches 3 instances: 1 host and 2 clients

echo "Starting Multiplayer Test..."
echo ""

# Set your Godot executable path here
GODOT_PATH="godot"  # Assumes godot is in PATH, otherwise use full path like "/usr/bin/godot"

# Set your project path
PROJECT_PATH="$(pwd)"

# Check if Godot exists
if ! command -v $GODOT_PATH &> /dev/null; then
    echo "Error: Godot not found. Please install Godot or set GODOT_PATH correctly."
    exit 1
fi

echo "[1/3] Starting HOST..."
$GODOT_PATH --path "$PROJECT_PATH" -- --host &

# Wait a bit for host to start
sleep 2

echo "[2/3] Starting CLIENT 1..."
$GODOT_PATH --path "$PROJECT_PATH" -- --join &

# Wait a bit
sleep 1

echo "[3/3] Starting CLIENT 2..."
$GODOT_PATH --path "$PROJECT_PATH" -- --join &

echo ""
echo "All instances launched!"
echo "- 1 Host"
echo "- 2 Clients"
echo ""
echo "Press Ctrl+C to exit..."
wait

