Example #1
0
 public void ReportReplicatedObjects()
 {
     if (VRage.Profiler.MyRenderProfiler.ProfilerVisible)
     {
         ProfilerShort.Begin("ReportReplicatedObjects (only when profiler visible)");
         ReplicationLayer.ReportReplicatedObjects();
         ProfilerShort.End();
     }
 }
Example #2
0
        public virtual void Tick()
        {
            FrameCounter++;

            if (MyFakes.ENABLE_MULTIPLAYER_CONSTRAINT_COMPENSATION && IsServer && FrameCounter % 2 == 0)
            {
                MySyncGlobal.SendSimulationInfo();
            }

            if (IsServer && (MySession.Static.ElapsedGameTime - m_lastSentTimeTimestamp).Seconds > 30)
            {
                m_lastSentTimeTimestamp = MySession.Static.ElapsedGameTime;
                MySyncGlobal.SendElapsedGameTime();
            }

            int currentTotalTime = MySandboxGame.TotalTimeInMilliseconds;

            if (currentTotalTime - m_lastKickUpdate > 20000)
            {
                m_tmpClientList.Clear();
                foreach (var client in m_kickedClients.Keys)
                {
                    m_tmpClientList.Add(client);
                }

                foreach (var client in m_tmpClientList)
                {
                    if (currentTotalTime - m_kickedClients[client] > KICK_TIMEOUT_MS)
                    {
                        m_kickedClients.Remove(client);
                    }
                }
                m_tmpClientList.Clear();

                m_lastKickUpdate = currentTotalTime;
            }

            ReplicationLayer.Update();
            if (VRageRender.Profiler.MyRenderProfiler.ProfilerVisible)
            {
                ReplicationLayer.ReportReplicatedObjects();
            }

            // TODO: Remove
            //if (IsServer)
            //{
            //    SendServerPhysicsUpdate();
            //}

            Sync.Layer.TransportLayer.Tick();

            VRage.Trace.MyTrace.Send(VRage.Trace.TraceWindow.Multiplayer, "============ Frame end ============");
            NetProfiler.Commit();
        }