Skip to content

Commit c70aaff

Browse files
authored
Merge pull request #376 from jdcook/feature/doc-updates
docs: fixed some typos, added some links, added prefab hash info
2 parents 2e5750c + e32e801 commit c70aaff

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

MLAPI/Messaging/CustomMessageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static void UnregisterNamedMessageHandler(string name)
157157
/// <param name="name">The message name to send</param>
158158
/// <param name="clientId">The client to send the message to</param>
159159
/// <param name="stream">The message stream containing the data</param>
160-
/// <param name="channel">The channel tos end the data on</param>
160+
/// <param name="channel">The channel to send the data on</param>
161161
/// <param name="security">The security settings to apply to the message</param>
162162
public static void SendNamedMessage(string name, ulong clientId, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
163163
{

docs/_docs/advanced-topics/bitwriter-bitreader-bitstream.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ title: BitWriter, BitReader & BitStream
33
permalink: /wiki/bitwriter-bitreader-bitstream/
44
---
55

6-
Internally, the MLAPI uses Streams for it's data. This gives a ton of flexibility for the end user. If the end user for example doesn't want to use Streams but rather just byte arrays at their own level. They can do so by wrapping their arrays in MemoryStreams which doesn't create any garbage.
6+
Internally, the MLAPI uses Streams for it's data. This gives a ton of flexibility for the end user. If the end user for example doesn't want to use Streams but rather just byte arrays at their own level. They can do so by wrapping their arrays in MemoryStreams which don't create any garbage.
77

88

9-
The MLAPI does have it's own prefered Stream that is used internally. It's called the BitStream.
9+
The MLAPI does have its own prefered Stream that is used internally. It's called the BitStream.
1010

1111
## BitStream
1212
The BitStream is a Stream implementation that functions in a similar way as the MemoryStream. The main difference is that the BitStream have methods for operating on the Bit level rather than the Byte level.
@@ -34,18 +34,18 @@ When using the "Packed" versions of a write or read, the output will be VarInted
3434
When using the "Diff" versions of an array write or read, the output will be the diff between two arrays, allowing for delta encoding.
3535

3636
#### Unity Types
37-
The BitWriter & BitReader supports many data types by default such as Vector3, Vector2, Ray, Quaternion and more.
37+
The BitWriter & BitReader support many data types by default such as Vector3, Vector2, Ray, Quaternion and more.
3838

3939
#### BitWise Writing
40-
If you for example have an enum with 5 values. All those values could be fit into 3 bits. With the BitWriter, this can be done like this:
40+
If you for example have an enum with 5 values. All those values could fit into 3 bits. With the BitWriter, this can be done like this:
4141

4242
```csharp
4343
writer.WriteBits((byte)MyEnum.MyEnumValue, 3);
4444
MyEnum value = (Myenum)reader.ReadBits(3);
4545
```
4646

47-
#### Performance concideration
48-
When the stream is not aligned, (BitAligned == false, this occurs when writing bits that does fill the whole byte, or when writing bools as they are written as bits), performance is decreased for each write and read. This is only a big concern if you are about to write a large amount of data after not being aligned. To solve this, the BitWriter allows you to "WritePadBits" and the BitReader then lets you skip those bits with "SkipPadBits" to align the stream to the nearest byte.
47+
#### Performance consideration
48+
When the stream is not aligned, (BitAligned == false, this occurs when writing bits that do fill the whole byte, or when writing bools as they are written as bits), performance is decreased for each write and read. This is only a big concern if you are about to write a large amount of data after not being aligned. To solve this, the BitWriter allows you to "WritePadBits" and the BitReader then lets you skip those bits with "SkipPadBits" to align the stream to the nearest byte.
4949

5050
```csharp
5151
writer.WriteBool(true); //Now the stream is no longer aligned. Every byte has to be offset by 1 bit.
@@ -59,7 +59,7 @@ reader.ReadByteArray(myOutputArray, 1024);
5959
```
6060

6161
### Pooled BitReader/Writer
62-
The writer and reader also has pooled versions to avoid allocating the classes themselves. You might aswell use them.
62+
The writer and reader also has pooled versions to avoid allocating the classes themselves. You might as well use them.
6363

6464
```csharp
6565
using (PooledBitReader reader = PooledBitReader.Get(myStreamToReadFrom))

docs/_docs/core-components/networked-object.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ The NetworkedObject is a fairly simple component. It has no settings. It's a com
77

88
If you want to use NetworkedBehaviours. You need a NetworkedObject at the same GameObject or in a parent. Each NetworkedObject has a "netId", a networkId for the GameObject. This is used by many parts of the MLAPI. From the message targeting system to the object spawning.
99

10-
The components presence should have no performance impact as it has to game loop.
10+
The component's presence should have no performance impact as it has no game loop.

docs/_docs/getting-started/connection-approval.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ private void ApprovalCheck(byte[] connectionData, ulong clientId, MLAPI.Networki
1919
bool approve = true;
2020
bool createPlayerObject = true;
2121

22-
ulong? prefabHash = SpawnManager.GetPrefabHashFromGenerator("MyPrefabHashGenerator"); // The prefab hash. Use null to use the default player prefab
22+
// The prefab hash. Use null to use the default player prefab
23+
// If using this hash, replace "MyPrefabHashGenerator" with the name of a prefab added to the NetworkedPrefabs field of your NetworkingManager object in the scene
24+
ulong? prefabHash = SpawnManager.GetPrefabHashFromGenerator("MyPrefabHashGenerator");
2325

2426
//If approve is true, the connection gets added. If it's false. The client gets disconnected
2527
callback(createPlayerObject, prefabHash, approve, positionToSpawnAt, rotationToSpawnWith);

docs/_docs/getting-started/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ To get started with the MLAPI. You need to install the library. The easiest way
1010
![Video showing the install process](https://i.imgur.com/zN63DlJ.gif)
1111

1212

13-
Once imported into the Unity Engine, you will be able to use the components that it offers. To get started, you need a GameObject with the NetworkingManager component. Once you have that, use the Initializing the library articles to continue.
13+
Once imported into the Unity Engine, you will be able to use the components that it offers. To get started, you need a GameObject with the NetworkingManager component. Once you have that, use the [Library Initialization](/wiki/library-initialization/) article to continue.
1414

1515

1616
### Files
1717
The MLAPI comes with 3 main components
1818
##### MLAPI.dll
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.
19+
This DLL 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.
2020
##### MLAPI-Editor.unitypackage
2121
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**.
2222
##### MLAPI-Installer.unitypackage

docs/_docs/getting-started/library-initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Library Initialization
33
permalink: /wiki/library-initialization/
44
---
55

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.
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](/wiki/custom-transports/) page.
77

88

99
To initialize the library. You have three options.

0 commit comments

Comments
 (0)