private void MainGameLoop() { DateTime time; TimeSpan spent; while (gameLoopActive) { if (gameLoopEnabled) { try { GameLoopStatus = 1; time = DateTime.Now; LowPriorityWorker.Process(); //1 query spent = DateTime.Now - time; if (spent.TotalSeconds > 3) { Console.WriteLine("Low priority Process worker took really long time to cycle!"); } GameLoopStatus = 2; time = DateTime.Now; LowPriorityWorker.ConsoleTitleWorker(); spent = DateTime.Now - time; if (spent.TotalSeconds > 3) { Console.WriteLine("Low priority ConsoleTitleWorker worker took really long time to cycle!"); } GameLoopStatus = 5; time = DateTime.Now; RoomManager.OnCycle(); // Queries for furni save spent = DateTime.Now - time; if (spent.TotalSeconds > 3) { Console.WriteLine("RoomManager.OnCycle took really long time to cycle!"); } GameLoopStatus = 6; time = DateTime.Now; ClientManager.OnCycle(); spent = DateTime.Now - time; if (spent.TotalSeconds > 3) { Console.WriteLine("ClientManager.OnCycle took really long time to cycle!"); } GameLoopStatus = 7; } catch (Exception e) { Logging.LogCriticalException("INVALID MARIO BUG IN GAME LOOP: " + e.ToString()); } GameLoopStatus = 8; } Thread.Sleep(gameLoopSleepTime); } gameLoopEnded = true; }
private void MainGameLoop() { while (gameLoopActive) { try { LowPriorityWorker.Process(); ClientManager.OnCycle(); RoomManager.OnCycle(); GroupManager.OnCycle(); AlfaManager.OnCycle(); } catch (Exception e) { Logging.LogCriticalException("[Otanix] @ Alerta de erro: ERRO MARIO INVALIDO NO LOBO DO JOGO: " + e.StackTrace + " - " + e.Message + " - " + e); } Thread.Sleep(gameLoopSleepTime); } }
private void MainGameLoop() { while (this.gameLoopActive) { try { if (gameLoopEnabled) { moduleWatch.Restart(); LowPriorityWorker.Process(); if (moduleWatch.ElapsedMilliseconds > 500) { Console.WriteLine("High latency in LowPriorityWorker.Process ({0} ms)", moduleWatch.ElapsedMilliseconds); } moduleWatch.Restart(); this._roomManager.OnCycle(moduleWatch); this._animationManager.OnCycle(moduleWatch); if (moduleWatch.ElapsedMilliseconds > 500) { Console.WriteLine("High latency in RoomManager ({0} ms)", moduleWatch.ElapsedMilliseconds); } } } catch (OperationCanceledException e) { Console.WriteLine("Canceled operation {0}", e); } Thread.Sleep(500); } this.gameLoopEnded = true; }
private void MainGameLoop() { while (gameLoopActive) { DateTime startTaskTime; TimeSpan spentTime; startTaskTime = DateTime.Now; if (gameLoopEnabled) { try { LowPriorityWorker_ended = false; RoomManagerCycle_ended = false; ClientManagerCycle_ended = false; if (FirewindEnvironment.SeparatedTasksInMainLoops != true) { GameLoopStatus = 1; LowPriorityWorker.Process(); //1 query GameLoopStatus = 5; RoomManager.OnCycle(); // Queries for furni save GameLoopStatus = 6; ClientManager.OnCycle(); GameLoopStatus = 7; //groupManager.OnCycle(); } else { if (LowPriorityWorker_task == null || LowPriorityWorker_task.IsCompleted == true) { LowPriorityWorker_task = new Task(LowPriorityWorker.Process); LowPriorityWorker_task.Start(); } if (RoomManagerCycle_task == null || RoomManagerCycle_task.IsCompleted == true) { RoomManagerCycle_task = new Task(RoomManager.OnCycle); RoomManagerCycle_task.Start(); } if (ClientManagerCycle_task == null || ClientManagerCycle_task.IsCompleted == true) { ClientManagerCycle_task = new Task(ClientManager.OnCycle); ClientManagerCycle_task.Start(); } } } catch (Exception e) { Logging.LogCriticalException("INVALID MARIO BUG IN GAME LOOP: " + e.ToString()); } GameLoopStatus = 8; } spentTime = DateTime.Now - startTaskTime; if (spentTime.TotalSeconds > 3) { Logging.LogDebug("Game.MainGameLoop spent: " + spentTime.TotalSeconds + " seconds in working."); } Thread.Sleep(gameLoopSleepTime); } }