Skip to content

fix: rounding issue with tick calculation #1614

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

Merged

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Jan 24, 2022

Fixing rounding issue with tick calculation.

MTT-2063

PR Checklist

  • Have you updated the changelog? Each package has a CHANGELOG.md file.

Changelog

com.unity.netcode.gameobjects

Fixed network tick value sometimes being duplicated or skipped.

Testing and Documentation

  • Includes unit test: NetworkTickAdvanceTest
  • No documentation changes or additions were necessary.

Fixing rounding issue with tick calculation.
Added tick increment test to verify that the tick value no longer has the casted integer rounding error.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review January 24, 2022 19:27
Had to do switch TestToFixedTime over to an approximated comparison due to the delta variances in the test values being used with the updated tick rounding fix.
Fixing some additional tests that appear to be taking into account the tick not being rounded.
Just testing a silly fix.
This reverts commit 74aa521.
Slight modification and reverted some test changes back to original values.
increasing maximum rounding threshold to 0.999999999999
Just trying to condense the code a little and remove the Math.Round
Removing the Math.Truncate stuff...
I think this is as condensed as it can possibly get.
Adding comment as to what the precision check is for.
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.

3 participants