diff --git a/docs/basics/scenemanagement/images/ClientSyncUpdates.png b/docs/basics/scenemanagement/images/ClientSyncUpdates.png deleted file mode 100644 index 9bbbe812a..000000000 Binary files a/docs/basics/scenemanagement/images/ClientSyncUpdates.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/ClientSyncUpdates_Dark.png b/docs/basics/scenemanagement/images/ClientSyncUpdates_Dark.png new file mode 100644 index 000000000..530e2b00e Binary files /dev/null and b/docs/basics/scenemanagement/images/ClientSyncUpdates_Dark.png differ diff --git a/docs/basics/scenemanagement/images/ClientSyncUpdates_Light.png b/docs/basics/scenemanagement/images/ClientSyncUpdates_Light.png new file mode 100644 index 000000000..318ef6372 Binary files /dev/null and b/docs/basics/scenemanagement/images/ClientSyncUpdates_Light.png differ diff --git a/docs/basics/scenemanagement/images/LoadNewSceneTimeline.png b/docs/basics/scenemanagement/images/LoadNewSceneTimeline.png deleted file mode 100644 index 9bb21b44c..000000000 Binary files a/docs/basics/scenemanagement/images/LoadNewSceneTimeline.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Dark.png b/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Dark.png new file mode 100644 index 000000000..e9453db2d Binary files /dev/null and b/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Dark.png differ diff --git a/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Light.png b/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Light.png new file mode 100644 index 000000000..77f39872e Binary files /dev/null and b/docs/basics/scenemanagement/images/LoadNewSceneTimeline_Light.png differ diff --git a/docs/basics/scenemanagement/images/LoadingAdditiveScene.png b/docs/basics/scenemanagement/images/LoadingAdditiveScene.png deleted file mode 100644 index 5f99a4b87..000000000 Binary files a/docs/basics/scenemanagement/images/LoadingAdditiveScene.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/LoadingAdditiveScene_Dark.png b/docs/basics/scenemanagement/images/LoadingAdditiveScene_Dark.png new file mode 100644 index 000000000..65e16cb24 Binary files /dev/null and b/docs/basics/scenemanagement/images/LoadingAdditiveScene_Dark.png differ diff --git a/docs/basics/scenemanagement/images/LoadingAdditiveScene_Light.png b/docs/basics/scenemanagement/images/LoadingAdditiveScene_Light.png new file mode 100644 index 000000000..992258ebd Binary files /dev/null and b/docs/basics/scenemanagement/images/LoadingAdditiveScene_Light.png differ diff --git a/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline.png b/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline.png deleted file mode 100644 index 153b4fe42..000000000 Binary files a/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Dark.png b/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Dark.png new file mode 100644 index 000000000..c1b44d090 Binary files /dev/null and b/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Dark.png differ diff --git a/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Light.png b/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Light.png new file mode 100644 index 000000000..fd4c0999f Binary files /dev/null and b/docs/basics/scenemanagement/images/SceneEventSynchronizationTimeline_Light.png differ diff --git a/docs/basics/scenemanagement/images/SwitchingToNewSceneLight.png b/docs/basics/scenemanagement/images/SwitchingToNewSceneLight.png deleted file mode 100644 index fad635c44..000000000 Binary files a/docs/basics/scenemanagement/images/SwitchingToNewSceneLight.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/SwitchingToNewScene_Dark.png b/docs/basics/scenemanagement/images/SwitchingToNewScene_Dark.png new file mode 100644 index 000000000..50f6f01e7 Binary files /dev/null and b/docs/basics/scenemanagement/images/SwitchingToNewScene_Dark.png differ diff --git a/docs/basics/scenemanagement/images/SwitchingToNewScene_Light.png b/docs/basics/scenemanagement/images/SwitchingToNewScene_Light.png new file mode 100644 index 000000000..3e21f77d8 Binary files /dev/null and b/docs/basics/scenemanagement/images/SwitchingToNewScene_Light.png differ diff --git a/docs/basics/scenemanagement/images/UnloadingAdditiveScene.png b/docs/basics/scenemanagement/images/UnloadingAdditiveScene.png deleted file mode 100644 index 577ee2f3c..000000000 Binary files a/docs/basics/scenemanagement/images/UnloadingAdditiveScene.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Dark.png b/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Dark.png new file mode 100644 index 000000000..f0fd5f997 Binary files /dev/null and b/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Dark.png differ diff --git a/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Light.png b/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Light.png new file mode 100644 index 000000000..8ba2d1401 Binary files /dev/null and b/docs/basics/scenemanagement/images/UnloadingAdditiveScene_Light.png differ diff --git a/docs/basics/scenemanagement/images/UnloadingSceneTimeline.png b/docs/basics/scenemanagement/images/UnloadingSceneTimeline.png deleted file mode 100644 index 8e4be2c81..000000000 Binary files a/docs/basics/scenemanagement/images/UnloadingSceneTimeline.png and /dev/null differ diff --git a/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Dark.png b/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Dark.png new file mode 100644 index 000000000..d8487e5e6 Binary files /dev/null and b/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Dark.png differ diff --git a/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Light.png b/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Light.png new file mode 100644 index 000000000..cdad36ab4 Binary files /dev/null and b/docs/basics/scenemanagement/images/UnloadingSceneTimeline_Light.png differ diff --git a/docs/basics/scenemanagement/timing-considerations.md b/docs/basics/scenemanagement/timing-considerations.md index bfbf6e6de..1c40f529c 100644 --- a/docs/basics/scenemanagement/timing-considerations.md +++ b/docs/basics/scenemanagement/timing-considerations.md @@ -18,7 +18,11 @@ In each diagram, you will see two types of black arrows: ## Client Synchronization: The below diagram, Client Synchronization Updates, steps you through the entire client synchronization process from starting the client all the way to the client being fully synchronized and connected. -![image](images/ClientSyncUpdates.png)
+
+ +
Above, we can see that the client will first send a connection request to the server that will process the request, handle the approval process via ConnectionApprovalCallback (if connection approval is enabled), and if approved the server will: - Send a connection approved message back to the client - This only means the connection is approved, but the client is not yet synchronized. @@ -45,7 +49,11 @@ Take note that after the client finishes processing the synchronization event, t ### Client-Side Synchronization Timeline Now that we have covered the high-level synchronization process, we can dive a little deeper into what happens on the client side as it processes the synchronize message. The below sub-diagram, "Scene Event Synchronization Timeline", provides you with a more detailed view of how the client processes the synchronize message: -![image](images/SceneEventSynchronizationTimeline.png) +
+ +
You can see that upon receiving the message, the client appears to be iterating over portions of the data included in the synchronize message. This is primarily the asynchronous scene loading phase of the client synchronization process. This means the more scenes loaded, the more a client will be required to load which means the Client Synchronization Period is directly proportional to the number of scene being loaded and the size of each scene being loaded. Once all scenes are loaded, the client will then locally spawn all `NetworkObject`s. As a final step, the client sends the list of all `NetworkObjectId`s it spawned as part of its `SceneEventType.SynchronizeComplete` scene event message so the server can determine if it needs to resynchronize the client with a list of any `NetworkObjects` that might have despawned during the Client Synchronization Period. ## Loading Scenes @@ -54,9 +62,11 @@ You can see that upon receiving the message, the client appears to be iterating Looking at the timeline diagram below, "Loading an Additive Scene", we can see that it includes a server, two clients, and that the server will always precede all clients when it comes to processing the scene loading event. The big-picture this diagram is conveying is that only when the server has finished loading the scene and spawning any in-scene placed `NetworkObject`s, instantiated by the newly loaded scene, will it send the scene loading event message to the clients. Another point of interest in the below diagram is how Client 1 receives the scene loading event, processes it, and then responds with a `SceneEventType.LoadComplete` scene event message before client 2. This delta between client 1 and client 2 represents the varying client-server latencies and further enforces the underlying concept behind the `SceneEventType.LoadEventCompleted` message. Once a server has received all `SceneEventType.LoadComplete` messages from the connected clients, it will then broadcast the `SceneEventType.LoadEventCompleted` message to all connected clients. At this point, we can consider the scene loading event (truly) complete and all connected clients are able to receive and process netcode messages. - -![image](images/LoadingAdditiveScene.png) - +
+ +
:::caution While a client can start sending the server messages (including NetworkVariable changes) upon local `SceneEventType.LoadComplete` event notifications, under more controlled testing environments where the network being used has very little to no latency (i.e. using loopback with multiple instances running on the same system or using your LAN), this approach will not expose latency related issues. Even though the timing might "work out" under controlled low latency conditions you could still run into edge case scenarios where if a client approaches or exceeds a 500ms RTT latency you could potentially run into issues. ::: @@ -86,7 +96,11 @@ How you load scenes is really up to your project/design requirements. - Any scenes loaded by `NetworkSceneManager`, prior to scene switching, will be unloaded and any `NetworkObject` that has the `DestroyWithScene` set to `true` will be destroyed. - If `DestroyWithScene` is set to `false` it will be "preserved" (_see the sub-diagram "Load New Scene Timeline" below_) -![image](images/SwitchingToNewSceneLight.png) +
+ +
## Load New Scene Timeline (Sub-Diagram) Both scene loading diagrams (Additive and Single) refer to the below sub-diagram that provides additional details of the scene loading process. @@ -94,7 +108,12 @@ Both scene loading diagrams (Additive and Single) refer to the below sub-diagram When looking at the below sub-diagram, both single and additive scene loading modes use close to the exact same flow with the exception that additively loaded scenes only flow through the four middle steps that are grouped together by the light red filled region highlighted by red dashed lines. When loading a scene additively, no other scenes are unloaded nor are any NetworkObjects moved into the DDoL temporarily. This setting, by default, is true for dynamically spawned `NetworkObject`s unless otherwise specified when using `NetworkObject.Spawn`, `NetworkObject.SpawnWithOwnership`, or `NetworkObject.SpawnAsPlayerObject`. In-scene placed `NetworkObject`'s, by default, will be destroyed with the scene that instantiated them. At any point, within a `NetworkBehaviour` you can change the `NetworkObject.DestroyWithScene` property. ::: -![image](images/LoadNewSceneTimeline.png) +
+ +
+ **Load New Scene Additively** 1. Starts loading the scene 2. During the scene loading process, in-scene placed `NetworkObject`s are instantiated and their `Awake` and then `Start` methods are invoked (in that order). @@ -119,7 +138,11 @@ Primarily, this applies to unloading additively loaded scenes via th `NetworkSce ### Unloading an Additive Scene If you look at the below diagram, "Unloading an Additive Scene", you will see a very similar flow as that of loading a scene. The server still initiates the `SceneEventType.Unload` scene event and will not send this message to clients until it has completed the `Unload` scene event locally. -![image](images/UnloadingAdditiveScene.png)
+
+ +
### Unloading Scenes Timeline: Review over the below diagram and take note of the following things: @@ -131,4 +154,8 @@ Review over the below diagram and take note of the following things: - While a server is unloading a scene, the client could begin to receive a bunch of despawn messages for the `NetworkObject`s being destroyed on the server-side while the scene is being unloaded. - By the time a client receives the `SceneEventType.Unload` scene event message, it very well could have no remaining `NetworkObject`s in the scene being unloaded. This will not impact the client-side scene unloading process, but it is useful to know that this will happen. -![image](images/UnloadingSceneTimeline.png) \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/static/img/sequence_diagrams/BossRoomExamples/HidingLatency_AnimationAnticipation_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/HidingLatency_AnimationAnticipation_Dark.png index aba3dd31b..46232a5f0 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/HidingLatency_AnimationAnticipation_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/HidingLatency_AnimationAnticipation_Dark.png differ diff --git a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherRangedShot_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherRangedShot_Dark.png index 1b5d7b743..f4adb77ca 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherRangedShot_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherRangedShot_Dark.png differ diff --git a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherVolley_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherVolley_Dark.png index 733fe9dd2..86aa3173f 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherVolley_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_ArcherVolley_Dark.png differ diff --git a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_MageMagicBolt_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_MageMagicBolt_Dark.png index 0953f6b98..c66a21321 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_MageMagicBolt_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_MageMagicBolt_Dark.png differ diff --git a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_PlayerEmote_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_PlayerEmote_Dark.png index 957a63f6a..7d4dd105a 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_PlayerEmote_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_PlayerEmote_Dark.png differ diff --git a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_RogueSneak_Dark.png b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_RogueSneak_Dark.png index cc8ac867c..234634a63 100644 Binary files a/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_RogueSneak_Dark.png and b/static/img/sequence_diagrams/BossRoomExamples/RPCFlowExample_RogueSneak_Dark.png differ diff --git a/static/img/sequence_diagrams/NetworkVariable/NetVarDataUpdates_Dark.png b/static/img/sequence_diagrams/NetworkVariable/NetVarDataUpdates_Dark.png index 830504a1c..4258d55c9 100644 Binary files a/static/img/sequence_diagrams/NetworkVariable/NetVarDataUpdates_Dark.png and b/static/img/sequence_diagrams/NetworkVariable/NetVarDataUpdates_Dark.png differ diff --git a/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_Dark.png b/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_Dark.png index ac6106236..b25d79ab8 100644 Binary files a/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_Dark.png and b/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_Dark.png differ diff --git a/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_LateJoinClient_Dark.png b/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_LateJoinClient_Dark.png index 107868ee8..5e1c8571a 100644 Binary files a/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_LateJoinClient_Dark.png and b/static/img/sequence_diagrams/NetworkVariable/NetworkVariables_LateJoinClient_Dark.png differ diff --git a/static/img/sequence_diagrams/NetworkVariableVSRPCs/ManagingNetVarData_RPCs_Dark.png b/static/img/sequence_diagrams/NetworkVariableVSRPCs/ManagingNetVarData_RPCs_Dark.png index 1cc241a76..d7e85fbc3 100644 Binary files a/static/img/sequence_diagrams/NetworkVariableVSRPCs/ManagingNetVarData_RPCs_Dark.png and b/static/img/sequence_diagrams/NetworkVariableVSRPCs/ManagingNetVarData_RPCs_Dark.png differ diff --git a/static/img/sequence_diagrams/NetworkVariableVSRPCs/RPCsLateJoin_Dark.png b/static/img/sequence_diagrams/NetworkVariableVSRPCs/RPCsLateJoin_Dark.png index 932e1a538..dce87c8c1 100644 Binary files a/static/img/sequence_diagrams/NetworkVariableVSRPCs/RPCsLateJoin_Dark.png and b/static/img/sequence_diagrams/NetworkVariableVSRPCs/RPCsLateJoin_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ClientRPCs_CertainClients_Dark.png b/static/img/sequence_diagrams/RPCs/ClientRPCs_CertainClients_Dark.png index da7bf543c..9fe63b237 100644 Binary files a/static/img/sequence_diagrams/RPCs/ClientRPCs_CertainClients_Dark.png and b/static/img/sequence_diagrams/RPCs/ClientRPCs_CertainClients_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ClientRPCs_ClientHosts_CalledByClientHost_Dark.png b/static/img/sequence_diagrams/RPCs/ClientRPCs_ClientHosts_CalledByClientHost_Dark.png index 25a9148e6..2c89420b2 100644 Binary files a/static/img/sequence_diagrams/RPCs/ClientRPCs_ClientHosts_CalledByClientHost_Dark.png and b/static/img/sequence_diagrams/RPCs/ClientRPCs_ClientHosts_CalledByClientHost_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark .png b/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark .png deleted file mode 100644 index 009faaf28..000000000 Binary files a/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark .png and /dev/null differ diff --git a/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark.png b/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark.png index 5528b9d28..c1c42f781 100644 Binary files a/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark.png and b/static/img/sequence_diagrams/RPCs/ClientRPCs_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClientHost_Dark.png b/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClientHost_Dark.png index f98eb951b..12ebabd68 100644 Binary files a/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClientHost_Dark.png and b/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClientHost_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClient_Dark.png b/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClient_Dark.png index fbecf85af..89e738a71 100644 Binary files a/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClient_Dark.png and b/static/img/sequence_diagrams/RPCs/ServerRPCs_ClientHosts_CalledByClient_Dark.png differ diff --git a/static/img/sequence_diagrams/RPCs/ServerRPCs_Dark.png b/static/img/sequence_diagrams/RPCs/ServerRPCs_Dark.png index 130016643..01f8a02da 100644 Binary files a/static/img/sequence_diagrams/RPCs/ServerRPCs_Dark.png and b/static/img/sequence_diagrams/RPCs/ServerRPCs_Dark.png differ diff --git a/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart1_ClientAuthorityIssue_Dark.png b/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart1_ClientAuthorityIssue_Dark.png index 2aec58593..7b6552a8f 100644 Binary files a/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart1_ClientAuthorityIssue_Dark.png and b/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart1_ClientAuthorityIssue_Dark.png differ diff --git a/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart2_ServerAuthorityFix_Dark.png b/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart2_ServerAuthorityFix_Dark.png index 8b047e275..e9d4deaac 100644 Binary files a/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart2_ServerAuthorityFix_Dark.png and b/static/img/sequence_diagrams/dealing_with_latency/Example_CaptureFlagPart2_ServerAuthorityFix_Dark.png differ diff --git a/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ClientAuthority_Dark.png b/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ClientAuthority_Dark.png index 374a40bf0..eacff975f 100644 Binary files a/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ClientAuthority_Dark.png and b/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ClientAuthority_Dark.png differ diff --git a/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ServerAuthority_Dark.png b/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ServerAuthority_Dark.png index c7d00426d..0a8dfd017 100644 Binary files a/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ServerAuthority_Dark.png and b/static/img/sequence_diagrams/dealing_with_latency/Example_CharPos_ServerAuthority_Dark.png differ