You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_docs/advanced-topics/custom-transports.md
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,8 @@ title: Custom Transports
3
3
permalink: /wiki/custom-transports/
4
4
---
5
5
6
-
The MLAPI supports custom transports. It uses UNET by default. You can also write custom transports. The MLAPI has a LiteNetLib transport example you can use (See the SampleTransports folder), or write your own one.
7
-
8
-
To do so, you need a class implementing the IUDPTransport interface. The flow works like this
9
-
10
-
GetSettings gets invoked, you can give it any object.
11
-
12
-
if Server, RegisterServerListenSocket get's invoked and gives the settings object.
6
+
The MLAPI supports custom transports. It uses UNET by default. You can also write custom transports. A transport is the library that is responsible for sending the raw bytes and handle connections.
13
7
14
8
Usually, transports doesn't support support all channel types and event types. Sometimes they have more, in that case you manually have to do translation between them. See the LiteNetLib transport for examples.
15
9
16
-
In order to use your own transport, you have to set the Transport to "Custom" and set the NetworkConfig NetworkTransport to your own transport. To get started writing transport interfaces, the current implementations for Unet and LiteNetLib are great starting points for learning their flow. If you do write a transport for a well known transport, feel free to open a PR to add it to the default supported.
10
+
To get started writing transport interfaces, the current implementations for Unet and LiteNetLib are great starting points for learning their flow. If you do write a transport for a well known transport, feel free to open a PR to add it to the default supported.
The connectionData parameter is any custom data of your choice that the client should send to the server. Usually, this should be some sort of ticket, room password or similar that will decide if a connection should be approved or not. The connectionData is specified on the Client side in the NetworkingConfig supplied when connecting. Example:
The ConnectionData will then be passed to the server and it will decide if the client will be approved or not.
34
36
35
-
#### Security of connection data
36
-
If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done.
37
+
38
+
### Timeout
39
+
The MLAPI uses a callback system in order to allow for external validation. Forexample, you might have a steam authentication ticket sent as the ConnectionData (encrypted and authenticated by the MLAPI) that you want to validate against steams servers. This can take some time. If you don't call the callback method within the time specified in the ``ClientConnectionBufferTimeout`` configuration. The connection will be dropped. This time starts counting when the transport has told the MLAPI about the connection. This means that you cannot attack the MLAPI by never sending the buffer, it will still time you out.
40
+
41
+
42
+
### Security
43
+
If connection approval is enabled. Any messages sent before a connection is setup are silently ignored.
44
+
45
+
#### Connection Data
46
+
If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done. If you plan on sending authentication tokens such as steam tickets. It's strongly suggested that you sign the handshake.
Copy file name to clipboardExpand all lines: docs/_docs/getting-started/installation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The MLAPI comes with 3 main components
18
18
##### MLAPI.dll
19
19
This DLL's is the runtime portion. The actual library. This file is thus **required**. It comes in two variants. A "Lite" and a normal version. Most people will do fine with the full version. The Lite version has less features. At the time of writing the only difference is that it does not include encryption which adds better support on certain platforms. Note that the lite version might not be as stable as the full version and could contain additional bugs.
20
20
##### MLAPI-Editor.unitypackage
21
-
This unitypackage includes the source files for all the Editor scripts. The UnityPackage will automatically place these source files in the Editor folder to avoid it being included in a build. **While the MLAPI will function without this, it is not designed to work without the editor part and is thus recommended for all users**.
21
+
This unitypackage includes the source files for all the Editor scripts. The UnityPackage will automatically place these source files in the Editor folder to avoid it being included in a build. **This is required**.
22
22
##### MLAPI-Installer.unitypackage
23
23
This unitypackage includes the source file for the installer. This component is totally optional. The Installer can help you manage versions. If you don't want to use the installer, you can simply place the MLAPI.dll and the Editor source files in your project and it will work just as well.
Copy file name to clipboardExpand all lines: docs/_docs/getting-started/library-initialization.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,14 @@ title: Library Initialization
3
3
permalink: /wiki/library-initialization/
4
4
---
5
5
6
-
Initializing the MLAPI is fairly simple. You need a GameObject with the NetworkingManager component added to it. The NetworkingManager class has a static singleton reference to itself making it easy to access from anywhere.
6
+
Initializing the MLAPI is fairly simple. You need a GameObject with the NetworkingManager component added to it. The NetworkingManager class has a static singleton reference to itself making it easy to access from anywhere. The first configuration you have to do is to set the Transport. You can read more about Transports on the "Custom Transports" page.
7
+
8
+
7
9
To initialize the library. You have three options.
8
10
9
11
### Host mode
10
12
11
-
This mode runs a Server and a virtual Client connected to its own server.
13
+
This mode runs a Server and a virtual Client connected to its own server. The virtual client has no real network connection to the server, but instead just talk via message queues. This makes the host both a Server and a Client in the same process.
This mode runs a Server which other Clients can connect to.
32
+
This mode runs a Server which other Clients can connect to. It has no own client attached, and thus lack it's own player object and such. This is the "dedicated server" mode.
Copy file name to clipboardExpand all lines: docs/_docs/the-basics/messaging-system.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ public float MyRpcWithReturnValue(float x, float y)
80
80
```
81
81
82
82
#### Performance Example
83
-
To use the performance mode, the RPC method require the following signature ``void (uint clientId, Stream readStream)`` and the sender is required to use the non generic Stream overload.
83
+
To use the performance mode, the RPC method require the following signature ``void (ulong clientId, Stream readStream)`` and the sender is required to use the non generic Stream overload.
84
84
85
85
```csharp
86
86
privatevoidUpdate()
@@ -115,7 +115,7 @@ private void Update()
115
115
}
116
116
117
117
[ServerRPC]
118
-
privatevoidMyServerRPC(uintclientId, Streamstream) //This signature is REQUIRED for the performance mode
118
+
privatevoidMyServerRPC(ulongclientId, Streamstream) //This signature is REQUIRED for the performance mode
119
119
{
120
120
using (PooledBitReaderreader=PooledBitReader.Get(stream))
Copy file name to clipboardExpand all lines: docs/_docs/the-basics/networkedvar.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,4 +38,4 @@ If you want values to be synced only once (at spawn), the built-in containers se
38
38
### Serialization
39
39
Since the NetworkedVar class is a generic, editor serialization is NOT supported, it's only avalible through editor scripts for viewing the values. To get proper serialization. A clone of the NetworkedVar implementation has to be done for each type you wish to use. Ex: NetworkedVarInt where you replace all the usages of T with int.
40
40
41
-
The MLAPI provides a few default serializable implementations of the NetworkedVar, they are called NetworkedVar<TYPE> where "<TYPE>" is the type.
41
+
The MLAPI provides a few default serializable implementations of the NetworkedVar, they are called NetworkedVar<TYPE> where "<TYPE>" is the type.
0 commit comments