|
|
|
"""
|
|
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)
|
|
|
|
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...")
|
|
|
|
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...")
|
|
|
|
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()
|
|
|
|
|
|
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...")
|
|
|
|
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()
|
|
|