feat: Unified Netcode POC migration#3963
Conversation
…/v2-x-x/ngo-and-n4e
This is a "still messy" version that is working but needs more thought on the namespace collision fixes.
Adding support within NetworkPrefabs and NetworkPrefab to handle the registration of hybrid spawned objects (i.e. no more hacky-way of registering). Moving the hybrid spawn registration into the Start method of the NetworkObject to provide time for everything to run through Awake. Added some script (defined out) that was helping to debug why NetworkObject was being disabled sometimes (moving the initialization to Start resolved the issue).
Issue with AnimatorOverrideController not being handled which could cause improper processing of the animator's layers and parameters. Issue with clients sending state changes from the NetworkAnimatorStateChangeHandler due to added HasAuthority check. When using a server authoritative animation model, owner Clients should still be able to send trigger updates to the server.
Migrated the unique world setup into this branch. The world is created prior to starting NetworkManager completely. When using hybrid prefabs (i.e. mixed mode), the final portion of the NetworkManager's start logic (i.e. endpoint connection, etc.) is not invoked until the hybrid prefabs have been registered. Hybrid prefabs wait until the World is finished starting/being initialized.
Added an experimental "NetworkObjectBridge" icon (programmer art alert). Added some additional script to handle moving the GhostAdapter and NetworkObject bridge to the top of the GameObject's components where GhostAdapter is first and then NetworkObjectBridge is 2nd. Removed silly code to get the root transform.
This update is the first pass to making ChildNetworkBehaviours a table keyed off of the NetworkBehahviour identifiers. This allows for the removal of a NetworkBehaviour without it impacting the remaining NetworkBehaviours. This could most likely be optimized by generating the initial table ahead of time on each prefab. In-scene placed that are not registered prefabs would need to do this upon being instantiated.
Fixing test project not being able to load without an AnalyticsTests compilation error. Making ObjectNameIdentifier just use the new way we handle ChildNetworkBehaviours (i.e. it is a table now). Marking NetworkObject.ChildNetworkBehaviours comment above as having finished the migration to a table. Noting we should find a better place/way to initialize this stuff.
…ithub.com/Unity-Technologies/com.unity.netcode.gameobjects into experimental/v3-x-x/unified-poc-migration
Cleaning up some areas. Wrapping all of the original network prefab unified work where NGO handles the timing for hybrid prefab registration. (We might remove this prior to release but keeping it for reference purposes in case there are changes on N4E side that require us to use the original approach) Fixing issue with not removing Rigidbody on clients automatically. (for now until we can make it an opt-in)
Fixing some style related issues. Updating the UnifiedBootstrap comment.
* Fix DontDestroyOnLoadTest * [MTT-14843] Refactor sending and receiving of N4E RPCs in UnifiedNetcodeTransport to not use entities (#3943) Refactor sending and receiving of RPCs to not use entities, thereby preserving send/receive order without having to encode an order value and reorder messages on the receive side. * Post-merge fixes * Fix remaining errors. * Revert unnecessary change from bad merge. * Accidentally deleted a line.
Removing all trailing spaces from UnifiedNetcodeTransport.
…fabs.cs Co-authored-by: Emma <emma.mcmillan@unity3d.com>
| { | ||
| m_GhostsPendingSynchronization.Remove(networkObjectId); | ||
| m_GhostsArePendingSynchronization = m_GhostsPendingSynchronization.Count > 0; | ||
| ghostPendingSync.Buffer.Dispose(); |
There was a problem hiding this comment.
It looks like it might be worth making the PendingGhostSpawnEntry struct disposable so that the buffer is easier to dispose. (I can't find where the type is defined to leave a comment there).
There was a problem hiding this comment.
Moved PendingGhostSpawnEntry from SceneEventData into this file (at the end).
Updated this to just be ghostPendingSync.Dispose();.
👍
| if (m_GhostsPendingSpawn.ContainsKey(networkObjectId)) | ||
| { | ||
| // Process it, but don't remove it as we handle that a little later | ||
| ProcessGhostPendingSynchronization(ghost.Value.SerializedObject.NetworkObjectId, false); |
There was a problem hiding this comment.
Does this mean we're processing the ghost twice?
There was a problem hiding this comment.
m_GhostSynchronizationPendingRemoval is used just below (starting at line 185) where we remove it from m_GhostsPendingSynchronization and dispose any FastBufferReader associated with the entry. The FastBufferReader is created when ShouldDeferGhostSceneObject is invoked by SceneEventData.
| // Current Fix: | ||
| // If the client is not yet synchronized, then any ghost pending spawn get migrated into the DDOL. | ||
| // | ||
| // Further review: |
There was a problem hiding this comment.
It might be worth making a JIRA ticket to track this, or at least having it in our tracking spreadsheet.
Co-authored-by: Emma <emma.mcmillan@unity3d.com>
…nifiedNetworkTransformTest.cs Co-authored-by: Emma <emma.mcmillan@unity3d.com>
(Not ready for merge but setting it to review for testing purposes)
Purpose of this PR
This PR contains the remaining unified (wip) migrates it into the next major version for NGO.
Jira ticket
MTT-14623
Changelog
NA (base develop-3.x.x branch creation)
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?If any boxes above are checked the QA team will be automatically added as a PR reviewer.
Backports
No back porting needed since this is for v3.x.x.