File size: 2,931 Bytes
4c75d73 |
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 67 68 69 70 71 72 73 74 75 76 77 |
#!/usr/bin/env python3
"""
Live Demo of Enhanced MMORPG Features
=====================================
This script demonstrates all the enhanced features in a live scenario.
"""
import requests
import json
import time
from src.core.game_engine import GameEngine
def demo_enhanced_features():
print("🎮 Live Demo: Enhanced MMORPG Features")
print("=" * 50)
# Initialize game engine and facades
engine = GameEngine()
from src.facades.game_facade import GameFacade
from src.ui.huggingface_ui import HuggingFaceUI
from src.ui.interface_manager import InterfaceManager
game_facade = GameFacade()
ui = HuggingFaceUI(game_facade)
interface_manager = InterfaceManager(game_facade, ui)
print("1. Joining game as DemoPlayer...")
# Simulate joining game
interface_manager._handle_join_game("demo-player-001", "DemoPlayer")
print(f" Current Player ID: {interface_manager.current_player_id}")
print("\n2. Adding additional players for demo...")
# Add more players to show multi-player features
game_facade.join_game("Alice")
game_facade.join_game("Bob")
print(f" Total players in world: {len(game_facade.get_all_players())}")
print("\n3. Generating enhanced world HTML...")
world_html = interface_manager._generate_world_html_with_players()
# Check for enhanced features
features_found = {
"Player Glow": "border: 2px solid yellow" in world_html,
"Player Names": "player-name" in world_html,
"Status Line": "status-line" in world_html,
"Z-Index Layering": "z-index" in world_html,
"Dynamic Content": str(len(game_facade.get_all_players())) in world_html
}
print("\n4. Enhanced Features Status:")
for feature, found in features_found.items():
status = "✅" if found else "❌"
print(f" {status} {feature}")
print("\n5. Sample HTML Output (first 500 chars):")
print("-" * 50)
print(world_html[:500] + "...")
print("-" * 50)
print("\n6. Testing keyboard controls integration...")
# Check if keyboard controls are documented in status line
has_controls_info = any(control in world_html.lower() for control in ["wasd", "arrow", "move"])
print(f" Keyboard controls info: {'✅ Present' if has_controls_info else '❌ Missing'}")
print("\n7. Testing current player cleanup...")
interface_manager._handle_leave_game()
print(f" Current Player ID after leave: {interface_manager.current_player_id}")
print("\n" + "=" * 50)
print("🎉 Enhanced Features Demo Complete!")
print("🌐 Application running at: http://localhost:7860")
print("🎮 Features: Player Glow, Names, Status Line, Keyboard Controls")
print("=" * 50)
if __name__ == "__main__":
demo_enhanced_features()
|