Changes to validation of catchupThreshold - NetworkTransform2k - NetworkTransformBase (#2853)

* Changes to validation of catchupThreshold.

catchupThreshold needs to be at least 4, or it will interfere/conflict with checking if we have at least 3 old enough buffers. Catchup will decrease buffer while check needs at least 3 older.
catchupThreshold should also at least be bufferTimeMultiplier + 2, to take into account of the first 2 snapshots which is used for interpolation, before trying to implement catch up.

* Changes to validation of catchupThreshold - NetworkTransform2k - NetworkTransformBase

catchupThreshold needs to be at least 4, or it will interfere/conflict with checking if we have at least 3 old enough buffers. Catchup will decrease buffer while check needs at least 3 older.
catchupThreshold should also at least be bufferTimeMultiplier + 2, to take into account of the first 2 snapshots which is used for interpolation, before trying to implement catch up.

* Changes to validation of catchupThreshold - NetworkTransform2k - NetworkTransformBase

catchUpThreshold should be a minimum of bufferTimeMultiplier + 3, to prevent clashes with SnapshotInterpolation looking for at least 3 old enough buffers, else catch up will be implemented while there is not enough old buffers, and will result in jitter.

* Update NetworkTransformBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
This commit is contained in:
ninjakickja 2021-08-10 14:25:37 +08:00 committed by GitHub
parent 79c9d2cc6a
commit ae622bfa57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -453,7 +453,13 @@ protected virtual void OnValidate()
// make sure that catchup threshold is > buffer multiplier.
// for a buffer multiplier of '3', we usually have at _least_ 3
// buffered snapshots. often 4-5 even.
catchupThreshold = Mathf.Max(bufferTimeMultiplier + 1, catchupThreshold);
//
// catchUpThreshold should be a minimum of bufferTimeMultiplier + 3,
// to prevent clashes with SnapshotInterpolation looking for at least
// 3 old enough buffers, else catch up will be implemented while there
// is not enough old buffers, and will result in jitter.
// (validated with several real world tests by ninja & imer)
catchupThreshold = Mathf.Max(bufferTimeMultiplier + 3, catchupThreshold);
// buffer limit should be at least multiplier to have enough in there
bufferSizeLimit = Mathf.Max(bufferTimeMultiplier, bufferSizeLimit);