-
Notifications
You must be signed in to change notification settings - Fork 213
update: NetworkTransform SmoothDampening Updates #1443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
update: NetworkTransform SmoothDampening Updates #1443
Conversation
This PR fixes the issue with double lerping by providing two types of interpolators to select from while also exposing the `MaximumInterpolationTime` for each respective interpolator type. Smooth Dampening is added as an alternative to using lerp for each respective interpolator (position, rotation, and scale). This PR includes a few new additions: - Additional updates to the inspector view which allows for interpolator type selection and if available additional properties associated with the interpolator.     - A new `NetworkTimeSystem.TickLatency` property that provides the average latency of a client. - An new `NetworkTime.FixedDeltaTimeAsDouble` property that returns a `double` version of the `NetworkTime.FixedDeltaTime`. This PR also starts the deprecation process for `BufferedLinearInterpolator<T>.Update(float deltaTime, NetworkTime serverTime)` as this method is only for internal testing purposes. [MTTB-539](https://jira.unity3d.com/browse/MTTB-539) [MTT-11338](https://jira.unity3d.com/browse/MTT-11338) -- Fixing disabled tests fix: #3112 close: #3112 ## Changelog - Added: Interpolator types as an inspector view selection for position, rotation, and scale. - Added: A new smooth dampening interpolator type that provides a nice balance between precision and smoothing results. - Added: `NetworkTimeSystem.TickLatency` property that provides the average latency of a client. - Fixed: Issue where the `MaximumInterpolationTime` could not be modified from within the inspector view or runtime. - Changed: `BufferedLinearInterpolator<T>.Update(float deltaTime, NetworkTime serverTime)` as being deprecated since this method is only used for internal testing purposes. ## Testing and Documentation - Includes integration test updates: - `InterpolatorTests` was updated to changes and two disabled tests were refactored and re-enabled. - `NetworkTransformGeneral` includes additional TestFixture passes using Smooth Dampening. - `NetworktTransformTests` includes additional TestFixture passes using Smooth Dampening. - `NestedNetworkTransformTests` includes additional TestFixture passes using Smooth Dampening. - Includes updates and additions to public documentation ([PR-1443](Unity-Technologies/com.unity.multiplayer.docs#1443)) <!-- Uncomment and mark items off with a * if this PR deprecates any API: ### Deprecated API - [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter yyyy-mm-dd)` entry. - [ ] An [api updater] was added. - [ ] Deprecation of the API is explained in the CHANGELOG. - [ ] The users can understand why this API was removed and what they should use instead. -->
Just lemme know when you want me to look at this 👍 |
…tps://github.com/Unity-Technologies/com.unity.multiplayer.docs into update/networktransform-smooth-dampening-updates
…#3355) After doing some testing I noticed a few anomalies with the updated `BufferedLinearInterpolator<T>`. As it turns out, there are more than one approaches a user might need depending upon what they are trying to accomplish and each option really performs best when tweaking some properties within the `BufferedLinearInterpolator<T>` that were not completely exposed. ### Various options: - You might want to enable, disable, or adjust the maximum interpolation time of the last smooth lerp phase for each interpolator type. - You might want to manually adjust the tick latency offset (`NetworkTransform.InterpolationBufferTickOffset`) used depending upon context. - When using a client-server topology, you might want this to be set to something like 0 or 1 (depending upon interpolator). - You might want this value to be higher (like say +2-3 depending on latency and interpolation type) on non-authority instances where the authority is some other client and not the host/server. ### This PR renames `Lerp` to `LegacyLerp` and adds a 3rd new `Lerp` interpolator type: #### Lerp (new) Uses a 1 to 2 phase approach that lerps towards the target, lerps towards the next target (if one exists) ahead by 1 frame delta, blends the two results, and (optionally) smooth the final value. - The first phase lerps towards the current tick state update being processed. - The fourth phase (optional) performs a lerp smoothing where the current respective transform value is lerped towards the result of the first phase at a rate of 1.0f minus the max interpolation time. ## Changelog - Added: `Lerp` interpolation type that still uses a lerp approach but uses the new buffer consumption logic. - Added: Property to enable or disable lerp smoothing for position, rotation, and scale interpolators. - Added: `NetworkTransform.InterpolationBufferTickOffset` static property to provide users with a way to increase or decrease the time marker where interpolators will pull state update from the queue. - Fixed: Issue where the time delta that interpolators used would not be properly updated during multiple fixed update invocations within the same player loop frame. - Changed: The original `Lerp` to be renamed to `LegacyLerp`. ## Testing and Documentation - Includes integration test updates. - Includes documentation for public API entry points. - Includes updates to public documentation for `NetworkTransform`. (Will be adding to [PR-1443](Unity-Technologies/com.unity.multiplayer.docs#1443)) <!-- Uncomment and mark items off with a * if this PR deprecates any API: ### Deprecated API - [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter yyyy-mm-dd)` entry. - [ ] An [api updater] was added. - [ ] Deprecation of the API is explained in the CHANGELOG. - [ ] The users can understand why this API was removed and what they should use instead. --> --------- Co-authored-by: Emma <emma.mcmillan@unity3d.com>
Adding In Local Space to list of properties that cause a full synch
Adding links to the properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, sorry that took so long 😓 That was a long page!
I've reviewed the whole thing top to bottom, usual language/grammar/formatting pass. There's a lot here, and it might be worth breaking up a bit more in the future, but for now I think we should just get these changes out.
@NoelStephensUnity Merge at will! I'll get it published once you do.
Select the type of change:
Purpose of the Pull Request:
This includes
NetworkTransform
updates based on PR-3337 as well as some updates to the over-allNetworkTransform
documentaiton.This also includes additional updates to NetworkTransform in general.