Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Quick start script for RTS Game | |
| """ | |
| import subprocess | |
| import sys | |
| import os | |
| def main(): | |
| print("๐ฎ RTS Commander - Quick Start") | |
| print("=" * 50) | |
| print() | |
| # Check if we're in the correct directory | |
| if not os.path.exists('app.py'): | |
| print("โ Error: app.py not found!") | |
| print("Please run this script from the web/ directory") | |
| sys.exit(1) | |
| # Check if static files exist | |
| required_files = ['static/index.html', 'static/styles.css', 'static/game.js'] | |
| for file in required_files: | |
| if not os.path.exists(file): | |
| print(f"โ Error: {file} not found!") | |
| sys.exit(1) | |
| print("โ All required files found") | |
| print() | |
| # Install dependencies | |
| print("๐ฆ Installing dependencies...") | |
| try: | |
| subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-r", "requirements.txt"], check=True) | |
| print("โ Dependencies installed") | |
| except subprocess.CalledProcessError: | |
| print("โ Failed to install dependencies") | |
| sys.exit(1) | |
| print() | |
| print("๐ Starting RTS Game Server...") | |
| print() | |
| print("๐ Server will be available at:") | |
| print(" http://localhost:7860") | |
| print() | |
| print("๐ก MCP server available at:") | |
| print(" http://localhost:8001") | |
| print(" (For AI integration via Model Context Protocol)") | |
| print() | |
| print("๐ก To start only the MCP server (for testing):") | |
| print(" python start_mcp_only.py") | |
| print() | |
| print("Press Ctrl+C to stop the server") | |
| print() | |
| # Start uvicorn server | |
| try: | |
| subprocess.run([ | |
| sys.executable, "-m", "uvicorn", | |
| "app:app", | |
| "--host", "0.0.0.0", | |
| "--port", "7860", | |
| "--reload" | |
| ]) | |
| except KeyboardInterrupt: | |
| print("\n\n๐ Server stopped. Thanks for playing!") | |
| except FileNotFoundError: | |
| print("โ uvicorn not found. Installing...") | |
| subprocess.run([sys.executable, "-m", "pip", "install", "uvicorn[standard]"]) | |
| print("Please run this script again.") | |
| if __name__ == "__main__": | |
| main() | |