Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.3.0-pre.4] - 2024-07-17

### Added

* Optional UUID5GhostType property to the GhostCreation.Config struct, which allows you to provide your own unique UUID5 identifier when creating a ghost prefab at runtime, instead of relying on the auto-generated one (which uses the SHA1 of the ghost name).
* NetworkStreamDriver.ResetDriverStore to properly reset the NetworkDriverStore

### Changed

* All Simulate component enable states are reset to using a job instead of doing that synchronously on the main thread. Reason for the change is the fact this was inducing a big stall at the end of the Prediction loop. However, the benefits is only visible when there are a large number of jobified workload.
* Corrected incorrect/missing CHANGELOG entries across many previous versions.
* Updated Burst dependency to version 1.8.16
* Unified Multiplayer Project settings.
* Moved menu items to a collective place to improve workflows. This removes the Multiplayer menu and integrates into common places Window, Assets/Create, right-click menus, etc.
* The dependency on Unity Transport has been updated to version 2.2.1
* Re-exposed `TryFindAutoConnectEndPoint` and `HasDefaultAddressAndPortSet`, with small documentation updates.
* ConcurrentDriverStore and NetworkDriverStore.Concurrent are now public and you can use the NetworkDriverStore.Concurrent in your jobs to send/receive data.
  • Loading branch information
Unity Technologies committed Jul 17, 2024
1 parent 508c5b1 commit ea77e1e
Show file tree
Hide file tree
Showing 24 changed files with 427 additions and 142 deletions.
44 changes: 24 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,30 @@ uid: changelog

# Changelog

## [1.3.0-pre.4] - 2024-07-17

### Added

* Optional UUID5GhostType property to the GhostCreation.Config struct, which allows you to provide your own unique UUID5 identifier when creating a ghost prefab at runtime, instead of relying on the auto-generated one (which uses the SHA1 of the ghost name).
* NetworkStreamDriver.ResetDriverStore to properly reset the NetworkDriverStore

### Changed

* All Simulate component enable states are reset to using a job instead of doing that synchronously on the main thread. Reason for the change is the fact this was inducing a big stall at the end of the Prediction loop. However, the benefits is only visible when there are a large number of jobified workload.
* Corrected incorrect/missing CHANGELOG entries across many previous versions.
* Updated Burst dependency to version 1.8.16
* Unified Multiplayer Project settings.
* Moved menu items to a collective place to improve workflows. This removes the Multiplayer menu and integrates into common places Window, Assets/Create, right-click menus, etc.
* The dependency on Unity Transport has been updated to version 2.2.1
* Re-exposed `TryFindAutoConnectEndPoint` and `HasDefaultAddressAndPortSet`, with small documentation updates.
* ConcurrentDriverStore and NetworkDriverStore.Concurrent are now public and you can use the NetworkDriverStore.Concurrent in your jobs to send/receive data.


## [1.3.0-exp.1] - 2024-06-11

### Added

* The Multiplayer PlayMode Tools Window now calls synchronous `Connect` and `Disconnect` methods, and now shows the `Handshake` connection step. Handshake occurs when the client connection has been accepted by the server, but said client is awaiting a `NetworkId` assignment RPC from said server.
* Possibility to optimise the ghost serialization and pre-serialization by registering a custom chunk serialization function pointer that will let users reason on a per-archetype and write the serialization code without requiring virtual methods (function pointer call indirection) and optimised for the use case.
* Further clarifications, minor improvements, and fixes to the PlayMode Tools Window.
* `DefaultRelevancyQuery` to specify general rules for relevancy without specifying it ghost by ghost.
* Tooltips and additional info for the NetCodeConfig, supporting `ClientServerTickRate`, `ClientTickRate`, and `GhostSendSystemData`.
Expand Down Expand Up @@ -47,7 +65,6 @@ uid: changelog
* Issue where disconnecting your own client (via a direct `Disconnect` call) would fail to recycle the `NetworkId` component, and fail to dispose of the Entity.
* We now also correctly report and clean-up stale connections. I.e. Connections that are entered into invalid states by user-code.
* Issue where the `CommandSendSystem` was attempting to send RPCs with stale connections.
* some slow path in the normal ghost serialization that was causing many re-serialization of the same chunk, in case the chunk data was not fitting inside the temporary stream buffer. That was almost the norm in many cases, when the serialised entities are large enough (either because of the number of components or because of the size of them).
* NetworkStreamConnection now holds an accurate connection state right after the call to driver's Connect, instead of having to wait a frame to get it updated.
* Minor documentation issues.
* InvalidOperationException: cases where EntityManager is part of an exclusive transaction we skip gathering analytics for its world.
Expand Down Expand Up @@ -115,6 +132,8 @@ uid: changelog
* BatchScaleImportanceDelegate, a new version of the importance scaling function that work in batches. It is not required to set both the ScaleImportance and the BatchScaleImportance function pointers. If the BatchScaleImportance is set, it is the preferred.
* TempStreamInitialSize, a new parameter in the GhostSendSystemData for tuning the initial size of the temporary buffer used by server to serialise ghosts. By default now the size is 8KB.
* AlwaysRelevantQuery to specify general rules for relevancy without specifying it ghost by ghost.
* Added support for `NetCodeConnectionEvents` (accessed via singleton `NetworkStreamDriver`, `ConnectionEventsForFrame` property), allowing users an alternative to the `ConnectionState` component for tracking client connection and disconnection events.
* When single-stepping the Unity Editor, you'll see `NetCodeConnectionEvent`s in our Multiplayer PlayMode Tools Window.

### Changed

Expand Down Expand Up @@ -158,7 +177,7 @@ uid: changelog
* QoL issue where `GhostAuthoringInspectionComponent` was not always modifiable in areas of the Editor where it is valid to modify them.
* Issue where `GhostAuthoringComponent` was disallowed in nested prefab setups (where the root prefab is NOT a ghost).
* Log verbiage when creating a driver in DefaultDriverConstructor read like a 'call to action'. It's not.

* Internal driver clobbering error when calling `NetworkDriverStore.Disconnect` leading to rare exceptions in esoteric situations.

## [1.2.0-exp.3] - 2023-11-09

Expand All @@ -174,7 +193,6 @@ uid: changelog
* mostly for maintenance, code-generation for the component and buffer serialiser, using helper methods living all inside the package. No user visible changes
* Updated Transport dependency to version 2.1.0.
* The minimum supported editor version is now 2022.3.11f1
* all Simulate component enable states are reset to using a job instead of doing that synchronously on the main thread. Reason for the change is the fact this was inducing a big stall at the end of the Prediction loop. However, the benefits is only visible when there are a large number of jobified workload.
* components, command, buffers and rpc are now replicated also if they are private or internal

### Removed
Expand All @@ -193,6 +211,8 @@ uid: changelog
* `IndexOutOfRangeException` in the `GhostCollectionSystem` when ghost hash mismatches are present (a common error during dev).
* An issue accessing the m_PredictionSwitchingSmoothingLookup buffer when multiple ghosts change their owner and they need to switch prediction mode.
* GhostPrefabCreation.ConvertToGhostPrefab api that incorrectly replicated and assign to child entity components the root entity variant.
* Possibility to optimise the ghost serialization and pre-serialization by registering a custom chunk serialization function pointer that will let users reason on a per-archetype and write the serialization code without requiring virtual methods (function pointer call indirection) and optimised for the use case.
* some slow path in the normal ghost serialization that was causing many re-serialization of the same chunk, in case the chunk data was not fitting inside the temporary stream buffer. That was almost the norm in many cases, when the serialised entities are large enough (either because of the number of components or because of the size of them).


## [1.1.0-pre.3] - 2023-10-17
Expand Down Expand Up @@ -468,11 +488,6 @@ MetricsMonitorComponent: MetricsMonitor,
* It is not necessary anymore to define a custom `DefaultGhostVariant` system if a `LocalTransform` (`Rotation` or `Position` for V1) or `PhysicsVelocity` variants are added to project (since a `default` selection is already provided by the package).
* Updated `com.unity.transport` dependency to 2.0.0-pre.2


### Deprecated

* `ProjectSettings / NetCodeClientTarget` was not actually saved to the ProjectSettings. Instead, it was saved to `EditorPrefs`, breaking build determinism across machines. Now that this has been fixed, your EditorPref has been clobbered, and `ClientSettings.NetCodeClientTarget` has been deprecated (in favour of `NetCodeClientSettings.instance.ClientTarget`).

### Removed

* Removing dependencies on `com.unity.jobs` package.
Expand All @@ -497,18 +512,8 @@ MetricsMonitorComponent: MetricsMonitor,
* Removed CSS warning in package.
* A problem with baking and additional ghost entities that was removing `LocalTransform`, `WorldTransform` and `LocalToWorld` matrix.
* Mismatched ClientServerTickRate.SimulationTickRate and PredictedFixedStepSimulationSystemGroup.RateManager.Timestep will throw an error and will set the values to match each other.
* An issue with pre-spawned ghost baking when the baked entity has not LocalTransform (position/rotation for transform v1) component.
* "Ghost Distance Importance Scaling" is now working again. Ensure you read the updated documentation.
* Missing field write in `NetworkStreamListenSystem.OnCreate`, fixing Relay servers.
* Code-Generated Burst-compiled Serializer methods will now only compile inside worlds with `WorldFlag.GameClient` and `WorldFlag.GameServer` WorldFlags. This improves exit play-mode speeds (when Domain Reload is enabled), baking (in all cases), and recompilation speeds.
* Fixed an issue where multiple ghost types with the same archetype but difference data could sometime trigger errors about ghosts changing type.
* Improvements to the `GhostAuthoringInspectionComponent`, including removing the freeze when a baker creates lots of "Additional" entities, better display of Inputs, and fixed bug where the EntityGuid was not being saved (so modifying additional Entities is now supported). We now also detect (but don't destroy) broken ComponentOverrides, making it easier to switch from TRANSFORMS_V1 (for example).
* Fix a mistake where the relay sample will create a client driver rather than a server driver
* Fix logic for relay set up on the client. Making sure when calling DefaultDriverConstructor.RegisterClientDriver with relay settings that we skip this unless, requested playtype is client or clientandserver (if no server is found), the simulator is enabled, or on a client only build.
* Fixed `ArgumentException: ArchetypeChunk.GetDynamicComponentDataArrayReinterpret<System.Byte> cannot be called on zero-sized IComponentData` in `GhostPredictionHistorySystem.PredictionBackupJob`. Added comprehensive test coverage for the `GhostPredictionHistorySystem` (via adding a predicted ghost version of the `GhostSerializationTestsForEnableableBits` tests).
* Fixed serialization of components on child entities in the case where `SentForChildEntities = true`. This fix may introduce a small performance regression in baking and netcode world initialization.
* `GhostUpdateSystem` now supports Change Filtering, so components on the client will now only be marked as changed _when they actually are changed_. We strongly recommend implementing change filtering when reading components containing `[GhostField]`s and `[GhostEnabledBit]`s on the client.
* Fixed input component codegen issue when the type is nested in a parent class
* Exposed NetworkTick value to Entity Inspector.
* Fixed code-gen error where `ICommandData.Tick` was not being replicated.
* Fixed code-gen GhostField error handling when dealing with properties on Buffers, Commands, and Components.
Expand All @@ -534,7 +539,6 @@ MetricsMonitorComponent: MetricsMonitor,
* added some sanity check to prevent updating invalid ghosts
* Added a new method, `GhostPrefabCreation.ConvertToGhostPrefab` which can be used to create ghost prefabs from code without having an asset for them.
* Added a support for creating multiple network drivers. It is now possible to have a server that listen to the same port using different network interfaces (ex: IPC, Socket, WebSocket at the same time).
* Hybrid assemblies will not be included in DOTS Runtime builds.
* code generation documentation
* RegisterPredictedPhysicsRuntimeSystemReadWrite and RegisterPredictedPhysicsRuntimeSystemReadOnly extension methods, for tracking dependencies when using predicted networked physics systems.
* Support for runtime editing the number of ThinClients.
Expand Down
2 changes: 1 addition & 1 deletion Documentation~/entities-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ This singleton is a special kind of ghost without a prefab asset.
### GhostStats
| Component | Description |
|-----------------------------------------|---------------------------------------------------------------------|
| __GhostStats__ | State if the NetDbg tools is connected or not. |
| __GhostStats__ | State if the Network Debugger tools is connected or not. |
| __GhostStatsCollectionCommand__ | Internal stats data for commands. |
| __GhostStatsCollectionSnapshot__ | Internal stats data used to track sent/received snapshot data. |
| __GhostStatsCollectionPredictionError__ | Record the prediction stats for various ghost/component types pair. |
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/ghost-snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ to be added to all ghost types, sent for all ghost types, and serialized using t

## Snapshot visualization tool

To understand what is being put on the wire in the Netcode, you can use the snapshot visualization tool, __NetDbg__ tool.
To understand what is being put on the wire in the Netcode, you can use the snapshot visualization tool, __Network Debugger__ tool.

<img src="images/snapshot-debugger.png" width="1000" alt="net debug tool">

To open the tool, go to menu: __Multiplayer &gt; Open NetDbg__, and the tool opens in a browser window. It displays a vertical bar for each received snapshot, with a breakdown of the snapshot’s ghost types, size etc.
To open the tool, go to menu: __Window &gt; Multiplayer &gt; Network Debugger__, and the tool opens in a browser window. It displays a vertical bar for each received snapshot, with a breakdown of the snapshot’s ghost types, size etc.

To see more detailed information about the snapshot, click on one of the bars.

Expand Down
2 changes: 1 addition & 1 deletion Documentation~/metrics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metrics

There are 2 ways of gathering metrics about the netcode simulation. The simplest and most straight forward way is to use the NetDbg from the Multiplayer Menu in the Editor. This will provide you with a simple web interface to view the metrics.
There are 2 ways of gathering metrics about the netcode simulation. The simplest and most straight forward way is to use the Network Debugger from the Multiplayer Menu in the Editor. This will provide you with a simple web interface to view the metrics.

The second way is to create a Singleton of type [MetricsMonitorComponent](https://docs.unity3d.com/Packages/com.unity.netcode@latest/index.html?subfolder=/api/Unity.NetCode.MetricsMonitor.html)
and populate it with the data points you want to monitor.
Expand Down
2 changes: 1 addition & 1 deletion Documentation~/time-synchronization.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The tick the client estimates the server will apply the commands on is called th
For interpolated objects, the client should present them in a state it has received data for. This time is called **interpolation tick**. The `interpolation tick` is calculated as an offset in respect the `predicted tick`.
That time offset is called **prediction delay**. <br/>
The `interpolation delay` is calculated by taking into account round trip time, jitter and packet arrival rate, all data that is generally available on the client.
We also add some additional time, based on the network tick rate, to make sure we can handle some packets being lost. You can visualize the time offsets and scales in the snapshot visualization tool, [NetDbg](ghost-snapshots#Snapshot-visualization-tool).
We also add some additional time, based on the network tick rate, to make sure we can handle some packets being lost. You can visualize the time offsets and scales in the snapshot visualization tool, [Network Debugger](ghost-snapshots#Snapshot-visualization-tool).

The `NetworkTimeSystem` slowly adjusts both `prediction tick` and `interpolation delay` in small increments to keep them advancing at a smooth rate and ensure that neither the
interpolation tick nor the prediction tick goes back in time.
Expand Down
9 changes: 4 additions & 5 deletions Editor/CodeGenMenu.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using UnityEditor;
using UnityEngine;
using UnityEditorInternal;

namespace Unity.NetCode.Editor
{
class CodeGenMenu
{
[MenuItem("Multiplayer/Force Code Generation", priority = 10)]
static private void ForceRunCodeGen()
[MenuItem("Assets/Multiplayer/Force Code Generation", priority = 1000)]
private static void ForceRunCodeGen()
{
EditorApplication.delayCall += () =>
{
Expand All @@ -29,8 +28,8 @@ static private void ForceRunCodeGen()
};
}

[MenuItem("Multiplayer/Open Source Generated Folder", priority = 12)]
static private void OpenSourceGeneratedFolder()
[MenuItem("Assets/Multiplayer/Open Source Generated Folder", priority = 1000)]
private static void OpenSourceGeneratedFolder()
{
if (!System.IO.File.Exists("Temp/NetCodeGenerated"))
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/MultiplayerPlayModeWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ internal class MultiplayerPlayModeWindow : EditorWindow, IHasCustomMenu
static GUILayoutOption s_RightButtonWidth = GUILayout.Width(120);
private int m_PreviousFrameCount;

[MenuItem("Multiplayer/Window: PlayMode Tools", priority = 50)]
[MenuItem("Window/Multiplayer/PlayMode Tools", priority = 3007)]
private static void ShowWindow()
{
GetWindow<MultiplayerPlayModeWindow>(false, k_Title, true);
Expand Down Expand Up @@ -227,7 +227,7 @@ void PlayModeUpdate()
}
}

[MenuItem("Multiplayer/Toggle Lag Spike Simulation _F12", priority = 51)]
[MenuItem("Window/Multiplayer/Toggle Lag Spike Simulation _F12", priority = 3007)]
static void ToggleLagSpikeSimulatorShortcut()
{
if (ClientServerBootstrap.ClientWorld != null)
Expand Down
6 changes: 2 additions & 4 deletions Editor/NetcodeConfigEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Unity.Collections;
using Unity.NetCode.Hybrid;
Expand Down Expand Up @@ -39,7 +38,6 @@ private static NetCodeConfig SavedConfig
}
}

[MenuItem("Multiplayer/Create NetcodeConfig Asset", priority = 100)]
internal static void CreateNetcodeSettingsAsset()
{
var assetPath = AssetDatabase.GenerateUniqueAssetPath("Assets/NetcodeConfig.asset");
Expand Down Expand Up @@ -84,10 +82,10 @@ public static SettingsProvider CreateNetcodeConfigSettingsProvider()
{
// First parameter is the path in the Settings window.
// Second parameter is the scope of this setting: it only appears in the Project Settings window.
var provider = new SettingsProvider("Project/NetCodeConfig.asset", SettingsScope.Project)
var provider = new SettingsProvider("Project/Multiplayer", SettingsScope.Project)
{
// By default the last token of the path is used as display name if no label is provided.
label = "NetCode for Entities",
label = "Multiplayer",
// Create the SettingsProvider and initialize its drawing (IMGUI) function in place:
guiHandler = (searchContext) =>
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/SourceGeneratorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static class SourceGeneratorSettings
/// Create the Default.globalconfig file in the Assets folder root.
/// </summary>
/// <returns></returns>
[MenuItem("Multiplayer/Create SourceGenerator AnalyzerConfig", priority = 101)]
[MenuItem("Assets/Create/Multiplayer/SourceGenerator AnalyzerConfig", priority = 1)]
static void CreateGlobalConfig()
{
var assetPath = Path.Combine(Application.dataPath, "Default.globalconfig");
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Authoring/Hybrid/NetCodeServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ internal class ServerSettings : DotsPlayerSettingsProvider
{
VisualElement m_BuildSettingsContainer;

public override string ProviderPath => "Project/Multiplayer/Build";

public override int Importance
{
get { return 1; }
Expand All @@ -140,6 +142,8 @@ protected override IEntitiesPlayerSettings DoGetSettingAsset()

public override void OnActivate(DotsGlobalSettings.PlayerType type, VisualElement rootElement)
{
DotsGlobalSettings.Instance.ServerProvider.ProviderPath = "Project/Multiplayer/Build";

rootElement.RegisterCallback<AttachToPanelEvent>(OnAttachToPanel);
rootElement.RegisterCallback<DetachFromPanelEvent>(OnDetachFromPanel);

Expand Down
Loading

0 comments on commit ea77e1e

Please sign in to comment.