// Initialize performance monitoring document.addEventListener('DOMContentLoaded', () => { if (window.PerformanceOptimizer) { window.PerformanceOptimizer.initializeMonitoring(); // Run performance audit after page load window.addEventListener('load', () => { setTimeout(() => { window.PerformanceOptimizer.runPerformanceAudit(); }, 1000); }); } // Initialize multiplayer systems if (window.MultiplayerUI) { window.MultiplayerUI.initializeMultiplayer(); } }); // Multiplayer tab handler window.handleMultiplayerTab = function() { // First switch to the multiplayer tab if (window.switchCockpitTab) { window.switchCockpitTab('multiplayer'); } // Then show the multiplayer UI if (window.MultiplayerUI) { window.MultiplayerUI.showMatchmaking(); } else { // Show loading state in the tab content const container = document.getElementById('multiplayer-ui-container'); if (container) { container.innerHTML = `
The real-time combat and matchmaking systems are initializing.
Please wait while we establish connections to the multiplayer servers.
Failed to initialize multiplayer systems. Please refresh the page and try again.
Initializing multiplayer systems...
Setting up real-time connections and combat engine
Initializing interaction mechanics...