refactor: move UTP integration into NGO, delete UTP Adapter package (#1823)

This commit is contained in:
Fatih Mar 2022-03-23 23:28:22 +00:00 коммит произвёл GitHub
Родитель 6dbd026892
Коммит 26dbf659bd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
83 изменённых файлов: 262 добавлений и 530 удалений

3
.github/CODEOWNERS поставляемый
Просмотреть файл

@ -4,7 +4,8 @@
Profiling/ @Unity-Technologies/multiplayer-tools
Metrics/ @Unity-Technologies/multiplayer-tools
/com.unity.netcode.gameobjects/Runtime/Transports/ @Unity-Technologies/multiplayer-server
/com.unity.netcode.adapter.utp/ @Unity-Technologies/multiplayer-server
/com.unity.netcode.gameobjects/Tests/Editor/Transports/ @Unity-Technologies/multiplayer-server
/com.unity.netcode.gameobjects/Tests/Runtime/Transports/ @Unity-Technologies/multiplayer-server
*.asmdef @mfatihmar
package.json @mfatihmar
AssemblyInfo.cs @mfatihmar

17
.github/pull_request_template.md поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
<!-- Replace this line with what this PR does and why. Describe what you'd like reviewers to know, how you applied the Engineering principles, and any interesting tradeoffs made. Delete bullet points below that don't apply, and update the changelog section as appropriate. -->
<!-- Replace this block with what this PR does and why. Describe what you'd like reviewers to know, how you applied the engineering principles, and any interesting tradeoffs made. Delete bullet points below that don't apply, and update the changelog section as appropriate. -->
<!-- Add short version of the JIRA ticket to the PR title (e.g. "feat: new shiny feature [MTT-123]") -->
@ -6,19 +6,18 @@
## Changelog
### com.unity.netcode.gameobjects
- Added: The package whose Changelog should be added to should be in the header. Delete the changelog section entirely if it's not needed.
- Fixed: If you update multiple packages, create a new section with a new header for the other package.
- Removed/Deprecated/Changed: Each bullet should be prefixed with Added, Fixed, Removed, Deprecated, or Changed to indicate where the entry should go.
## Testing and Documentation
* No tests have been added.
* Includes unit tests.
* Includes integration tests.
* No documentation changes or additions were necessary.
* Includes documentation for previously-undocumented public API entry points.
* Includes edits to existing public API documentation.
- No tests have been added.
- Includes unit tests.
- Includes integration tests.
- No documentation changes or additions were necessary.
- Includes documentation for previously-undocumented public API entry points.
- Includes edits to existing public API documentation.
<!-- Uncomment and mark items off with a * if this PR deprecates any API:
### Deprecated API
@ -26,4 +25,4 @@
- [ ] An [api updater] was added.
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they should use instead.
-->
-->

Просмотреть файл

@ -38,8 +38,6 @@ projects:
packages:
- name: com.unity.netcode.gameobjects
path: com.unity.netcode.gameobjects
- name: com.unity.netcode.adapter.utp
path: com.unity.netcode.adapter.utp
test_editors:
- 2021.2
- 2020.3

Просмотреть файл

@ -40,7 +40,6 @@ This repository is broken into multiple components, each one implemented as a Un
```
.
├── com.unity.netcode.gameobjects # The core netcode SDK unity package (source + tests)
├── com.unity.netcode.adapter.utp # Transport wrapper for com.unity.transport
└── testproject # A Unity project with various test implementations & scenes which exercise the features in the above packages.
```

Просмотреть файл

@ -1,125 +0,0 @@
# Changelog
All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [Unreleased]
### Changed
- Updated Unity Transport package to 1.0.0-pre.15. (#1797)
### Fixed
- The 'Heartbeat Timeout MS' setting now also applies to the keep-alive messages sent to the Relay server when no connections have otherwise been made (e.g. for a host that's still waiting for clients to connect). Before this fix, these keep-alive messages would be sent every 9 seconds, no matter the actual timeout of the Relay allocation. (#1787)
- Fixed compilation on WebGL. Note that the platform is still unsupported, but at least including the package in a WebGL project will not create compilation errors anymore. (#1802)
- Flush internal send queues to the network during `Shutdown`. Prior to this fix, calling `NetworkManager.Shutdown` with `discardMessageQueue` set to false would not actually get messages from the outgoing queue to the network. (#1800)
### Changed
- Removed the 'NetCode > Simulator Tools' menu to reduce confusion. The only way to set debug simulator parameters is now through the 'Debug Simulator' section of the 'Unity Transport' component. (#1793)
## [1.0.0-pre.6] - 2022-03-02
### Added
- New parameters are available to simulate network conditions (delay, jitter, packet loss) in the editor and in development builds. The parameters are available under the 'Debug Simulator' section of the 'Unity Transport' component, or can be set with the `SetDebugSimulatorParameters` call. (#1745)
- `GetCurrentRtt` is now properly implemented. (#1755)
### Changed
- Updated Unity Transport package to 1.0.0-pre.14. (#1760)
- Updated Netcode for GameObjects dependency to 1.0.0-pre.6 (#1771)
- Overflowing the reliable send queue of a connection will now result in the connection being closed, rather than spamming the log with errors about not being able to send a payload. It is deemed better to close the connection than to lose reliable traffic (which could cause all sorts of weird synchronization issues). (#1747)
### Fixed
- Fixed issue where disconnecting from the server with data still in the queue would result in an error message about a stale connection. (#1649)
- Fixed issue where the server `NetworkEndPoint` would fail to be created when 'Server Listen Address' is empty. (#1636)
- Fixed issue with native collections not all being disposed of when destroying the component without shutting it down properly. This would result in errors in the console and memory leaks. (#1640)
- Fixed an issue where packets causing errors would not be removed from the send queue, which would cause the error message to be spammed on every frame as the adapter would try to resend the packet. (#1648)
- Fixed and issue where a server would fail to disconnect a client if another client had previously disconnected itself. (#1673)
## [1.0.0-pre.5] - 2022-01-26
### Added
- A new 'Server Listen Address' field under 'Connection Data' in the inspector has been added to specify the address a server should listen to, in case it differs from the main 'Address' field. The `SetConnectionData` method has been updated accordingly to take an optional parameter to specify that listen address. (#1605)
- Added new methods to set the relay server data: `SetHostRelayData` and `SetClientRelayData`. These are meant to be less error-prone than `SetRelayServerData` (which remains available). (#1609)
### Changed
- Updated Netcode for GameObjects dependency to 1.0.0-pre.5 (#1626)
- Updated Unity Transport package to 1.0.0-pre.12. (#1615)
- Rename the 'Send Queue Batch Size' property to 'Max Payload Size' to better reflect its usage. (#1584)
- Implicit conversions between `ConnectionAddressData` and `NetworkEndPoint` are now deprecated, since their semantics are no longer clear with the introduction of the new `ServerListenAddress` field (see above). (#1605)
### Fixed
- Lifted the limit of ~44KB for reliable payloads. Before the fix, attempting to send a payload larger than that with reliable delivery would silently fail. Note that it is still not recommended to send such large reliable payloads, since their delivery could take a few network round-trips. (#1596)
## [1.0.0-pre.4] - 2022-01-04
### Added
- Added new 'Max Send Queue Size' configuration field in the inspector. This controls the size of the send queue that is used to accumulate small sends together and also acts as an overflow queue when there are too many in-flight packets or when other internal queues are full. (#1491)
### Changed
- Updated Netcode for GameObjects dependency to 1.0.0-pre.4 (#1562)
- Removed 'Maximum Packet Size' configuration field in the inspector. This would cause confusion since the maximum packet size is in effect always the MTU (1400 bytes on most platforms). (#1403)
- Updated com.unity.transport to 1.0.0-pre.10 (#1501)
- All delivery methods now support fragmentation, meaning the 'Send Queue Batch Size' setting (which controls the maximum payload size) now applies to all delivery methods, not just reliable ones. (#1512)
### Fixed
- Fixed packet overflow errors when sending payloads too close to the MTU (was mostly visible when using Relay). (#1403)
- Don't throw an exception when the host disconnects (issue 1439 on GitHub). (#1441)
- Avoid "too many inflight packets" errors by queueing packets in a queue when the limit of inflight packets is reached in UTP. The size of this queue can be controlled with the 'Max Send Queue Size' configuration field. (#1491)
## [1.0.0-pre.3] - 2021-10-22
### Added
- Exposed `m_HeartbeatTimeoutMS`, `m_ConnectTimeoutMS`, `m_MaxConnectAttempts`, and `m_DisconnectTimeoutMS` parameters. (#1314)
### Changed
- Updated Unity Transport package to 1.0.0-pre.7
- Updated Netcode for GameObjects dependency to 1.0.0-pre.3
### Fixed
- Fixed sends failing when send queue is filled or close to be filled. (#1317)
- Heartbeats API not working for Unity Transport when running in the editor or development builds. (#1314)
## [1.0.0-pre.2] - 2021-10-19
### Changed
- Updated Netcode for GameObjects dependency to 1.0.0-pre.2
## [1.0.0-pre.1] - 2021-10-19
### Added
- Support for Unity Relay (#887)
- New SetConnectionData function that takes in a NetworkEndpoint
### Changed
- No longer use coroutines when connecting to relay
- Consolidated the Send/Recv queue properties as they always needed to be the same.
- Consolidated the Fragmentation/Queue size as they always needed to be the same.
- Updated Unity Transport package to 1.0.0-pre.6
### Fixed
- Fixed an issue where OnClientDisconnectCallback was not being called (#1243)
- Flush the UnityTransport send queue on shutdown (#1234)
- Exposed a way to set ip and port from code (#1208)
- Possible Editor crash when trying to read a batched packet where the size of the packet was larger than the max packet size.
- Removed the requirement that MaxPacketSize needs to be the same size as the batched/fragmentation buffer size.
## [0.0.1-preview.1] - 2020-12-20
This is the first release of Unity Transport for Netcode for Gameobjects

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: c482292884eb2a14f8d59b4a5c55c62e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,9 +0,0 @@
# https://dotnet.github.io/docfx/tutorial/howto_filter_out_unwanted_apis_attributes.html
apiRules:
- exclude:
uidRegex: ^Unity\.Netcode\.UTP\.EditorTests.*$
type: Namespace
- exclude:
uidRegex: ^Unity\.Netcode\.UTP\.RuntimeTests.*$
type: Namespace

Просмотреть файл

@ -1,7 +0,0 @@
# **Unity Transport for Netcode for GameObjects Manual**
# Getting Started
Unity Transport for Netcode for GameObjects is a transport adapter which enables the use of [Unity Transport Package](https://docs-multiplayer.unity3d.com/transport/1.0.0/introduction) as a low-level transport for Netcode for GameObjects.
This library is an implementation of NetworkTransport to provide configuration and interoperability for Unity Transport with the Netcode for GameObjects package, enabling cross platform UDP-based network communication to a Unity project.

Просмотреть файл

@ -1,9 +0,0 @@
MIT License
Copyright (c) 2021 Unity Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 5501977e9ab93ad469220f23990177cc
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,3 +0,0 @@
Unity Transport for Netcode for GameObjects is a transport adapter which enables the use of [Unity Transport Package](https://docs-multiplayer.unity3d.com/transport/1.0.0/introduction) as a low-level transport for Netcode for GameObjects.
This library is an implementation of NetworkTransport to provide configuration and interoperability for Unity Transport with the Netcode for GameObjects package, enabling cross platform UDP-based network communication to a Unity project.

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 8dcab9a16b9388445a77d3b927b242cf
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d6198c048d7fde84e837ad7b5ae231d9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,4 +0,0 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.Netcode.Adapter.UTP.EditorTests")]
[assembly: InternalsVisibleTo("Unity.Netcode.Adapter.UTP.RuntimeTests")]

Просмотреть файл

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 29abb196ca414357b4cf7aeb7e95e958
timeCreated: 1644266612

Просмотреть файл

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 8135c2689eaa4bd4b13e3478d922c6a0
timeCreated: 1644266612

Просмотреть файл

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e5c12c921f30454b889ea5a5afc4995e
timeCreated: 1644268877

Просмотреть файл

@ -1,24 +0,0 @@
{
"name": "Unity.Netcode.Adapter.UTP",
"rootNamespace": "Unity.Netcode.Adapter.UTP",
"references": [
"Unity.Collections",
"Unity.Jobs",
"Unity.Burst",
"Unity.Netcode.Runtime",
"Unity.Networking.Transport"
],
"allowUnsafeCode": true,
"versionDefines": [
{
"name": "com.unity.multiplayer.tools",
"expression": "",
"define": "MULTIPLAYER_TOOLS"
},
{
"name": "com.unity.multiplayer.tools",
"expression": "1.0.0-pre.7",
"define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7"
}
]
}

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3bf5041814073ec4089849c425919d5a
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,15 +0,0 @@
{
"name": "Unity.Netcode.Adapter.UTP.EditorTests",
"rootNamespace": "Unity.Netcode.UTP.EditorTests",
"references": [
"Unity.Netcode.Runtime",
"Unity.Networking.Transport",
"Unity.Netcode.Adapter.UTP"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
]
}

Просмотреть файл

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bc69b0a277c4d024eb9f7813ad4db7d1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c9e62c313ec32744c810875f6738b767
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1c4fedf1be1a7d84ba34595aae75f8da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,12 +0,0 @@
{
"name": "Unity.Netcode.Adapter.UTP.RuntimeTests",
"rootNamespace": "Unity.Netcode.UTP.RuntimeTests",
"references": [
"Unity.Netcode.Runtime",
"Unity.Networking.Transport",
"Unity.Netcode.Adapter.UTP"
],
"optionalUnityReferences": [
"TestAssemblies"
]
}

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: f61c9ac8cd8eb034b9ab68c718c02763
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -1,11 +0,0 @@
{
"name": "com.unity.netcode.adapter.utp",
"displayName": "Unity Transport for Netcode for GameObjects",
"description": "This package is plugging Unity Transport into Netcode for GameObjects, which is a network transport layer - the low-level interface for sending UDP data",
"version": "1.0.0-pre.6",
"unity": "2020.3",
"dependencies": {
"com.unity.netcode.gameobjects": "1.0.0-pre.6",
"com.unity.transport": "1.0.0-pre.15"
}
}

Просмотреть файл

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 67a2dba60abbf414584aab568fb56103
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -10,6 +10,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
### Added
- Added `UnityTransport` implementation and `com.unity.transport` package dependency (#1823)
- Added `NetworkVariableWritePermission` to `NetworkVariableBase` and implemented `Owner` client writable netvars. (#1762)
### Changed

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6ffe51a727e9e5541a9bcef793f920f2
guid: a325130169714440ba1b4878082e8956
folderAsset: yes
DefaultImporter:
externalObjects: {}

Просмотреть файл

@ -0,0 +1,53 @@
#if COM_UNITY_NETCODE_ADAPTER_UTP
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;
namespace Unity.Netcode.Editor.PackageChecker
{
[InitializeOnLoad]
internal class UTPAdapterChecker
{
private const string k_UTPAdapterPackageName = "com.unity.netcode.adapter.utp";
private static ListRequest s_ListRequest = null;
static UTPAdapterChecker()
{
if (s_ListRequest == null)
{
s_ListRequest = Client.List();
EditorApplication.update += EditorUpdate;
}
}
private static void EditorUpdate()
{
if (!s_ListRequest.IsCompleted)
{
return;
}
EditorApplication.update -= EditorUpdate;
if (s_ListRequest.Status == StatusCode.Success)
{
if (s_ListRequest.Result.Any(p => p.name == k_UTPAdapterPackageName))
{
Debug.Log($"({nameof(UTPAdapterChecker)}) Found UTP Adapter package, it is no longer needed, `UnityTransport` is now directly integrated into the SDK therefore removing it from the project.");
Client.Remove(k_UTPAdapterPackageName);
}
}
else
{
var error = s_ListRequest.Error;
Debug.LogError($"({nameof(UTPAdapterChecker)}) Cannot check the list of packages -> error #{error.errorCode}: {error.message}");
}
s_ListRequest = null;
}
}
}
#endif // COM_UNITY_NETCODE_ADAPTER_UTP

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6076344efcf62c54fa65e7affb2eb008
guid: df5ed97df956b4aad91a221ba59fa304
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -0,0 +1,14 @@
{
"name": "Unity.Netcode.Editor.PackageChecker",
"rootNamespace": "Unity.Netcode.Editor.PackageChecker",
"includePlatforms": [
"Editor"
],
"versionDefines": [
{
"name": "com.unity.netcode.adapter.utp",
"expression": "",
"define": "COM_UNITY_NETCODE_ADAPTER_UTP"
}
]
}

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0bf62c6e1b90cf343a0d87bd323f46d0
guid: de64d7f9ca85d4bf59c8c24738bc1057
AssemblyDefinitionImporter:
externalObjects: {}
userData:

Просмотреть файл

@ -11,4 +11,3 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.Netcode.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.Netcode.TestHelpers.Runtime")]
[assembly: InternalsVisibleTo("Unity.Netcode.Adapter.UTP")]

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ff6b9fdc7bae5bf46aad42bf806d50ab
guid: 81887adf6d9ca40c9b70728b7018b6f5
folderAsset: yes
DefaultImporter:
externalObjects: {}

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using Unity.Networking.Transport;
namespace Unity.Netcode.UTP.Utilities
namespace Unity.Netcode.Transports.UTP
{
/// <summary>Queue for batched messages received through UTP.</summary>
/// <remarks>This is meant as a companion to <see cref="BatchedSendQueue"/>.</remarks>

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f596d27fcca3fd64399774baf1ae50d3
guid: e9ead10b891184bd5b8f2650fd66a5b1
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Networking.Transport;
namespace Unity.Netcode.UTP.Utilities
namespace Unity.Netcode.Transports.UTP
{
/// <summary>Queue for batched messages meant to be sent through UTP.</summary>
/// <remarks>

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: be6aa2f5820911841850340049879f16
guid: ddf8f97f695d740f297dc42242b76b8c
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -1,4 +1,4 @@
namespace Unity.Netcode
namespace Unity.Netcode.Transports.UTP
{
public struct NetworkMetricsContext
{

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e1692ce08a2f72e459680dc1524327a2
guid: adb0270501ff1421896ce15cc75bd56a
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -6,7 +6,7 @@ using Unity.Collections.LowLevel.Unsafe;
using Unity.Networking.Transport;
using UnityEngine;
namespace Unity.Netcode
namespace Unity.Netcode.Transports.UTP
{
[BurstCompile]
internal unsafe struct NetworkMetricsPipelineStage : INetworkPipelineStage
@ -19,13 +19,14 @@ namespace Unity.Netcode
int staticInstanceBufferLength,
NetworkSettings settings)
{
return new NetworkPipelineStage(ReceiveFunction,
SendFunction,
InitializeConnectionFunction,
ReceiveCapacity: 0,
SendCapacity: 0,
HeaderCapacity: 0,
SharedStateCapacity: UnsafeUtility.SizeOf<NetworkMetricsContext>());
return new NetworkPipelineStage(
ReceiveFunction,
SendFunction,
InitializeConnectionFunction,
ReceiveCapacity: 0,
SendCapacity: 0,
HeaderCapacity: 0,
SharedStateCapacity: UnsafeUtility.SizeOf<NetworkMetricsContext>());
}
public int StaticSize => 0;

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ab8e989afa5cf444bac47c920b5d4748
guid: 52b1ce9f83ce049c59327064bf70cee8
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using NetcodeNetworkEvent = Unity.Netcode.NetworkEvent;
using TransportNetworkEvent = Unity.Networking.Transport.NetworkEvent;
using Unity.Collections.LowLevel.Unsafe;
@ -9,9 +8,8 @@ using Unity.Collections;
using Unity.Networking.Transport;
using Unity.Networking.Transport.Relay;
using Unity.Networking.Transport.Utilities;
using Unity.Netcode.UTP.Utilities;
namespace Unity.Netcode
namespace Unity.Netcode.Transports.UTP
{
/// <summary>
/// Provides an interface that overrides the ability to create your own drivers and pipelines
@ -33,8 +31,7 @@ namespace Unity.Netcode
private const string k_NetworkVersionMismatch = "NetworkVersion is invalid, likely caused by stale connection {0}.";
private const string k_NetworkStateMismatch = "Sending data while connecting on connection {0} is not allowed.";
private const string k_NetworkPacketOverflow = "Unable to allocate packet due to buffer overflow.";
private const string k_NetworkSendQueueFull = "Currently unable to queue packet as there is too many in-flight " +
" packets. This could be because the send queue size ('Max Send Queue Size') is too small.";
private const string k_NetworkSendQueueFull = "Currently unable to queue packet as there is too many in-flight packets. This could be because the send queue size ('Max Send Queue Size') is too small.";
private const string k_NetworkHeaderInvalid = "Invalid Unity Transport Protocol header.";
private const string k_NetworkDriverParallelForErr = "The parallel network driver needs to process a single unique connection per job, processing a single connection multiple times in a parallel for is not supported.";
private const string k_NetworkSendHandleInvalid = "Invalid NetworkInterface Send Handle. Likely caused by pipeline send data corruption.";
@ -89,58 +86,61 @@ namespace Unity.Netcode
public const int InitialMaxPayloadSize = 6 * 1024;
public const int InitialMaxSendQueueSize = 16 * InitialMaxPayloadSize;
private static ConnectionAddressData s_DefaultConnectionAddressData = new ConnectionAddressData()
{ Address = "127.0.0.1", Port = 7777, ServerListenAddress = string.Empty };
private static ConnectionAddressData s_DefaultConnectionAddressData = new ConnectionAddressData { Address = "127.0.0.1", Port = 7777, ServerListenAddress = string.Empty };
#pragma warning disable IDE1006 // Naming Styles
public static INetworkStreamDriverConstructor s_DriverConstructor;
#pragma warning restore IDE1006 // Naming Styles
public INetworkStreamDriverConstructor DriverConstructor => s_DriverConstructor != null ? s_DriverConstructor : this;
public INetworkStreamDriverConstructor DriverConstructor => s_DriverConstructor ?? this;
[Tooltip("Which protocol should be selected (Relay/Non-Relay).")]
[SerializeField] private ProtocolType m_ProtocolType;
[SerializeField]
private ProtocolType m_ProtocolType;
#pragma warning disable CS0414 // Assigned-but-not-used (only an issue in WebGL builds)
[Tooltip("The maximum amount of packets that can be in the internal send/receive queues. " +
"Basically this is how many packets can be sent/received in a single update/frame.")]
[SerializeField] private int m_MaxPacketQueueSize = InitialMaxPacketQueueSize;
[Tooltip("The maximum amount of packets that can be in the internal send/receive queues. Basically this is how many packets can be sent/received in a single update/frame.")]
[SerializeField]
private int m_MaxPacketQueueSize = InitialMaxPacketQueueSize;
#pragma warning restore CS0414
[Tooltip("The maximum size of a payload that can be handled by the transport.")]
[FormerlySerializedAs("m_SendQueueBatchSize")]
[SerializeField] private int m_MaxPayloadSize = InitialMaxPayloadSize;
[SerializeField]
private int m_MaxPayloadSize = InitialMaxPayloadSize;
[Tooltip("The maximum size in bytes of the transport send queue. The send queue accumulates messages for " +
"batching and stores messages when other internal send queues are full. If you routinely observe an " +
"error about too many in-flight packets, try increasing this.")]
[SerializeField] private int m_MaxSendQueueSize = InitialMaxSendQueueSize;
[Tooltip("The maximum size in bytes of the transport send queue. The send queue accumulates messages for batching and stores messages when other internal send queues are full. If you routinely observe an error about too many in-flight packets, try increasing this.")]
[SerializeField]
private int m_MaxSendQueueSize = InitialMaxSendQueueSize;
[Tooltip("A timeout in milliseconds after which a heartbeat is sent if there is no activity.")]
[SerializeField] private int m_HeartbeatTimeoutMS = NetworkParameterConstants.HeartbeatTimeoutMS;
[SerializeField]
private int m_HeartbeatTimeoutMS = NetworkParameterConstants.HeartbeatTimeoutMS;
[Tooltip("A timeout in milliseconds indicating how long we will wait until we send a new connection attempt.")]
[SerializeField] private int m_ConnectTimeoutMS = NetworkParameterConstants.ConnectTimeoutMS;
[SerializeField]
private int m_ConnectTimeoutMS = NetworkParameterConstants.ConnectTimeoutMS;
[Tooltip("The maximum amount of connection attempts we will try before disconnecting.")]
[SerializeField] private int m_MaxConnectAttempts = NetworkParameterConstants.MaxConnectAttempts;
[SerializeField]
private int m_MaxConnectAttempts = NetworkParameterConstants.MaxConnectAttempts;
[Tooltip("A timeout in milliseconds indicating how long we will wait for a connection event, before we " +
"disconnect it. The connection needs to receive data from the connected endpoint within this timeout. " +
"Note that with heartbeats enabled, simply not sending any data will not be enough to trigger this " +
"timeout (since heartbeats count as connection events).")]
[SerializeField] private int m_DisconnectTimeoutMS = NetworkParameterConstants.DisconnectTimeoutMS;
[Tooltip("A timeout in milliseconds indicating how long we will wait for a connection event, before we disconnect it. The connection needs to receive data from the connected endpoint within this timeout. Note that with heartbeats enabled, simply not sending any data will not be enough to trigger this timeout (since heartbeats count as connection events).")]
[SerializeField]
private int m_DisconnectTimeoutMS = NetworkParameterConstants.DisconnectTimeoutMS;
[Serializable]
public struct ConnectionAddressData
{
[Tooltip("IP address of the server (address to which clients will connect to).")]
[SerializeField] public string Address;
[SerializeField]
public string Address;
[Tooltip("UDP port of the server.")]
[SerializeField] public ushort Port;
[SerializeField]
public ushort Port;
[Tooltip("IP address the server will listen on. If not provided, will use 'Address'.")]
[SerializeField] public string ServerListenAddress;
[SerializeField]
public string ServerListenAddress;
private static NetworkEndPoint ParseNetworkEndpoint(string ip, ushort port)
{
@ -155,16 +155,7 @@ namespace Unity.Netcode
public NetworkEndPoint ServerEndPoint => ParseNetworkEndpoint(Address, Port);
public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint(
(ServerListenAddress == string.Empty) ? Address : ServerListenAddress, Port);
[Obsolete("Use ServerEndPoint or ListenEndPoint properties instead.")]
public static implicit operator NetworkEndPoint(ConnectionAddressData d) =>
ParseNetworkEndpoint(d.Address, d.Port);
[Obsolete("Construct manually from NetworkEndPoint.Address and NetworkEndPoint.Port instead.")]
public static implicit operator ConnectionAddressData(NetworkEndPoint d) =>
new ConnectionAddressData() { Address = d.Address.Split(':')[0], Port = d.Port, ServerListenAddress = string.Empty };
public NetworkEndPoint ListenEndPoint => ParseNetworkEndpoint((ServerListenAddress == string.Empty) ? Address : ServerListenAddress, Port);
}
public ConnectionAddressData ConnectionData = s_DefaultConnectionAddressData;
@ -172,17 +163,17 @@ namespace Unity.Netcode
[Serializable]
public struct SimulatorParameters
{
[Tooltip("Delay to add to every send and received packet (in milliseconds). Only applies in the editor " +
"and in development builds. The value is ignored in production builds.")]
[SerializeField] public int PacketDelayMS;
[Tooltip("Delay to add to every send and received packet (in milliseconds). Only applies in the editor and in development builds. The value is ignored in production builds.")]
[SerializeField]
public int PacketDelayMS;
[Tooltip("Jitter (random variation) to add/substract to the packet delay (in milliseconds). Only " +
"applies in the editor and in development builds. The value is ignored in production builds.")]
[SerializeField] public int PacketJitterMS;
[Tooltip("Jitter (random variation) to add/substract to the packet delay (in milliseconds). Only applies in the editor and in development builds. The value is ignored in production builds.")]
[SerializeField]
public int PacketJitterMS;
[Tooltip("Percentage of sent and received packets to drop. Only applies in the editor and in the editor " +
"and in developments builds.")]
[SerializeField] public int PacketDropRate;
[Tooltip("Percentage of sent and received packets to drop. Only applies in the editor and in the editor and in developments builds.")]
[SerializeField]
public int PacketDropRate;
}
public SimulatorParameters DebugSimulator = new SimulatorParameters
@ -192,30 +183,6 @@ namespace Unity.Netcode
PacketDropRate = 0
};
// Only for backward compatibility with how we used to handle simulator parameters.
#if DEVELOPMENT_BUILD
[Obsolete("Use SetDebugSimulatorParameters() instead.")]
public int ClientPacketDelayMs
{
get => DebugSimulator.PacketDelayMS;
set => DebugSimulator.PacketDelayMS = value;
}
[Obsolete("Use SetDebugSimulatorParameters() instead.")]
public int ClientPacketJitterMs
{
get => DebugSimulator.PacketJitterMS;
set => DebugSimulator.PacketJitterMS = value;
}
[Obsolete("Use SetDebugSimulatorParameters() instead.")]
public int ClientPacketDropRate
{
get => DebugSimulator.PacketDropRate;
set => DebugSimulator.PacketDropRate = value;
}
#endif
private State m_State = State.Disconnected;
private NetworkDriver m_Driver;
private NetworkSettings m_NetworkSettings;
@ -392,8 +359,7 @@ namespace Unity.Netcode
m_ProtocolType = inProtocol;
}
public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocationIdBytes, byte[] keyBytes,
byte[] connectionDataBytes, byte[] hostConnectionDataBytes = null, bool isSecure = false)
public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocationIdBytes, byte[] keyBytes, byte[] connectionDataBytes, byte[] hostConnectionDataBytes = null, bool isSecure = false)
{
RelayConnectionData hostConnectionData;
@ -420,8 +386,7 @@ namespace Unity.Netcode
hostConnectionData = connectionData;
}
m_RelayServerData = new RelayServerData(ref serverEndpoint, 0, ref allocationId, ref connectionData,
ref hostConnectionData, ref key, isSecure);
m_RelayServerData = new RelayServerData(ref serverEndpoint, 0, ref allocationId, ref connectionData, ref hostConnectionData, ref key, isSecure);
m_RelayServerData.ComputeNewNonce();
SetProtocol(ProtocolType.RelayUnityTransport);
@ -434,8 +399,7 @@ namespace Unity.Netcode
/// <param name="key">Allocation key as a byte array.</param>
/// <param name="connectionData">Connection data as a byte array.</param>
/// <param name="isSecure">Whether the connection is secure (uses DTLS).</param>
public void SetHostRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key,
byte[] connectionData, bool isSecure = false)
public void SetHostRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key, byte[] connectionData, bool isSecure = false)
{
SetRelayServerData(ipAddress, port, allocationId, key, connectionData, null, isSecure);
}
@ -448,8 +412,7 @@ namespace Unity.Netcode
/// <param name="connectionData">Connection data as a byte array.</param>
/// <param name="hostConnectionData">Host's connection data as a byte array.</param>
/// <param name="isSecure">Whether the connection is secure (uses DTLS).</param>
public void SetClientRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key,
byte[] connectionData, byte[] hostConnectionData, bool isSecure = false)
public void SetClientRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key, byte[] connectionData, byte[] hostConnectionData, bool isSecure = false)
{
SetRelayServerData(ipAddress, port, allocationId, key, connectionData, hostConnectionData, isSecure);
}
@ -548,8 +511,7 @@ namespace Unity.Netcode
// in the stream (the send queue does that automatically) we are sure they'll be
// reassembled properly at the other end. This allows us to lift the limit of ~44KB
// on reliable payloads (because of the reliable window size).
var written = pipeline == m_ReliableSequencedPipeline
? queue.FillWriterWithBytes(ref writer) : queue.FillWriterWithMessages(ref writer);
var written = pipeline == m_ReliableSequencedPipeline ? queue.FillWriterWithBytes(ref writer) : queue.FillWriterWithMessages(ref writer);
result = m_Driver.EndSend(writer);
if (result == written)
@ -566,8 +528,7 @@ namespace Unity.Netcode
// just get the same error again).
if (result != (int)Networking.Transport.Error.StatusCode.NetworkSendQueueFull)
{
Debug.LogError("Error sending the message: " +
ErrorUtilities.ErrorToString((Networking.Transport.Error.StatusCode)result, clientId));
Debug.LogError("Error sending the message: " + ErrorUtilities.ErrorToString((Networking.Transport.Error.StatusCode)result, clientId));
queue.Consume(written);
}
@ -580,7 +541,7 @@ namespace Unity.Netcode
{
var connection = m_Driver.Accept();
if (connection == default(NetworkConnection))
if (connection == default)
{
return false;
}
@ -638,7 +599,7 @@ namespace Unity.Netcode
{
InvokeOnTransportEvent(NetcodeNetworkEvent.Connect,
clientId,
default(ArraySegment<byte>),
default,
Time.realtimeSinceStartup);
m_State = State.Connected;
@ -666,7 +627,7 @@ namespace Unity.Netcode
InvokeOnTransportEvent(NetcodeNetworkEvent.Disconnect,
clientId,
default(ArraySegment<byte>),
default,
Time.realtimeSinceStartup);
return true;
@ -703,7 +664,10 @@ namespace Unity.Netcode
}
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
ExtractNetworkMetrics();
if (NetworkManager)
{
ExtractNetworkMetrics();
}
#endif
}
}
@ -839,7 +803,7 @@ namespace Unity.Netcode
// should be also noted on the client this will call shutdown on the NetworkManager and the Transport
InvokeOnTransportEvent(NetcodeNetworkEvent.Disconnect,
m_ServerClientId,
default(ArraySegment<byte>),
default,
Time.realtimeSinceStartup);
}
}
@ -885,8 +849,7 @@ namespace Unity.Netcode
public override void Initialize(NetworkManager networkManager = null)
{
Debug.Assert(sizeof(ulong) == UnsafeUtility.SizeOf<NetworkConnection>(),
"Netcode connection id size does not match UTP connection id size");
Debug.Assert(sizeof(ulong) == UnsafeUtility.SizeOf<NetworkConnection>(), "Netcode connection id size does not match UTP connection id size");
NetworkManager = networkManager;

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6960e84d07fb87f47956e7a81d71c4e6
guid: 2197ac38f6f774b1c98d677ba17b12b1
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -10,7 +10,9 @@
"Unity.Multiplayer.Tools.NetStats",
"Unity.Multiplayer.Tools.NetStatsReporting",
"Unity.Multiplayer.Tools.NetworkSolutionInterface",
"Unity.Collections"
"Unity.Networking.Transport",
"Unity.Collections",
"Unity.Burst"
],
"allowUnsafeCode": true,
"versionDefines": [

Просмотреть файл

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;
@ -109,9 +110,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
public enum InstanceTransport
{
SIP,
#if UTP_ADAPTER
UTP
#endif
}
internal static IntegrationTestSceneHandler ClientSceneHandler = null;
@ -172,12 +171,10 @@ namespace Unity.Netcode.TestHelpers.Runtime
switch (instanceTransport)
{
case InstanceTransport.SIP:
default:
return go.AddComponent<SIPTransport>();
#if UTP_ADAPTER
default:
case InstanceTransport.UTP:
return go.AddComponent<UnityTransport>();
#endif
}
}

Просмотреть файл

@ -3,7 +3,6 @@
"rootNamespace": "Unity.Netcode.TestHelpers.Runtime",
"references": [
"Unity.Netcode.Runtime",
"Unity.Netcode.Adapter.UTP",
"Unity.Multiplayer.MetricTypes",
"Unity.Multiplayer.NetStats",
"Unity.Multiplayer.Tools.MetricTypes",
@ -18,11 +17,6 @@
"expression": "",
"define": "MULTIPLAYER_TOOLS"
},
{
"name": "com.unity.netcode.adapter.utp",
"expression": "",
"define": "UTP_ADAPTER"
},
{
"name": "com.unity.multiplayer.tools",
"expression": "1.0.0-pre.7",

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8a093c5e4dedd224891d2e8a197de43a
guid: f4ecf3bb8c5654c1aae7f73d21e8c56e
folderAsset: yes
DefaultImporter:
externalObjects: {}

Просмотреть файл

@ -1,10 +1,10 @@
using System;
using NUnit.Framework;
using Unity.Collections;
using Unity.Netcode.Transports.UTP;
using Unity.Networking.Transport;
using Unity.Netcode.UTP.Utilities;
namespace Unity.Netcode.UTP.EditorTests
namespace Unity.Netcode.EditorTests
{
public class BatchedReceiveQueueTests
{

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9228b9e34a97c3d4cae09c689cbe2cdc
guid: aabb21b30a80142ea86e59d1b4d5c587
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -1,10 +1,10 @@
using System;
using NUnit.Framework;
using Unity.Collections;
using Unity.Netcode.Transports.UTP;
using Unity.Networking.Transport;
using Unity.Netcode.UTP.Utilities;
namespace Unity.Netcode.UTP.EditorTests
namespace Unity.Netcode.EditorTests
{
public class BatchedSendQueueTests
{

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 75c15a6fff41a08408efa187a2ab6fd7
guid: 51a68dc80bf18443180f3600eb5890d7
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -1,7 +1,8 @@
using NUnit.Framework;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
namespace Unity.Netcode.UTP.EditorTests
namespace Unity.Netcode.EditorTests
{
public class UnityTransportTests
{

Просмотреть файл

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1559305d14837ed449c15c194aff6e6b
guid: 1b0137a26ef0140f0bf5167c09eecb96
MonoImporter:
externalObjects: {}
serializedVersion: 2

Просмотреть файл

@ -9,7 +9,8 @@
"Unity.Multiplayer.MetricTypes",
"Unity.Multiplayer.NetStats",
"Unity.Multiplayer.Tools.MetricTypes",
"Unity.Multiplayer.Tools.NetStats"
"Unity.Multiplayer.Tools.NetStats",
"Unity.Networking.Transport"
],
"optionalUnityReferences": [
"TestAssemblies"

Просмотреть файл

@ -15,11 +15,7 @@ namespace Unity.Netcode.RuntimeTests.Metrics
protected override void OnOneTimeSetup()
{
#if UTP_ADAPTER
m_NetworkTransport = NetcodeIntegrationTestHelpers.InstanceTransport.UTP;
#else
m_NetworkTransport = NetcodeIntegrationTestHelpers.InstanceTransport.SIP;
#endif
base.OnOneTimeSetup();
}

Просмотреть файл

@ -46,11 +46,7 @@ namespace Unity.Netcode.RuntimeTests.Metrics
/// </summary>
protected override void OnOneTimeSetup()
{
#if UTP_ADAPTER
m_NetworkTransport = NetcodeIntegrationTestHelpers.InstanceTransport.UTP;
#else
m_NetworkTransport = NetcodeIntegrationTestHelpers.InstanceTransport.SIP;
#endif
}
[UnityTest]

Просмотреть файл

@ -3,13 +3,14 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UnityEngine.TestTools;
using static Unity.Netcode.UTP.RuntimeTests.RuntimeTestsHelpers;
using static Unity.Netcode.RuntimeTests.UnityTransportTestHelpers;
namespace Unity.Netcode.UTP.RuntimeTests
namespace Unity.Netcode.RuntimeTests
{
public class ConnectionTests
public class UnityTransportConnectionTests
{
// For tests using multiple clients.
private const int k_NumClients = 5;

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a6b90810a6304cd98c615c9828888a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -2,12 +2,13 @@ using NUnit.Framework;
using System.Collections;
using Unity.Networking.Transport;
using Unity.Networking.Transport.Utilities;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UTPNetworkEvent = Unity.Networking.Transport.NetworkEvent;
using static Unity.Netcode.UTP.RuntimeTests.RuntimeTestsHelpers;
using static Unity.Netcode.RuntimeTests.UnityTransportTestHelpers;
namespace Unity.Netcode.UTP.RuntimeTests
namespace Unity.Netcode.RuntimeTests
{
// Thin wrapper around a UTP NetworkDriver that can act as a client to a UnityTransport server.
// In particular that means the pipelines are set up the same way as in UnityTransport.
@ -15,7 +16,7 @@ namespace Unity.Netcode.UTP.RuntimeTests
// The only reason it's defined as a MonoBehaviour is that OnDestroy is the only reliable way
// to get the driver's Dispose method called from a UnityTest. Making it disposable would be
// the preferred solution, but that doesn't always mesh well with coroutines.
public class DriverClient : MonoBehaviour
public class UnityTransportDriverClient : MonoBehaviour
{
private NetworkDriver m_Driver;
public NetworkDriver Driver => m_Driver;
@ -35,7 +36,6 @@ namespace Unity.Netcode.UTP.RuntimeTests
private void Awake()
{
var maxCap = UnityTransport.InitialMaxPayloadSize + 128;
var settings = new NetworkSettings();
@ -47,9 +47,7 @@ namespace Unity.Netcode.UTP.RuntimeTests
m_UnreliableSequencedPipeline = m_Driver.CreatePipeline(typeof(UnreliableSequencedPipelineStage));
m_ReliableSequencedPipeline = m_Driver.CreatePipeline(typeof(ReliableSequencedPipelineStage));
m_ReliableSequencedFragmentedPipeline = m_Driver.CreatePipeline(
typeof(FragmentationPipelineStage), typeof(ReliableSequencedPipelineStage)
);
m_ReliableSequencedFragmentedPipeline = m_Driver.CreatePipeline(typeof(FragmentationPipelineStage), typeof(ReliableSequencedPipelineStage));
}
private void Update()

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a087bb407f16c402dbc67a2ab9386eab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -2,10 +2,12 @@ using NUnit.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
namespace Unity.Netcode.UTP.RuntimeTests
namespace Unity.Netcode.RuntimeTests
{
public static class RuntimeTestsHelpers
public static class UnityTransportTestHelpers
{
// Half a second might seem like a very long time to wait for a network event, but in CI
// many of the machines are underpowered (e.g. old Android devices or Macs) and there are
@ -14,8 +16,7 @@ namespace Unity.Netcode.UTP.RuntimeTests
public const float MaxNetworkEventWaitTime = 0.5f;
// Wait for an event to appear in the given event list (must be the very next event).
public static IEnumerator WaitForNetworkEvent(NetworkEvent type, List<TransportEvent> events,
float timeout = MaxNetworkEventWaitTime)
public static IEnumerator WaitForNetworkEvent(NetworkEvent type, List<TransportEvent> events, float timeout = MaxNetworkEventWaitTime)
{
int initialCount = events.Count;
float startTime = Time.realtimeSinceStartup;
@ -35,8 +36,7 @@ namespace Unity.Netcode.UTP.RuntimeTests
}
// Common code to initialize a UnityTransport that logs its events.
public static void InitializeTransport(out UnityTransport transport, out List<TransportEvent> events,
int maxPayloadSize = UnityTransport.InitialMaxPayloadSize)
public static void InitializeTransport(out UnityTransport transport, out List<TransportEvent> events, int maxPayloadSize = UnityTransport.InitialMaxPayloadSize)
{
var logger = new TransportEventLogger();
events = logger.Events;

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3af9d71bc7c414cebad947e6340de223
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -4,13 +4,14 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UnityEngine.TestTools;
using static Unity.Netcode.UTP.RuntimeTests.RuntimeTestsHelpers;
using static Unity.Netcode.RuntimeTests.UnityTransportTestHelpers;
namespace Unity.Netcode.UTP.RuntimeTests
namespace Unity.Netcode.RuntimeTests
{
public class TransportTests
public class UnityTransportTests
{
// No need to test all reliable delivery methods since they all map to the same pipeline.
private static readonly NetworkDelivery[] k_DeliveryParameters =

Просмотреть файл

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66e054c3619ad4bd982e351eb8d63087
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Просмотреть файл

@ -9,7 +9,7 @@
"Unity.Multiplayer.NetStats",
"Unity.Multiplayer.Tools.MetricTypes",
"Unity.Multiplayer.Tools.NetStats",
"Unity.Netcode.Adapter.UTP",
"Unity.Networking.Transport",
"ClientNetworkTransform",
"Unity.Netcode.TestHelpers.Runtime"
],
@ -27,11 +27,6 @@
"expression": "(0,2022.2.0a5)",
"define": "UNITY_UNET_PRESENT"
},
{
"name": "com.unity.netcode.adapter.utp",
"expression": "",
"define": "UTP_ADAPTER"
},
{
"name": "com.unity.multiplayer.tools",
"expression": "1.0.0-pre.7",

Просмотреть файл

@ -6,6 +6,7 @@
"unity": "2020.3",
"dependencies": {
"com.unity.nuget.mono-cecil": "1.10.1",
"com.unity.collections": "1.1.0"
"com.unity.collections": "1.1.0",
"com.unity.transport": "1.0.0-pre.15"
}
}

Просмотреть файл

@ -1,7 +1,7 @@
{
"dependencies": {
"com.unity.burst": {
"version": "1.5.4",
"version": "1.6.4",
"depth": 2,
"source": "registry",
"dependencies": {
@ -27,8 +27,8 @@
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",
"depth": 3,
"version": "1.2.5",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
@ -39,7 +39,8 @@
"source": "local",
"dependencies": {
"com.unity.nuget.mono-cecil": "1.10.1",
"com.unity.collections": "1.1.0"
"com.unity.collections": "1.1.0",
"com.unity.transport": "1.0.0-pre.15"
}
},
"com.unity.nuget.mono-cecil": {
@ -60,6 +61,17 @@
},
"url": "https://packages.unity.com"
},
"com.unity.transport": {
"version": "1.0.0-pre.15",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.collections": "1.1.0",
"com.unity.burst": "1.6.4",
"com.unity.mathematics": "1.2.5"
},
"url": "https://packages.unity.com"
},
"com.unity.modules.imgui": {
"version": "1.0.0",
"depth": 3,

Просмотреть файл

@ -24,11 +24,6 @@
"expression": "(0,2022.2.0a5)",
"define": "UNITY_UNET_PRESENT"
},
{
"name": "com.unity.netcode.adapter.utp",
"expression": "",
"define": "UTP_ADAPTER"
},
{
"name": "com.unity.multiplayer.tools",
"expression": "1.0.0-pre.4",

Просмотреть файл

@ -3,7 +3,6 @@
"dependencies": {
"com.unity.ide.rider": "3.0.7",
"com.unity.multiplayer.tools": "https://github.com/Unity-Technologies/com.unity.multiplayer.tools.git#cfb8fd305c3e46bb1251b40ec5f6cb621a267e7f",
"com.unity.netcode.adapter.utp": "file:../../com.unity.netcode.adapter.utp",
"com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects",
"com.unity.test-framework": "1.1.31",
"com.unity.test-framework.performance": "2.8.0-preview",

Просмотреть файл

@ -53,27 +53,16 @@
"com.unity.collections": "1.1.0",
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.netcode.adapter.utp": {
"version": "file:../../com.unity.netcode.adapter.utp",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.netcode.gameobjects": "1.0.0-pre.5",
"com.unity.transport": "1.0.0-pre.13"
}
"hash": "cfb8fd305c3e46bb1251b40ec5f6cb621a267e7f"
},
"com.unity.netcode.gameobjects": {
"version": "file:../../com.unity.netcode.gameobjects",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.nuget.mono-cecil": "1.10.1",
"com.unity.collections": "1.1.0"
"com.unity.collections": "1.1.0",
"com.unity.transport": "1.0.0-pre.15"
}
},
"com.unity.nuget.mono-cecil": {
@ -119,7 +108,7 @@
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.transport": {
"version": "1.0.0-pre.13",
"version": "1.0.0-pre.15",
"depth": 1,
"source": "registry",
"dependencies": {

Просмотреть файл

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Unity.Netcode;
using Unity.Netcode.Transports.UTP;
#if UNITY_UNET_PRESENT
using Unity.Netcode.Transports.UNET;
#endif

Просмотреть файл

@ -1,8 +1,7 @@
using System.Collections;
using UnityEngine;
using Unity.Netcode;
using Unity.Netcode.Transports.UTP;
#if ENABLE_RELAY_SERVICE
using System;
using Unity.Services.Core;

Просмотреть файл

@ -1,5 +1,6 @@
using UnityEngine;
using Unity.Netcode;
using Unity.Netcode.Transports.UTP;
#if ENABLE_RELAY_SERVICE
using Unity.Services.Core;
using Unity.Services.Authentication;

Просмотреть файл

@ -5,7 +5,6 @@
"Unity.Netcode.Runtime",
"Unity.Netcode.Editor",
"Unity.Netcode.Components",
"Unity.Netcode.Adapter.UTP",
"Unity.Services.Authentication",
"Unity.Services.Core",
"Unity.Services.Relay"

Просмотреть файл

@ -5,7 +5,6 @@
"com.unity.ide.visualstudio": "2.0.11",
"com.unity.ide.vscode": "1.2.3",
"com.unity.mathematics": "1.2.1",
"com.unity.netcode.adapter.utp": "file:../../com.unity.netcode.adapter.utp",
"com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects",
"com.unity.package-validation-suite": "0.21.0-preview",
"com.unity.services.authentication": "1.0.0-pre.4",
@ -50,7 +49,6 @@
"com.unity.modules.xr": "1.0.0"
},
"testables": [
"com.unity.netcode.gameobjects",
"com.unity.netcode.adapter.utp"
"com.unity.netcode.gameobjects"
]
}

Просмотреть файл

@ -65,22 +65,14 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.netcode.adapter.utp": {
"version": "file:../../com.unity.netcode.adapter.utp",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.netcode.gameobjects": "1.0.0-pre.6",
"com.unity.transport": "1.0.0-pre.15"
}
},
"com.unity.netcode.gameobjects": {
"version": "file:../../com.unity.netcode.gameobjects",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.nuget.mono-cecil": "1.10.1",
"com.unity.collections": "1.1.0"
"com.unity.collections": "1.1.0",
"com.unity.transport": "1.0.0-pre.15"
}
},
"com.unity.nuget.mono-cecil": {