예제 #1
0
        public override void DoHandle(int messageType, Snapshot messageBody)
        {
            if (_first)
            {
                _first = false;
                _logger.InfoFormat("received first snapshot time{0}, seq {1}", messageBody.ServerTime, messageBody.SnapshotSeq);
            }


//                _logger.ErrorFormat("received snapshot seq {0}, simTime {3}, entity count {1}, self {2} ",
//                    messageBody.SnapshotSeq,
//                    messageBody.EntityMap.Count,
//                    messageBody.Self,
//                    messageBody.VehicleSimulationTime);


            if (_timeManager.RenderTime - messageBody.ServerTime > 0)
            {
                _logger.InfoFormat("The client render time {0} advances received server time {1}.",
                                   _timeManager.RenderTime, messageBody.ServerTime);
            }

            _updateLatestHandler.BaseUserCmdSeq = messageBody.LastUserCmdSeq;
            _updateLatestHandler.LastSnapshotId = messageBody.SnapshotSeq;
            _pool.AddSnapshot(messageBody);
        }
예제 #2
0
        public void CompensationSnapshot()
        {
            var       sessionObjects        = _contexts.session.serverSessionObjects;
            int       snapshotSeq           = sessionObjects.GetNextSnapshotSeq();
            int       vehicleSimulationTime = sessionObjects.SimulationTimer.CurrentTime;
            int       serverTime            = _contexts.session.currentTimeObject.CurrentTime;
            ISnapshot compensationSnapshot  = _snapshotFactory.GenerateCompensationSnapshot();

            compensationSnapshot.ServerTime            = serverTime;
            compensationSnapshot.SnapshotSeq           = snapshotSeq;
            compensationSnapshot.VehicleSimulationTime = vehicleSimulationTime;
            _compensationSnapshotPool.AddSnapshot(compensationSnapshot);
            compensationSnapshot.ReleaseReference();
        }