Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Change log

## [0.2.0-preview.4] - 2019-11-26
### New features
### Changes
* Added support for unquantized floats to `DataStream` class.
* Added `NetworkConfigParameter.maxFrameTimeMS` so you to allow longer frame times when debugging to prevent disconnections due to timeout.
* Allow "1.1.1.1:1234" strings when parsing the IP string in the NetworkEndPoint class, it will use the port part when it's present.
* Reliable pipeline now doesn't require parameters passed in (uses default window size of 32)
* Added Read/Write of ulong to `DataStream`.
* Made it possible to get connection state from the parallel NetworkDriver.
* Added `LengthInBits` to the `DataStreamWriter`.

### Fixes
* Do not push data events to disconnected connections. Fixes an error about resetting the queue with pending messages
* Made the endian checks in `DataStream` compatible with latest version of burst.
### Upgrade guide

## [0.1.2-preview.1] - 2019-07-17
### New features
* Added a new *Ping-Multiplay* sample based on the *Ping* sample
    * Created to be the main sample for demonstrating Multiplay compatibility and best practices (SQP usage, IP binding, etc.)
    * Contains both client and server code.  Additional details in readme in `/Assets/Samples/Ping-Multiplay/`.
* **DedicatedServerConfig**: added arguments for `-fps` and `-timeout`
* **NetworkEndPoint**: Added a `TryParse()` method which returns false if parsing fails
    * Note: The `Parse()` method returns a default IP / Endpoint if parsing fails, but a method that could report failure was needed for the Multiplay sample
* **CommandLine**:
    * Added a `HasArgument()` method which returns true if an argument is present
    * Added a `PrintArgsToLog()` method which is a simple way to print launch args to logs
    * Added a `TryUpdateVariableWithArgValue()` method which updates a ref var only if an arg was found and successfully parsed

### Changes
* Deleted existing SQP code and added reference to SQP Package (now in staging)
* Removed SQP server usage from basic *Ping* sample
    * Note: The SQP server was only needed for Multiplay compatibility, so the addition of *Ping-Multiplay* allowed us to remove SQP from *Ping*

### Fixes
* **DedicatedServerConfig**: Vsync is now disabled programmatically if requesting an FPS different from the current screen refresh rate

### Upgrade guide

## [0.1.1-preview.1] - 2019-06-05
### New features
* Moved MatchMaking to a package and supporting code to a separate folder.

### Fixes
* Fixed an issue with the reliable pipeline not resending when completely idle.

### Upgrade guide

## [0.1.0-preview.1] - 2019-04-16
### New features
* Added network pipelines to enable processing of outgoing and incomming packets. The available pipeline stages are `ReliableSequencedPipelineStage` for reliable UDP messages and `SimulatorPipelineStage` for emulating network conditions such as high latency and packet loss. See [the pipeline documentation](com.unity.transport/Documentation~/pipelines-usage.md) for more information.
* Added reading and writing of packed signed and unsigned integers to `DataStream`. These new methods use huffman encoding to reduce the size of transfered data for small numbers.

### Changes
* Enable Burst compilation for most jobs
* Made it possible to get the remote endpoint for a connection
* Replacing EndPoint parsing with custom code to avoid having a dependency on System.Net
* Change the ping sample command-line parameters for server to -port and -query_port
* For matchmaking - use an Assignment object containing the ConnectionString, the Roster, and an AssignmentError string instead of just the ConnectionString.

### Fixes
* Fixed an issue with building iOS on Windows
* Fixed inconsistent error handling between platforms when the network buffer is full

### Upgrade guide
Unity 2019.1 is now required.

`BasicNetworkDriver` has been renamed to `GenericNetworkDriver` and a new `UdpNetworkDriver` helper class is also available.

System.Net EndPoints can no longer be used as addresses, use the new NetworkEndpoint struct instead.
  • Loading branch information
Unity Technologies committed Nov 25, 2019
0 parents commit 5a6718e
Show file tree
Hide file tree
Showing 136 changed files with 15,093 additions and 0 deletions.
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Change log

## [0.2.0-preview.4] - 2019-11-26
### New features
### Changes
* Added support for unquantized floats to `DataStream` class.
* Added `NetworkConfigParameter.maxFrameTimeMS` so you to allow longer frame times when debugging to prevent disconnections due to timeout.
* Allow "1.1.1.1:1234" strings when parsing the IP string in the NetworkEndPoint class, it will use the port part when it's present.
* Reliable pipeline now doesn't require parameters passed in (uses default window size of 32)
* Added Read/Write of ulong to `DataStream`.
* Made it possible to get connection state from the parallel NetworkDriver.
* Added `LengthInBits` to the `DataStreamWriter`.

### Fixes
* Do not push data events to disconnected connections. Fixes an error about resetting the queue with pending messages
* Made the endian checks in `DataStream` compatible with latest version of burst.
### Upgrade guide

## [0.1.2-preview.1] - 2019-07-17
### New features
* Added a new *Ping-Multiplay* sample based on the *Ping* sample
* Created to be the main sample for demonstrating Multiplay compatibility and best practices (SQP usage, IP binding, etc.)
* Contains both client and server code. Additional details in readme in `/Assets/Samples/Ping-Multiplay/`.
* **DedicatedServerConfig**: added arguments for `-fps` and `-timeout`
* **NetworkEndPoint**: Added a `TryParse()` method which returns false if parsing fails
* Note: The `Parse()` method returns a default IP / Endpoint if parsing fails, but a method that could report failure was needed for the Multiplay sample
* **CommandLine**:
* Added a `HasArgument()` method which returns true if an argument is present
* Added a `PrintArgsToLog()` method which is a simple way to print launch args to logs
* Added a `TryUpdateVariableWithArgValue()` method which updates a ref var only if an arg was found and successfully parsed

### Changes
* Deleted existing SQP code and added reference to SQP Package (now in staging)
* Removed SQP server usage from basic *Ping* sample
* Note: The SQP server was only needed for Multiplay compatibility, so the addition of *Ping-Multiplay* allowed us to remove SQP from *Ping*

### Fixes
* **DedicatedServerConfig**: Vsync is now disabled programmatically if requesting an FPS different from the current screen refresh rate

### Upgrade guide

## [0.1.1-preview.1] - 2019-06-05
### New features
* Moved MatchMaking to a package and supporting code to a separate folder.

### Fixes
* Fixed an issue with the reliable pipeline not resending when completely idle.

### Upgrade guide

## [0.1.0-preview.1] - 2019-04-16
### New features
* Added network pipelines to enable processing of outgoing and incomming packets. The available pipeline stages are `ReliableSequencedPipelineStage` for reliable UDP messages and `SimulatorPipelineStage` for emulating network conditions such as high latency and packet loss. See [the pipeline documentation](com.unity.transport/Documentation~/pipelines-usage.md) for more information.
* Added reading and writing of packed signed and unsigned integers to `DataStream`. These new methods use huffman encoding to reduce the size of transfered data for small numbers.

### Changes
* Enable Burst compilation for most jobs
* Made it possible to get the remote endpoint for a connection
* Replacing EndPoint parsing with custom code to avoid having a dependency on System.Net
* Change the ping sample command-line parameters for server to -port and -query_port
* For matchmaking - use an Assignment object containing the ConnectionString, the Roster, and an AssignmentError string instead of just the ConnectionString.

### Fixes
* Fixed an issue with building iOS on Windows
* Fixed inconsistent error handling between platforms when the network buffer is full

### Upgrade guide
Unity 2019.1 is now required.

`BasicNetworkDriver` has been renamed to `GenericNetworkDriver` and a new `UdpNetworkDriver` helper class is also available.

System.Net EndPoints can no longer be used as addresses, use the new NetworkEndpoint struct instead.
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Unity Transport manual

* **Introduction**
* [Unity Transport overview](index.md)
* [Installation guide](install.md)
* **Workflows**
* [Creating a minimal client and server](workflow-client-server.md)
* [Creating a jobified client and server](workflow-client-server-jobs.md)
* [Using pipelines](pipelines-usage.md)
* **Background information**
* [Understanding the Update flow](update-flow.md)
* [Understanding the Connection State Machine](connection-state-machine.md)
* [Event consumption](event-consumption.md)
* **Samples**
* [ClientBehaviour](samples/clientbehaviour.cs.md)
* [ServerBehaviour](samples/serverbehaviour.cs.md)
* [JobifiedClientBehaviour](samples/jobifiedclientbehaviour.cs.md)
* [JobifiedServerBehaviour](samples/jobifiedserverbehaviour.cs.md)
* [Source Project for Workflows](https://oc.unity3d.com/index.php/s/PHaNZP79Va2YOLT)

17 changes: 17 additions & 0 deletions Documentation~/connection-state-machine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Understanding the Connection State Machine

It's important to at least understand how transitions occur in the connection state machine so you make decisions depending on what triggered each state. And to understand the subtle differences depending if you are `Connecting` to another host or if you simply want to Listen for incoming connections. As you can see below the state machine for the `NetworkConnection` is pretty simple.

![ConnectionState](images/com.unity.transport.connection.png)

All connections start in `Disconnected` state.

- Depending what state the `NetworkDriver` is in, the `Listening (Passive)` state might be triggered. This is when the driver acts like a server listening for incoming connections and data requests. And secondly you could try to use the driver to connect to a remote endpoint and then we would invoke another flow of the state machine.

So to give a overview we have two standard scenarios. Either you listen for incoming connections or you use and outgoing connection to connect to someone else.

In our [client/server workflow](workflow-client-server.md) we use the ServerBehaviour to `Listen` and the ClientBehaviour to `Connect`.



[Back to table of contents](TableOfContents.md)
60 changes: 60 additions & 0 deletions Documentation~/event-consumption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Event consumption

There are currently 4 types of events supplied by the `NetworkDriver`

```c#
public enum Type
{
Empty = 0,
Data,
Connect,
Disconnect
}
```

As mentioned, there are a few subtle differences running the driver as a host or client. Mainly when it comes to consumption of events.

Both your client and you server loop will want to consume the events that are produced by the `NetworkDriver`. And you do so by either calling `PopEvent` on each `NetworkConnection` similar to how we did before.

```c#
DataStreamReader strm;
NetworkEvent.Type cmd;
while ((cmd = m_Connection.PopEvent(driver, out strm)) != NetworkEvent.Type.Empty)
; // Handle Event
```

You can try calling the `PopEventForConnection` on the `NetworkDriver` as we did in the ServerBehaviour example:

```c#
DataStreamReader strm;
NetworkEvent.Type cmd;
while ((cmd = m_Driver.PopEventForConnection(m_Connections[i], out strm)) != NetworkEvent.Type.Empty)
; // Handle Event
```

There is no real difference between these calls, both calls will do the same thing. Its just how you want to phrase yourself when writing the code.

And finally to receive a new `NetworkConnection` on the Driver while Listening you can call `Accept`

```c#
NetworkConnection c;
while ((c = m_Driver.Accept()) != default(NetworkConnection))
; // Handle Connection Event.
```

| Event | Description |
| ---------- | ------------------------------------------------------------ |
| Empty | The `Empty` event signals that there are no more messages in our event queue to handle this frame. |
| Data | The `Data` event signals that we have received data from a connected endpoint. |
| Connect | The `Connect` event signals that a new connection has been established.<br> **Note**: this event is only available if the `NetworkDriver` is **not** in the `Listening` state. |
| Disconnect | The `Disconnect` event is received if;<br> 1. `Disconnect` packet was received (calling `NetworkConnection::Disconnect` will trigger this.)<br> 2. A *socket timeout* occurred.<br> 3. Maximum connect attempts on the `NetworkConnection` exceeded. <br> **Note:** That if you call `Disconnect` on your `NetworkConnection` this will **NOT** trigger an `Disconnect` event on your local `NetworkDriver`. |

Looking at this table we see that there are 2 things that stand out.

- The first thing is that the `Connect` event is only available if the `NetworkDriver` is **NOT** `Listening`
- In order to receive any `Connect` events on a `NetworkDriver` that is in the `Listening` state we need to call the special function `Accept` just as we did in the *Creating a Server* section in the [Creating a minimal client and server](workflow-client-server.md) workflow page.
- The second thing to notice is that if you call `Disconnect` on a `NetworkConnection` this will not trigger an event inside your own driver.



[Back to table of contents](TableOfContents.md)
Binary file added Documentation~/images/Pipeline-stages-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/images/console-view.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/images/game-object.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/images/inspector.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/images/layercake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions Documentation~/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# About Unity.Networking.Transport

Use the `com.unity.transport` package to add multiplayer / network features to your project.

## Overview

![Transport Overview](images/layercake.png)

# Installing Unity.Networking.Transport

For installation instructions on the `com.unity.transport` package, follow the [installation guide](install.md).

# Using Unity.Networking.Transport

To learn how to use the `com.unity.transport` package in your own project, read the [manual](TableOfContents.md).

> **Note**: Once you have installed the package, it is recommended that you read through the client and server workflows first.
# Technical details

## Requirements

This version of `com.unity.transport` is compatible with the following versions of the Unity Editor:

* 2019.1 and later

## Known limitations

Unity.Networking.Transport version 0.1.0 has the following limitations:

* Currently only supports the platforms
* Windows, Linux, Mac OSX, iOS and Android

## Package contents

The following table shows the package folder contents.

|Location|Description|
|---|---|
|`Documentation`|Contains manual part of the documentation (script reference is inline using xmldoc).|
|`Runtime`|Contains the implementation.|
|`Tests`|Contains all the tests.|


## Document revision history

|Date|Reason|
|---|---|
|Oct 22, 2018|Documentation reorganised and proofread by Technical Writer.|
|Jul 18, 2018|Document created. Matches package version 0.1.0.|
13 changes: 13 additions & 0 deletions Documentation~/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Installing com.unity.transport

1. Open the Unity Editor (`2019.1.0f1` or later)
2. Create a new Project.
3. Open the Package Manager (menu: **Window** > **Package Manager**).
4. Click the **Advanced** button at the top of the window and turn on the **Show preview packages** option.
5. Add the `Unity Transport` package to the project.

> Note: If you encounter errors, please [report an issue](https://github.com/Unity-Technologies/multiplayer/issues) in the repository.

[Back to table of contents](TableOfContents.md)

Loading

0 comments on commit 5a6718e

Please sign in to comment.