Example #1
0
        public void ReceiveDeltaSyncFrame(DeltaSyncFrame frame)
        {
            logger.Debug("ReceiveDeltaSyncFrame: {0}", frame);

            var currentSnapshot = CreateSnapshot();

            var lastTimepoint = authoritativeTimeline.Last;

            if (lastTimepoint.Time != frame.Time)
            {
                throw new InvalidOperationException();       //TODO: Message
            }
            RecoverSnapshot((SimulatorSnapshot)lastTimepoint.Snapshot);

            ApplyEvents(frame.Events);

            var snapshot = CreateSnapshot();

            authoritativeTimeline.AddPoint(frame.Time + frame.DeltaTime, snapshot);

            int lastCommandSeq;

            if (frame.LastCommandSeqs.TryGetValue(clientId, out lastCommandSeq))
            {
                lastAcknowledgedCommandSeq = lastCommandSeq;
            }

            RecoverSnapshot(currentSnapshot);

            CurrentStats.LastAcknowledgedCommandSeq = lastAcknowledgedCommandSeq;
            CurrentStats.ReceivedSyncFrameTime      = frame.Time;
            CurrentStats.ReceivedSyncFrameDeltaTime = frame.DeltaTime;
        }
Example #2
0
 private void OnServerMessage_DeltaSyncFrame(NetIncomingMessage msg, DeltaSyncFrame message)
 {
     simulator.ReceiveDeltaSyncFrame(message);
 }