Commit 08005ff
authored
feat: quaternion synchronization, delta position, and NetworkTransform bandwidth optimizations (#2388)
* update
Quaternion Synchronization: Added the ability to synchronize by quaternions (full precision). Using quaternion synchronization is recommended for scenarios where multiple axis of rotation can change and the transform in question is within a parent-child hierarchy. When enabled, per axis rotation flags are no longer visible in the editor as the entire quaternion is synchronized when any change in rotation occurs.
Quaternion Compression: Added the ability to compress quaternions (requires Quaternion Synchronization to be enabled). Reduces the cost of quaternion synchronization down to 4 bytes at the cost of additional loss in precision (a bit less precise than half float precision).
Half Float Precision: Added the ability to enable half float precision which reduces payload size per instance by ~50% at the cost of a decrease in precision.
Delta Position Synchronization: When using half float precision NetworkTransform uses delta position synchronization to assure any loss in precision is recovered/handled in the next state update.
Added additional virtual methods to be used in prediction calculation scenarios where knowing the exact values being updated are required. This addition includes changing NetworkTransformState to public.
Added a bandwidth optimization related property, SynchronizeTransform, to NetworkObject that allows users to disable the automatic synchronization of the associated transform to reduce the total bandwidth cost of spawning and late joining client synchronization. This is particularly useful if the NetworkObject is used more for management related tasks and has no spatial synchronization needs.
NetworkTransform now only sends the network tick as opposed to the double precision server time since authority updates state only on each new network tick.
NetworkTransformState header properties are now being bit compressed.
Added additional check to make sure if SyncPosition axis value changes while using half precision (delta position) that if the delta on that axis exceeds the maximum delta that the NetworkObject is teleported on the tick this condition is detected.
* test manual
Added a manual test for long-duration testing of delta position compression with precision loss compensation.
Updated the manual nested network transform test using delta position with the HalfVector3 struct.
Added updates to the nested NetworkTransform manual test to be able to visually see that all automated player instances are in the same relative grid regions.
Updated manual tests for additive scene loading manual test with NetworkPrefabPool in order to be able to test turning on and off half float precision, quaternion synchronization, and quaternion compression.
Updated the delta position long duration test for precision drift so that it randomly selects x,y,z axis for direction and synchronization in order to determine if enabling and disabling which axis should be synchronized during runtime can cause issues.
* test
Added fixes to an issue with the NestedNetworkTransform test.
Removed the sphere collider from the NetworkTransformOwnershipTests because the test basically ignores collision with other players and collision is not a factor of this test.
Added a new IntegrationNetworkTransform for testing purposes.1 parent 4839210 commit 08005ff
97 files changed
Lines changed: 17472 additions & 1592 deletions
File tree
- com.unity.netcode.gameobjects
- Components
- Interpolator
- Editor
- Runtime/Core
- TestHelpers/Runtime
- Tests/Runtime
- NetworkObject
- NetworkTransform
- testproject
- Assets
- Materials
- Prefabs
- Scripts
- Tests
- Manual
- DeltaPositionNetworkTransform
- NestedNetworkTransforms
- SceneTransitioningAdditive
- SceneTransitioning
- Scripts
- Runtime
- NetworkTransform
- Resources
- ObjectParenting
- Textures
- ProjectSettings
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
17 | 29 | | |
18 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
| |||
25 | 40 | | |
26 | 41 | | |
27 | 42 | | |
| 43 | + | |
| 44 | + | |
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments