private static void ClientDeserializeUpdate(List <Snapshot> interpolationBuffer, BitBuffer buffer, int displaySeq, CommandsList clientCommands, out int commandSnapshotAck) { commandSnapshotAck = -1; var seq = buffer.GetInt(); var time = buffer.GetFloat(); var cmdSeq = buffer.GetInt(); var playerCount = buffer.GetInt(); Dictionary <int, UserState> userStates = new Dictionary <int, UserState>(); int i; for (i = 0; i < playerCount; i++) { var position = new Vector3(); var rotation = new Quaternion(); var userID = buffer.GetInt(); position.x = buffer.GetFloat(); position.y = buffer.GetFloat(); position.z = buffer.GetFloat(); rotation.w = buffer.GetFloat(); rotation.x = buffer.GetFloat(); rotation.y = buffer.GetFloat(); rotation.z = buffer.GetFloat(); userStates.Add(userID, new UserState(position, rotation)); } if (seq < displaySeq) { return; } clientCommands.SnapshotAck(cmdSeq); commandSnapshotAck = cmdSeq; Snapshot snapshot = new Snapshot(seq, time, cmdSeq, userStates); for (i = 0; i < interpolationBuffer.Count; i++) { if (interpolationBuffer[i].Seq > seq) { break; } } interpolationBuffer.Insert(i, snapshot); }