public void MergeWithBuffer() { lock (userCommandBufferList) { // TODO work out why some User Commands are null // it works for now tho for (int i = userCommandBufferList.Count - 1; i >= 0; i--) { if (userCommandBufferList[i] == null) { userCommandBufferList.RemoveAt(i); } else { jitter.Update(userCommandBufferList[i].serverRecTime - lastRecTime); lastRecTime = userCommandBufferList[i].serverRecTime; } } userCommandList.AddRange(userCommandBufferList); userCommandBufferList.Clear(); } userCommandList.Sort((a, b) => a.serverRecTime.CompareTo(b.serverRecTime)); // DEBUG Jitter //Debug.Log(jitter.stdDeviation + ", " + jitter.average); }
public void UpdateRtt(int _rtt) { m_currentRtt = _rtt; // Updating the public variables if (m_currentRtt > 0) { rtt.Update(Mathf.Min(m_currentRtt, 999)); } // Update avg rtt m_avgRtt = rtt.average; // Update min rtt m_minRtt = rtt.min; // Update max rtt m_maxRtt = rtt.max; }
public void AppendNewSnapshot(WorldState snapshot) { lock (snapshotBuffer) { snapshotBuffer.Add(snapshot); float deltaTime = (NowInTicks - lastReceiveTime) / (float)this.m_FrequencyMS; jitter.Update(deltaTime); lastReceiveTime = NowInTicks; //Debug.Log("AVG: " + jitter.average + " stdDeviation: " + jitter.stdDeviation); if (snapshotGap >= snapshotBuffer.Count - 2) { Reset(); } else { snapshotGap++; } } }
private void Update() { // Actual Fps Calculation unscaledDeltaTime = Time.unscaledDeltaTime; // Update fps and ms m_currentFps = 1 / unscaledDeltaTime; // End Actual Fps Calculation // Updating the public variables if (m_currentFps > 0) { fps.Update(Mathf.Min(m_currentFps, 999)); } // Update avg fps m_avgFps = fps.average; // Update min fps m_minFps = fps.min; // Update max fps m_maxFps = fps.max; }
public void Update(float value) { graph.Update(value - previousValue); previousValue = value; }