Server sleep time is slightly smarter + loading debug messages

This commit is contained in:
juanjp600
2017-06-22 00:24:30 -03:00
parent 6b65e94d41
commit c1780fa7b7
4 changed files with 12 additions and 3 deletions
+8 -2
View File
@@ -100,14 +100,20 @@ namespace Barotrauma
NetLobbyScreen = new NetLobbyScreen();
Server = new GameServer("Dedicated Server Test", 14242, false, "asd", false, 10);
DateTime prevTime = DateTime.Now;
while (true)
{
prevTime = DateTime.Now;
DebugConsole.Update();
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
Server.Update((float)Timing.Step);
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
Thread.Sleep((int)(Timing.Step * 1000.0));
int frameTime = DateTime.Now.Subtract(prevTime).Milliseconds;
Thread.Sleep(Math.Max((int)(Timing.Step * 1000.0) - frameTime,0));
}
}