/// <summary> /// Reconciliate the client with the server data /// </summary> private void Reconciliate() { if (reconciliationInfoList.Count() > 0) { //Get the position of the client at this specific frame SyncMessageModel clientInfo = reconciliationInfoList.Where(i => i.serverTick == lastReceivedMessage.serverTick).FirstOrDefault(); //If there is more than 50 tick that the ball has not been updated depending to the server position if (reconciliationInfoList.Count() > 50) { piece.x = lastReceivedMessage.x; piece.y = lastReceivedMessage.y; clientTick = lastReceivedMessage.serverTick; clientInfo = lastReceivedMessage; } if (!Equals(clientInfo, null)) { //Check for position divergence if (!Equals(clientInfo.x, lastReceivedMessage.x)) { //Update data piece.x = lastReceivedMessage.x; board.SetPieceLocation(piece, piece.x, piece.y); } if (!Equals(clientInfo.y, lastReceivedMessage.y)) { //Update data piece.y = lastReceivedMessage.y; board.SetPieceLocation(piece, piece.x, piece.y); } //Empty the list reconciliationInfoList.Clear(); } } }