Skip to content

Commit

Permalink
NGO 2.1.1 (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbacakes authored Oct 21, 2024
1 parent 00007de commit 306be64
Show file tree
Hide file tree
Showing 114 changed files with 15,182 additions and 5 deletions.
19 changes: 15 additions & 4 deletions docs/components/networkmanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: NetworkManager

The `NetworkManager` is a required Netcode for GameObjects component that has all of your project's netcode-related settings. Think of it as the central netcode hub for your netcode-enabled project.

### `NetworkManager` Inspector properties
## `NetworkManager` Inspector properties

- **LogLevel**: Sets the network logging level
- **PlayerPrefab**: When a prefab is assigned, the prefab will be instantiated as the PlayerObject and assigned to the newly connected and authorized client. For more information about player prefabs, refer to [PlayerObjects and player prefabs](../basics/playerobjects.md).
Expand All @@ -22,12 +22,19 @@ The `NetworkManager` is a required Netcode for GameObjects component that has al
- **Enable Scene Management**: When checked, Netcode for GameObjects will handle scene management and client synchronization for you. When not checked, you will have to create your own scene management scripts and handle client synchronization.
- **Load Scene Time Out**: When Enable Scene Management is checked, this specifies the period of time the `NetworkSceneManager` will wait while a scene is being loaded asynchronously before `NetworkSceneManager` considers the load/unload scene event to have failed/timed out.

## Starting and stopping `NetworkManager`

There are two static event notifications available when [starting](#starting-a-server-host-or-client) or [stopping](#disconnecting-and-shutting-down) `NetworkManager`. If you need to know when a `NetworkManager` has been instantiated or when it's in the process of being destroyed, there are two event notifications you can subscribe to:

- The `NetworkManager.OnInstantiated` notification is triggered when a new `NetworkManager` instance has been instantiated.
- The `NetworkManager.OnDestroying` notification is triggered when an existing `NetworkManager` instance is being destroyed.

### `NetworkManager` sub-systems

`NetworkManager` is also where you can find references to other Netcode related management systems:<br/>
`NetworkManager` is also where you can find references to other Netcode-related management systems:

:::caution
All `NetworkManager` sub-systems are instantiated once the `NetworkManager` is started (that is, `NetworkManager.IsListening == true`). A good general "rule of thumb" is to not attempt to access the below sub-systems before starting the `NetworkManager`, otherwise they won't yet be initialized.
All `NetworkManager` sub-systems are instantiated once the `NetworkManager` is started (either when `NetworkManager.IsListening == true` or after you've received a `NetworkManager.OnInstantiated` notification). Don't attempt to access the following sub-systems before starting the `NetworkManager`, otherwise they won't yet be initialized.
:::

- [NetworkManager.PrefabHandler](../advanced-topics/object-pooling.md): This provides access to the NetworkPrefabHandler that is used for NetworkObject pools and to have more control overriding network prefabs.
Expand Down Expand Up @@ -59,7 +66,7 @@ Don't start a `NetworkManager` within any `NetworkBehaviour` component's method;
- [Connection Approval](../basics/connection-approval)
:::

## Connecting
### Connecting

When starting a client, the `NetworkManager` uses the IP and the Port provided in your `Transport` component for connecting. While you can set the IP address in the editor, many times you might want to be able to set the IP address and port during runtime.

Expand Down Expand Up @@ -247,3 +254,7 @@ public class ConnectionNotificationManager : MonoBehaviour
}
}
```

## Additional resources

- [`NetworkManager` API documentation](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkManager.html)
6 changes: 5 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,13 @@ module.exports = {
lastVersion: "current",
versions: {
current: {
label: "2.0.0",
label: "2.1.1",
path: "current",
},
"2.0.0": {
label: "2.0.0",
path: "2.0.0",
},
"1.11.0": {
label: "1.11.0",
path: "1.11.0",
Expand Down
65 changes: 65 additions & 0 deletions versioned_docs/version-2.0.0/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
id: about
title: About Netcode for GameObjects
description: Overview of Unity's Netcode for GameObjects for your multiplayer networking needs.
---

Netcode for GameObjects is a high-level networking library built for Unity for you to abstract networking logic. You can send GameObjects and world data across a networking session to many players at once. With Netcode for GameObjects, you can focus on building your game instead of low-level protocols and networking frameworks.

To learn more about Netcode for GameObjects functionality and capabilities, explore the content below:

<!--
<div className="table-columns-plain" >
| Get Started | Configuration | Samples and Education|
</div>
<div className="table-columns-plain" >
| Networking Components | Spawning and Ownership | Network Synchronization |
</div>
<div className="table-columns-plain" >
| Serialization | Scenes | Sessions |
</div>
<div className="table-columns-plain" >
| Test and Debug | Reference | Related Unity Gaming Services |
</div>
-->

<div className="table-columns-plain" >

| Getting Started | Get Started Project | Education and Samples |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Install Unity Netcode](installation/installation.md)<br/>[Migration from UNet to Netcode](installation/migratingfromUNet.md)<br/>[Upgrade to Unity Netcode Package](installation/migratingfrommlapi.md) | [Get started with Netcode](../docs/tutorials/get-started-with-ngo.md) | [Boss Room](learn/bossroom/getting-started-boss-room.md)<br/>[Bite Size Samples](learn/bitesize/bitesize-introduction.md)<br/>[Dilmer's Tutorials](community-contributions/dilmer-videos.md) |

</div>

<div className="table-columns-plain" >

| Core Concepts | Debugging | Terminology and FAQs |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Networking](basics/connection-approval.md)<br/>[Components](components/networkmanager.md)<br/>[Objects](basics/object-spawning.md)<br/>[Messaging System](advanced-topics/messaging-system.md)<br/>[Serialization](advanced-topics/serialization/serialization-intro.md)<br/>[Scenes](basics/scenemanagement/scene-management-overview.md) | [Logging](basics/logging.md)<br/>[Troubleshooting](troubleshooting/troubleshooting.md)<br/>[Error Messages](troubleshooting/error-messages.md) | [High Level Terminology](terms-concepts/mutliplayer-terms.md)<br/>[Multiplayer Game Architecture](terms-concepts/network-topologies.md)<br/>[FAQs](learn/faq.md) |

</div>

For more information, check out [Release Notes](release-notes/ngo-changelog.md) and [APIs](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/index.html).

## Before you begin

Netcode for GameObjects supports the following versions:

- Unity 6.0+ and later
- Mono and IL2CPP [Scripting Backends](https://docs.unity3d.com/Manual/scripting-backends.html)

Netcode for GameObjects supports the following platforms:

- Windows, macOS, and Linux
- iOS and Android
- XR platforms running on Windows, Android, and iOS operating systems
- Most [**closed platforms**](https://unity.com/platform-installation), such as consoles. Contact us for more information about specific closed platforms.
- When working with consoles (such as PlayStation, Xbox, or Nintendo Switch), there may be Netcode-specific policies you should be aware of while testing and before launching your game live. Refer to the console's internal documentation for more information. This content is typically protected by NDA.
- WebGL (requires Netcode for GameObjects 1.2.0+ and Unity Transport 2.0.0+)
21 changes: 21 additions & 0 deletions versioned_docs/version-2.0.0/advanced-topics/bufferserializer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
id: bufferserializer
title: BufferSerializer
sidebar_label: BufferSerializer
---

`BufferSerializer<TReaderWriter>` is the bi-directional serializer primarily used for serializing within [`INetworkSerializable`](inetworkserializable.md) types. It wraps [`FastBufferWriter` and `FastBufferReader`](fastbufferwriter-fastbufferreader.md) to provide high performance serialization, but has a couple of differences to make it more user-friendly:

- Rather than writing separate methods for serializing and deserializing, `BufferSerializer<TReaderWriter>` allows writing a single method that can handle both operations, which reduces the possibility of a mismatch between the two
- `BufferSerializer<TReaderWriter>` does bound checking on every read and write by default, making it easier to avoid mistakes around manual bounds checking required by `FastBufferWriter` and `FastBufferReader`

These aren't without downsides, however:

- `BufferSerializer<TReaderWriter>` has to operate on an existing mutable value due to its bi-directional nature, which means values like `List<T>.Count` have to be stored to a local variable before writing.
- `BufferSerializer<TReaderWriter>` is slightly slower than `FastBufferReader` and `FastBufferWriter` due to both the extra pass-through method calls and the mandatory bounds checking on each write.
- `BufferSerializer<TReaderWriter>` don't support any form of packed reads and writes.

However, when those downsides are unreasonable, `BufferSerializer<TReaderWriter>` offers two ways to perform more optimal serialization for either performance or bandwidth usage:

- For performance, you can use `PreCheck(int amount)` followed by `SerializeValuePreChecked()` to perform bounds checking for multiple fields at once.
- For both performance and bandwidth usage, you can obtain the wrapped underlying reader/writer via `serializer.GetFastBufferReader()` when `serializer.IsReader` is `true`, and `serializer.GetFastBufferWriter()` when `serializer.IsWriter` is `true`. These provide micro-performance improvements by removing a level of indirection, and also give you a type you can use with `BytePacker` and `ByteUnpacker`.
Loading

0 comments on commit 306be64

Please sign in to comment.