File size: 1,896 Bytes
12d64f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/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("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()