Exemple #1
0
        /// <summary>
        /// Updates everything related to network and game logic.
        /// </summary>
        public void UpdateNetworkAndLogic(GameTime svTime)
        {
                        #if DEBUG
            netServer.Configuration.SimulatedLoss           = game.Network.SimulatePacketsLoss;
            netServer.Configuration.SimulatedMinimumLatency = game.Network.SimulateMinLatency;
            netServer.Configuration.SimulatedRandomLatency  = game.Network.SimulateRandomLatency;
                        #endif

            //	read input messages :
            DispatchIM(svTime, netServer);

            //	update frame and get snapshot :
            serverInstance.Update(svTime);

            //	send snapshot to clients :
            DispatchSnapshots(netServer, svTime.Total.Ticks);

            //	send notifications to clients :
            SendNotifications(netServer);

            //	execute server's command queue :
            game.Invoker.ExecuteQueue(svTime, CommandAffinity.Server);

            //	crash test for server :
            CrashServer.CrashTest();
            FreezeServer.FreezeTest();
            SlowdownServer.SlowTest();
        }