static void Main(string[] args) { ServerEngine server = null; try { server = new ServerEngine(); } catch (Exception e) { Utils.Log("Server error: " + e); Console.ReadKey(); Environment.Exit(0); } try { server.Run(); } catch (Exception e) { Utils.Log("Server error: " + e); return; } Console.ReadKey(); }
public void Run() { #if DRAW_SERVER var visualEngine = new ServerEngine(this); PhysicsWorld = new PhysicsWorld(visualEngine); PhysicsWorld.GenerateMapCollidersFromFile(AvailableMapConfigs.BasicMap); visualEngine.Run(); #else PhysicsWorld = new PhysicsWorld(); PhysicsWorld.GenerateMapCollidersFromFile(AvailableMapConfigs.BasicMap); var stopwatch = new Stopwatch(); stopwatch.Start(); var timeLastFrame = stopwatch.ElapsedMilliseconds; while (true) { // Get delta time var timeThisFrame = stopwatch.ElapsedMilliseconds; var deltaTime = (timeThisFrame - timeLastFrame) * .001; timeLastFrame = timeThisFrame; //Update Network Manager ServerNetworkManager.Update(); // Update physics simulation. PhysicsWorld.UpdateStep(deltaTime);//TODO: this might not work. } #endif }