-
Notifications
You must be signed in to change notification settings - Fork 455
feat: Nested NetworkBehaviour Synchronization [MTT-5024] #2298
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
feat: Nested NetworkBehaviour Synchronization [MTT-5024] #2298
Conversation
This includes the changes to provide users with a way to synchronize NetworkBehaviours with custom data prior to their associated NetworkObject is spawned. This also includes some fixes that allows for NetworkObjects to fail, NetworkVariables to fail, and NetworkBehaviour synchronization to fail without impacting the rest of the synchronization process.
An updated version of this test that includes additional tests related to the refactoring. This test was not properly testing the entire serialization pipeline and it only tested for one NetworkVariable. If you added another NetworkVariable to the NetworkBehaviourWithNetworkVariables component the synchronization process would halt. There was also a bug in SceneEventData that would occur if a NetworkObject failed to be instantiated. The updates included resolve all of these issues for the original intention behind the test.
This include a nested NetworkTransform manual test to visually validate the nested NetworkTransform update.
minor camera related updates to the nested NetworkTransform manual test.
Minor updates to some manual test assets.
fixing some minor merge issues with the byte packing updates.
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.
For the record, I have reservation around the direction and the NetworkObject nested restriction. I feel we walked pretty far away from the MLAPI design relying on NetworkVariables and RPC in a pretty uniform fashion.
That said, the PR shows thorough code, properly tested and addresses specific shortcomings. So, let's go with this, but consider marking a bit more clearly "OnSynchronize is optional and only meant to address complex cases where NetworkVariables and RPC fall short"
…ologies#2298) * feat This includes the changes to provide users with a way to synchronize NetworkBehaviours with custom data prior to their associated NetworkObject is spawned. * fix and refactor This updates NetworkTransform so that it will properly synchronize when placed on nested NetworkBehaviours (i.e. their GameObject has no NetworkObject component). This also includes some fixes that allows for NetworkObjects to fail, NetworkVariables to fail, and NetworkBehaviour synchronization to fail without impacting the rest of the synchronization process. Minor fix for in-scene placed parenting under a non-NetworkObject to prevent from being added to the orphaned child list. * test Renamed NetworkObjectSceneSerializationTests to NetworkObjectSynchronizationTests. Added a more robust/wider range of tests, also added running host or server as well as added a basic OnSynchronize test. Added integration test to validate nested network transforms synchronize properly with nested GameObjects' transforms. Fixed an issue with late joined clients not registering all players in NetcodeIntegrationTest. * test manual This include a nested NetworkTransform manual test to visually validate the nested NetworkTransform update.
This refactor provides users a way for synchronizing nested NetworkBehaviours.
It also fixes an issue with the serialization pipeline where if a NetworkObject fails to synchronize it will not halt the entire synchronization process.
MTT-5024
Associated reports of this issue:
https://discordapp.com/channels/449263083769036810/1033497351475699712/1033497351475699712
https://discordapp.com/channels/449263083769036810/1034802372880375828/1034802372880375828
Changelog
NetworkBehaviour.OnSynchronize
which is invoked during the initialNetworkObject
synchronization process. This provides users the ability to include custom serialization information that will be applied to theNetworkBehaviour
prior to theNetworkObject
being spawned.NetworkTransform
components nested under a parent with aNetworkObect
component (i.e. network prefab) would not have their associatedGameObject
's transform synchronized.NetworkObject
s that failed to instantiate could cause the entire synchronization pipeline to be disrupted/halted for a connecting client.NetworkObject
s nested under aGameObject
would be added to the orphaned children list causing continual console warning log messages.NetworkConfig.EnsureNetworkVariableLengthSafety
is disabledNetworkVariable
fields do not write the additionalushort
size value (which helps to reduce the total synchronization message size), but when enabled it still writes the additionalushort
value.Testing and Documentation