Skip to content

feat: Non-deterministic debug simulator in UnityTransport [MTT-4592] #2196

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
merged 3 commits into from
Sep 13, 2022

Conversation

simon-lemay-unity
Copy link
Contributor

Unlike what the code seemed to imply, setting the random seed to 0 in the simulator pipeline stage parameters would not result in its value being determined non-deterministically. It would just pick a hardcoded constant instead.

This PR makes the default seed value be Stopwatch.GetMilliseconds, while preserving the ability to hardcode a constant for testing purposes. Having a non-deterministic simulator is preferable to a deterministic one, since it better represents the behavior of real networks.

Changelog

  • Changed: The debug simulator in UnityTransport is now non-deterministic. Its random number generator used to be seeded with a constant value, leading to the same pattern of packet drops, delays, and jitter in every run.

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

@simon-lemay-unity simon-lemay-unity requested review from a team as code owners September 12, 2022 20:49
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@simon-lemay-unity simon-lemay-unity enabled auto-merge (squash) September 13, 2022 14:41
@simon-lemay-unity simon-lemay-unity merged commit f34ded4 into develop Sep 13, 2022
@simon-lemay-unity simon-lemay-unity deleted the feat/non-deterministic-simulator branch September 13, 2022 15:30
jakobbbb pushed a commit to GooseGirlGames/com.unity.netcode.gameobjects that referenced this pull request Feb 22, 2023
…nity-Technologies#2196)

* feat: Non-deterministic debug simulator in UnityTransport [MTT-4592]

* Add PR number to CHANGELOG entry
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