Exemplo n.º 1
0
        internal void SightTick()
        {
            if (m_SceneState != SceneState.Sleeping)
            {
                TimeSnapshot.DoCheckPoint();
                //移动版本不需要计算视野
                //NOTE: sight manager 必须放在movementsystem之后,它需要等待玩家的碰撞形状wordposition更新

                /*
                 * if (IsAllPlayerEntered()) {
                 * if (IsPvpScene) {
                 *  m_SightManager.Tick();
                 * } else {
                 *  for (LinkedListNode<UserInfo> node = UserManager.Users.FirstValue; null != node; node = node.Next) {
                 *    UserInfo user = node.Value;
                 *    if (null != user) {
                 *      user.CurBlueCanSeeMe = true;
                 *      user.CurRedCanSeeMe = true;
                 *    }
                 *  }
                 *  for (LinkedListNode<NpcInfo> node = NpcManager.Npcs.FirstValue; null != node; node = node.Next) {
                 *    NpcInfo npc = node.Value;
                 *    if (null != npc) {
                 *      npc.CurBlueCanSeeMe = true;
                 *      npc.CurRedCanSeeMe = true;
                 *    }
                 *  }
                 * }
                 * }
                 * if (IsPvpScene && IsAllPlayerEntered()) {
                 * TickSight();
                 * }
                 */
                m_SceneProfiler.SightTickTime = TimeSnapshot.DoCheckPoint();
            }
        }
Exemplo n.º 2
0
        /**
         * @brief 逻辑循环
         */
        public void Tick()
        {
            TimeSnapshot.Start();
            TimeSnapshot.DoCheckPoint();
            if (m_CurScene == null || !m_CurScene.IsSuccessEnter)
            {
                return;
            }
            m_Profiler.sceneTickTime = TimeSnapshot.DoCheckPoint();

            EntityManager.Instance.Tick();
            m_Profiler.entityMgrTickTime = TimeSnapshot.DoCheckPoint();

            ControlSystem.Instance.Tick();
            m_Profiler.controlSystemTickTime = TimeSnapshot.DoCheckPoint();

            m_Profiler.movementSystemTickTime = TimeSnapshot.DoCheckPoint();

            m_SpatialSystem.Tick();
            m_Profiler.spatialSystemTickTime = TimeSnapshot.DoCheckPoint();
            if (m_Profiler.spatialSystemTickTime > 50000)
            {
                LogSystem.Warn("*** SpatialSystem tick time is {0}", m_Profiler.spatialSystemTickTime);
                for (LinkedListNode <UserInfo> node = UserManager.Users.FirstValue; null != node; node = node.Next)
                {
                    UserInfo userInfo = node.Value;
                    if (null != userInfo)
                    {
                        LogSystem.Warn("===>User:{0} Pos:{1}", userInfo.GetId(), userInfo.GetMovementStateInfo().GetPosition3D().ToString());
                    }
                }
                for (LinkedListNode <NpcInfo> node = NpcManager.Npcs.FirstValue; null != node; node = node.Next)
                {
                    NpcInfo npcInfo = node.Value;
                    if (null != npcInfo)
                    {
                        LogSystem.Warn("===>Npc:{0} Pos:{1}", npcInfo.GetId(), npcInfo.GetMovementStateInfo().GetPosition3D().ToString());
                    }
                }
            }

            m_AiSystem.Tick();
            m_Profiler.aiSystemTickTime = TimeSnapshot.DoCheckPoint();

            //obj特殊逻辑处理
            TickUsers();
            m_Profiler.usersTickTime = TimeSnapshot.DoCheckPoint();

            TickNpcs();
            m_Profiler.npcsTickTime = TimeSnapshot.DoCheckPoint();

            try {
                TickSystemByCharacters();
            } catch (Exception e) {
                GfxSystem.GfxLog("Exception:{0}\n{1}", e.Message, e.StackTrace);
            }
            m_Profiler.combatSystemTickTime = TimeSnapshot.DoCheckPoint();

            if (IsPveScene())
            {
                TickPve();
            }

            long tickTime = TimeSnapshot.End();

            if (tickTime > 100000)
            {
                LogSystem.Debug("*** PerformanceWarning: {0}", m_Profiler.GenerateLogString(tickTime));
            }
        }
Exemplo n.º 3
0
        private void TickRunning()
        {
            TimeSnapshot.DoCheckPoint();

            m_ServerDelayActionProcessor.HandleActions(100);
            m_SceneProfiler.DelayActionProcessorTime = TimeSnapshot.DoCheckPoint();

            m_ControlSystemOperation.Tick();
            m_MovementSystem.Tick();
            m_SceneProfiler.MovementSystemTime = TimeSnapshot.DoCheckPoint();

            m_SpatialSystem.Tick();
            m_SceneProfiler.SpatialSystemTime = TimeSnapshot.DoCheckPoint();

            m_AiSystem.Tick();
            m_SceneProfiler.AiSystemTime = TimeSnapshot.DoCheckPoint();

            m_SceneLogicSystem.Tick();
            m_SceneProfiler.SceneLogicSystemTime = TimeSnapshot.DoCheckPoint();

            m_StorySystem.Tick();
            m_GmStorySystem.Tick();
            m_SceneProfiler.StorySystemTime = TimeSnapshot.DoCheckPoint();

            //技能逻辑Tick
            TickSkill();
            m_SceneProfiler.TickSkillTime = TimeSnapshot.DoCheckPoint();

            //obj特殊状态处理(如死亡,重生等)
            TickUsers();
            m_SceneProfiler.TickUsersTime = TimeSnapshot.DoCheckPoint();

            TickNpcs();
            m_SceneProfiler.TickNpcsTime = TimeSnapshot.DoCheckPoint();

            TickLevelup();
            m_SceneProfiler.TickLevelupTime = TimeSnapshot.DoCheckPoint();

            //属性回复
            if (0 == m_LastTickTimeForTickPerSecond)
            {
                m_LastTickTimeForTickPerSecond = TimeUtility.GetServerMilliseconds();
                TickRecover();
                TickBlindage();
            }
            else
            {
                long curTime = TimeUtility.GetServerMilliseconds();
                if (curTime > m_LastTickTimeForTickPerSecond + c_IntervalPerSecond)
                {
                    m_LastTickTimeForTickPerSecond = curTime;
                    TickRecover();
                    TickBlindage();
                }
            }
            m_SceneProfiler.TickAttrRecoverTime = TimeSnapshot.DoCheckPoint();

            //空间信息调试
            TickDebugSpaceInfo();
            m_SceneProfiler.TickDebugSpaceInfoTime = TimeSnapshot.DoCheckPoint();
        }