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

refactor: move UTP integration into NGO, delete UTP Adapter package #1823

Merged
merged 15 commits into from
Mar 23, 2022

Conversation

0xFA11
Copy link
Contributor

@0xFA11 0xFA11 commented Mar 23, 2022

With this PR, we're removing com.unity.netcode.adapter.utp package entirely and moving its contents into the package directly. This makes the package depend on com.unity.transport package directly, also allows us to present UTP as our default, 1st-party supported transport in post-UNET world (2022+).

MTT-2884

Changelog

  • Added UnityTransport implementation and com.unity.transport package dependency

Testing and Documentation

  • Moved existing Editor and Runtime tests from UTP Adapter package into the package


<!-- Add JIRA link here. Short version (e.g. MTT-123) also works and gets auto-linked. -->

<!-- Add RFC link here if applicable. -->

## Changelog

### com.unity.netcode.gameobjects
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed section separation since there is no other package under this repo anymore

@@ -1,11 +0,0 @@
{
"name": "com.unity.netcode.adapter.utp",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think deleting this package would mean something on UDash/Operate side too.
We should update that catalog thing we maintain for online dashboards people use via Unity Cloud Services site @ashwinimurt

Copy link
Contributor

Choose a reason for hiding this comment

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

yes there is, I will do a PR there and add you.

Comment on lines -41 to -42
- name: com.unity.netcode.adapter.utp
path: com.unity.netcode.adapter.utp
Copy link
Contributor Author

Choose a reason for hiding this comment

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

less work on Yamato, faster CI, faster PRs!

Comment on lines 666 to 671
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
ExtractNetworkMetrics();
if (NetworkManager)
{
ExtractNetworkMetrics();
}
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is an additional change, not just a copy-paste from UTP Adapter package.
UnityTransportTests & UnityTransportConnectionTests don't necessarily require a NetworkManager instance to be there, they were working just fine.
however, ExtractNetworkMetrics(); requires one and there won't be a NetworkManager during these tests.
there are tests running with ExtractNetworkMetrics(); and NetworkManager present but this fix basically disables ExtractNetworkMetrics(); call in UnityTransportTests & UnityTransportConnectionTests only which I think is totally fine but just wanted to mention here. @becksebenius-unity @simon-lemay-unity

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks fine to me. Makes sense in that context. I am not concerned about it.

@0xFA11 0xFA11 marked this pull request as ready for review March 23, 2022 12:26
@0xFA11 0xFA11 requested review from lpmaurice and a team as code owners March 23, 2022 12:26
Copy link
Contributor

@simon-lemay-unity simon-lemay-unity 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 to me! My only concern is not with the change itself, but how it will have to be handled by users. If someone already has the adapter package installed, when they update to this version of NGO, will things break? Assuming things do break, does it break in a way where it's pretty obvious what they need to do to fix the issue?

@@ -109,9 +110,7 @@ public bool OnVerifyCanReceive(ulong senderId, Type messageType)
public enum InstanceTransport
{
SIP,
#if UTP_ADAPTER
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes me so happy :D

Comment on lines 666 to 671
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
ExtractNetworkMetrics();
if (NetworkManager)
{
ExtractNetworkMetrics();
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks fine to me. Makes sense in that context. I am not concerned about it.

@wackoisgod
Copy link
Contributor

While I think this is a reasonable change.... is there any concern at the fact that now you will have to release a new package any time UTP needs to be updated? One of the nice things about having the other package was if you needed to update UTP you could and you didn't pull in any changes for NGO as they were separated.

@simon-lemay-unity I agree with this concern because essentially you can install both packages independently of each other which means I could install a newer version of NGO that has UTP, and then install the other package and they will both install as long as they are API compatible and then potentially cause compiler errors. What I would recommend doing is actually adding some editor checks to see which version of NGO you are using and if you are using a version that has this change in it and you have the old package installed then remove it. You can use the package manager API for this... This is similar to what Unity is doing for the IL2CPP Cross compiler package except its uninstalling instead of installing.

I would also work to get the package marked as deprecated in the manifest.json file for an editor release because that will just remove the package if its present.

@0xFA11
Copy link
Contributor Author

0xFA11 commented Mar 23, 2022

While I think this is a reasonable change.... is there any concern at the fact that now you will have to release a new package any time UTP needs to be updated? One of the nice things about having the other package was if you needed to update UTP you could and you didn't pull in any changes for NGO as they were separated.

yes, this is expected and we're OK with that. if we want to fix UTP <-> NGO integration, that'll happen underneath NGO. also, if we want to upgrade UTP version, that also will happen in a minor NGO version release.

@simon-lemay-unity I agree with this concern because essentially you can install both packages independently of each other which means I could install a newer version of NGO that has UTP, and then install the other package and they will both install as long as they are API compatible and then potentially cause compiler errors. What I would recommend doing is actually adding some editor checks to see which version of NGO you are using and if you are using a version that has this change in it and you have the old package installed then remove it. You can use the package manager API for this... This is similar to what Unity is doing for the IL2CPP Cross compiler package except its uninstalling instead of installing.

as we briefly discussed, it does make sense to implement an editor code to remove UTP Adapter package automatically if present in the project. (for the reference: PackageManager.Client). I'll implement and update the PR shortly.

I would also work to get the package marked as deprecated in the manifest.json file for an editor release because that will just remove the package if its present.

yeah, I think we need to mark UTP Adapter as deprecated and people should not be able to search/discover it. I'll follow-up on that internally too.

thank you @wackoisgod :)

@@ -10,3 +10,4 @@
[assembly: InternalsVisibleTo("TestProject.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.Netcode.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.Netcode.TestHelpers.Runtime")]
[assembly: InternalsVisibleTo("Unity.Netcode.Adapter.UTP")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this needed to be put back to prevent projects with UTP Adapter package installed from breaking.

@0xFA11 0xFA11 enabled auto-merge (squash) March 23, 2022 23:18
@0xFA11 0xFA11 merged commit 26dbf65 into develop Mar 23, 2022
@0xFA11 0xFA11 deleted the refactor/default-unity-transport branch March 23, 2022 23:28
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.

5 participants