Skip to content
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

fix: networktransform double lerp (MTTB-539) #3337

Open
wants to merge 46 commits into
base: develop-2.0.0
Choose a base branch
from

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Mar 5, 2025

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.
    image
    image
    image
    image
  • 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
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 (wip)

Some additional updates... still having a hard time getting a single lerp pass without some form of slight jitter.
This includes a temporary 2nd pass lerp that still allows for the buffered item value to be completely reached.
Simplifying the new direction and getting all tests to pass.
(still needs a smoother transition between buffered items when not finished interpolating from a previous one)
 adding some needed comments
Still work in progress. Needs some clean up, but it is looking promising.
The base.OnUpdate is not needed here.
WIP:
Smooth dampening seems to be working better than any interpolation approach. Still have a minor timing issue, but I believe can be solved....much closer to a more resilient "interpolator".
Time systems related updates
NetworkTransform and BufferedLinearInterpolator related updates.
Minor fixes for recent changes.
some clean up from wip.
Fixing PVP issues.
Adding XML API documentation to some new NetworkTransform properties.
More PVP fun
More and more PVP fun.
Missed two PVP issues.
Adding Lerp and SmoothDampening to TestFixutres.
Putting some things back and realized I should adhere to the original buffered linear interpolator logic/pattern when using Lerp for interpolation to assure there is no impact on users with this update.
Made an adjustment to the InterpolatorTests.TestUpdatingInterpolatorWithNoData,.
Also fixed the two tests that were disabled due to no extrapolation.
Minor fix for an issue when dividing up the smooth damp and lerp buffer consumption.
Made some more adjustments as well as added a predicted smooth dampened value to help with smoothing and to get closer to the target value on the non-authority side.
Updated the Quaternion's Approximation to use the dot product instead.
Fixing a bug with one of the tests  (evidently was not caught  using the previous BLI)
Some fixes for the one test that was failing and more TestFixture additions.
Not sure why these two SetState lerp interpolation tests are having issues as it passes in the editor but fails at runtime... most likely a timing related issue.
Clearing out the 2nd rate of change.
Adding delay for the end of the last test in NetworkTransformGeneral.
Seeing if this fixes the issue.
Minor adjustment to smooth dampening.
adding xml api documentation, tooltips, and some editor adjustments.
removing white space
Adding updates to resolve PVP issues for NetworkTransform.
Fixing the remainder of the PVP issues within the components area.
Fixing minor text issues with the newly added XML API documentation.
Putting back the T Update(float deltaTime, NetworkTime serverTime) method and marking it as being deprectated.
Adding a smooth dampening pass to the NestedNetworkTransformTests.
adding change log entries
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review March 6, 2025 19:16
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner March 6, 2025 19:16
Adding additional comment on the max delta time calculation.
Fixing some xml api text issues.
Making sure we are clearing the interpolator when reaching the maximum boundary.
Adding indentions to the new NetworkTransform inspector view properties grouping.
Moving the property field draw method into the NetcodeEditorBase  class in case we wanted to expose it at a later date and/or want to use it for another I-view control.
@danni-lu danni-lu self-assigned this Mar 7, 2025
@danni-lu danni-lu self-requested a review March 7, 2025 17:50
Adding final touches to the UI updates for the NetworkTransformEditor.
Also did a PVP pass for all of the editor related classes.
Fixing some access permissions and sorting through what we are ready to release as a public API.
Some more adjustments to permissions and some final clean up of BufferedLinearInterpolator<T>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants