-
Notifications
You must be signed in to change notification settings - Fork 450
feat: Unity Transport + Relay #887
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
Conversation
wip still waiting on some packages to be published.
Relay SDK stuff
Pushing latest
updating UTP to preview 5 with Relay ping support fixing issue with endpoint
Some cleanup
cleanup
In order to use Relay for this transport you need to install the package into your project its no longer a dependcy
* update to relay sdk v0.0.1-preview.5 * remove workarounds - use byte array representation of allocation id - connection data truncation is not longer needed - set default relay endpoint as production * updated auth to v0.5.0 - updated core and authentication versions - updated relay version (compatible with latest core) - updated authentication calls
C# Guid convertion to byte array is not compatbile with relay, intead we can use the byte array provided by the relay sdk
MLAPI appears to expect Connect events on servers when new clients connect (at least this is what's implemented in SIPTransport). UTP doesn't generate Connect events server-side, so we must generate them ourselves when accepting connections.
* Add some basic UTPTranport tests * Implement OnDestroy in UTPTransport The implementation is the same as Shutdown, meaning it only disposes of the driver (if not already disposed of). The driver (!) for this change is to avoid leaking resources when tests fail. * Add connection tests for UTPTransport * Add basic data transmission tests for UTPTransport
* Correctly handle empty messages in Send The UTPTransport.Send method would throw a NullReferenceException exception when passed default(ArraySegment<byte>) as the message data. Now it simply sends an empty message to its remote host (not a terribly useful feature, but better than an exception). * Make it possible to receive messages >1024 bytes The fragmentation pipeline was set up to handle messages up to 6KB in length, but the receive buffer was only 1KB long. Messages longer than that were just ignored (although an error message was logged). * Add proper support for channels in UTPTransport The transport now selects an appropriate pipeline according to the delivery level of the channel, rather than send everything on the default unreliable pipeline.
* DST-528: Extracted Relay SDK calls out of UTP adapter for MLAPI; it now accepts a variable passed in via a setter method. Also updated the sample test project included to illustrate these changes. * DST-528: Made some changes that address feedback comments; mainly restructured the manner that code external to UTPTransport passes in the requisite relay server data so that external code doesn't need to know about the internal data structures that UTPTransport uses. * DST-528: Removing minor changes that were erroneously left in when taking other approaches.
com.unity.netcode.adapter.utp/Runtime/com.unity.netcode.adapter.utp.asmdef
Outdated
Show resolved
Hide resolved
m_EditorVersion: 2020.3.12f1 | ||
m_EditorVersionWithRevision: 2020.3.12f1 (b3b2c6512326) | ||
m_EditorVersion: 2020.3.15f2 | ||
m_EditorVersionWithRevision: 2020.3.15f2 (6cf78cb77498) |
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.
unnecessary?
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.
I mean personally I think the project should always be on the latest version of the LTS :P but that is just me. which would be .18 :P I me right now with PR triggers we aren't even testing on 2020.3 which I find also wrong.
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.
nightly runs on various platforms and versions at least, but yeah 2020.3 baseline for PRs might be more useful, I'm not sure
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.
Well seeing as how its the min version for the package it should run on it :P I mean for UTP we run on 2020.3/2021.2/trunk across all desktop platforms for PRs because more often then I would like to admit stuff breaks across unity versions. I think we should at least make sure PRs work with the min version.
projectName: | ||
organizationId: | ||
projectName: relay-stg | ||
organizationId: relay-stg |
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.
not needed?
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.
Yes, those values are for the cloud services related stuff since we did add relay testing to the project. So for internal testing that is what they need to be, if public devs want to mess around with things this value will automatically get updated with their services info when they login to their services uDash. So for us yes its required.
|
||
InitDriver(); | ||
|
||
if (m_Driver.Bind(NetworkEndPoint.AnyIpv4) != 0) |
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.
Is IPv6 supported by the adapter? If so, might want to choose between this and AnyIpv6
depending on the address family of serverEndpoint
.
Alternatively, I don't think there's any need to bind on the client side. Could remove this entirely.
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.
We do support IPv6 in the transport but I don't think we support it currently in the adapter.
As for binding the protocol can bind which in this case we use for Relay
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.
I will add a ticket to support IPV6 to the transport API in general.
…on't delay the queued messages by another tick
Connected, | ||
} | ||
|
||
public const int MaximumMessageLength = 6 * 1024; |
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.
where this number is coming from?
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.
Boss Room :( It is still configurable in the serialized field.
com.unity.netcode.adapter.utp/Tests/Editor/UTPTransportTests.cs
Outdated
Show resolved
Hide resolved
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.
some naming nits but apart from that, looks good to me!
(UTP -> UnityTransport & NGO -> Netcode)
…nsform * develop: feat: NetworkBehaviour.IsSpawned (#1190) feat: added tip to the network manager inspector that directs to install tools (MTT-1211) (#1182) refactor!: remove network dictionary & set, use native container in List, add tests (#1149) fix: Fixed remote disconnects not properly cleaning up (#1184) test: base changes to PR-1114 (#1165) test: verify do not destroy networkobjects on networkmanager shutdown (#1183) chore: removal of EnableNetworkVariable in NetworkConfig. It's always True now (#1179) fix: Fix DontDestroyWithOwner not returning ownership (#1181) test: Giving Android some more room as the connection tests are timing sensitive (#1178) fix: unitytransport connectionmode buttons (#1176) test: added min frames to multi-instance helper (#1170) chore: Add mobile tests to nightly trigger (#1161) feat: snapshot spawn pre-requisite (#1166) feat: Unity Transport + Relay (#887) feat: client scene synchronization mode (#1171) # Conflicts: # testproject/Assets/Scenes/SampleScene.unity
* Adding support for UTP/Unity Relay in Netcode for GameObjects Co-authored-by: Andrew Spiering <aspiering@gmail.com> Co-authored-by: Andrew Spiering <andrews@unity3d.com> Co-authored-by: Fernando Galandrini <fernando.galandrini@gmail.com> Co-authored-by: Iurii Zakipnyi <jura.zakipniy@gmail.com> Co-authored-by: Fernando Galandrini <fernando.galandrini@unity3d.com> Co-authored-by: Simon Lemay <simon.lemay@unity3d.com> Co-authored-by: thoward-unity <87874023+thoward-unity@users.noreply.github.com> Co-authored-by: Cosmin <cosmin.bararu@unity3d.com>
This PR adds support for using the Unity Transport package as a transport for MLAPI.