-
Notifications
You must be signed in to change notification settings - Fork 450
refactor: Remove SIPTransport and replace it with UnityTransport #1870
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
Fixed issue with ConnectionApprovalHandler's prefab getting destroyed when a client was disconnected. Applied same fix to the NetcodeIntegrationTest when creating a prefab. Also fixing issue with NetworkManager spewing spam messages if the NetworkConfig.ConnectionApproval is set but there is no ConnectionApprovalCallback assigned. Adjusted it to make sure it is either the Server or Host that this applies to, but not a client.
Switching to UnityTransport exposed a potential bug where the server disconnects a client while the client is still processing a SceneEventType.Synchronize message which by the time the client processes this it has already sent the SceneEventType.SynchronizeComplete message back to the server that *could* attempt to send a resynchronization message where the MessageSystem will crash because the m_SendQueues entry for the now disconnected client no longer exists.
Added some additional UnityTransport settings for payload size, send queue size, and reducing the connection attempts and time out to connect per attempt. Added the ability to specify whether you want the server or clients to be instantiated first (see comments under NetcodeIntegrationTest.m_CreateServerFirst for further explanation).
Removing UNet and just using UTP. Reducing the timeout period so it doesn't take over 60 seconds to timeout.
Fixes timing issues with this test that is causing it to not passing when using UTP.
Fixed timing issues exposed when using UTP.
This fixes an issue when I originally switched it to be the server as the default NetworkManager to be instantiated when using NetcodeIntegrationTestHelper.Create. This sets the, recently updated NetcodeIntegrationTest m_CreateServerFirst, clients to instantiate before the server (needed for in-scene objects)
This test requires the clients to be instantiated before the server.
// Check to see if the client needs to resynchronize and before sending the message make sure the client is still connected to avoid | ||
// a potential crash within the MessageSystem (i.e. sending to a client that no longer exists) | ||
if (sceneEventData.ClientNeedsReSynchronization() && !DisableReSynchronization && m_NetworkManager.ConnectedClients.ContainsKey(clientId)) |
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.
/// <summary> | ||
/// Set this to false to create the clients first. | ||
/// Note: If you are using scene placed NetworkObjects or doing any form of scene testing and | ||
/// get prefab hash id "soft synchronization" errors, then set this to false and run your test | ||
/// again. This is a work-around until we can resolve some issues with NetworkManagerOwner and | ||
/// NetworkManager.Singleton. | ||
/// </summary> |
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.
do you mind elaborating a little more? what's going on here?
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.
Its a little complicated, but it has to do with our integration tests running in the same thread, how we populate newly loaded (not yet "spawned") in-scene placed NetworkObjects, and NetworkObject.NetworkManager referencing NetworkManager.Singleton if NetworkObject.NetworkManagerOwner is null.
- Same Thread: In several places we check to make sure the NetworkObject.NetworkManager is the "right one" for the NetworkManager context (i.e. NetworkObject.NetworkManager == NetworkManager)
- Populating In-Scene Objects: This checks to make sure the NetworkSceneManager.m_NetworkManager is the same as the NetworkObject.NetworkManager before adding it to the ScenePlacedObjects list.
- Default NetworkManager: This happens to be NetworkManager.Singleton that is set upon the first NetworkManager being instantiated.
So, under some conditions you might want NetworkManager.Singleton to be the server and under other conditions you might want it to be a client. If you are loading a scene with in-scene placed NetworkObjects, then you will want the NetworkManager.Singleton to be the first client instantiated in order to properly synchronize/find the in-scene placed NetworkObjects (which are loaded by the server and not loaded by the client since they share the same scene space).
If you want more details feel free to DM me in slack... really we need to handle in-scene placed NetworkObjects better... like that "pre-rfc" document outlines.
var allHandlersDestroyed = false; | ||
var waitForTick = new WaitForSeconds(1.0f / m_ServerNetworkManager.NetworkConfig.TickRate); | ||
|
||
while (!(allHandlersSpawned && clientCountReached && allHandlersDestroyed)) |
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'd add @ShadauxCat as a reviewer to review changes around these tests.
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.
(just in case)
This resolves the issues with tools integration tests and switching over to UnityTransport.
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.
lgtm 🚀
Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
the time out was never yielding and causing issues on PS4/
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'm fine with the changes in the tests integration stuff as well as whatever may touch the tools.
This removes the SIPTransport from our integration tests and replaces it with UnityTransport.
This includes several integration test refactors, and some minor fixes to bugs that were not detected under SIPTransport.
MTT-3016
Changelog
Testing and Documentation