Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vic-Cooper committed Sep 16, 2024
2 parents 836bf07 + 4410621 commit d563c54
Show file tree
Hide file tree
Showing 133 changed files with 14,375 additions and 819 deletions.
1 change: 1 addition & 0 deletions docs/learn/bitesize/bitesize-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: About Bitesize samples

The Bitesize Samples repository provides a series of sample code as modules to use in your games and better understand Netcode for GameObjects (Netcode).

* [Multiplayer Use Cases](bitesize-usecases.md) - Learn more about core Netcode For GameObjects (Netcode) features through practical examples and In-Editor tutorials.
* [2D Space Shooter Sample](bitesize-spaceshooter.md) - Learn more about physics movement and status effects using Netcode `NetworkVariables` and `ObjectPooling`.
* [Invaders Sample](bitesize-invaders.md) - Learn more about game flow, modes, unconventional movement networked, and a shared timer.
* [Client Driven Sample](bitesize-clientdriven.md) - Learn more about Client driven movements, networked physics, spawning vs statically placed objects, object reparenting.
Expand Down
43 changes: 43 additions & 0 deletions docs/learn/bitesize/bitesize-usecases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
id: bitesize-usecases
title: Multiplayer Use Cases sample
description: Learn about the scenes in the Multiplayer Use Cases sample.
---

The [Multiplayer Use Cases Sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Basic/MultiplayerUseCases) provides multiple scenes that explain some APIs, systems, and concepts that you can use with Netcode for GameObjects:

- Server-side manipulation of data sent by Clients.
- State synchronization through NetworkVariables.
- Proximity interactions that are only visible only to the local player.
- Client-server communication through Remote Procedure Calls (RPCs).

### Tutorials

Each scene includes a tutorial to help you locate the scripts and GameObjects it uses. Follow the tutorial included in each sample scene to learn how to use it.

The tutorials that open with each scene use the [Tutorial Framework package](https://docs.unity3d.com/Packages/[email protected]/manual/index.html). You can open each tutorial at any time from the **Tutorials** menu.

## The NetvarVsRpc scene

The NetvarVsRpc scene explains why to use NetworkVariables instead of Remote Procedure Calls (RPCs) to perform state synchronization.

## The NetworkVariables scene

The NetworkVariables scene shows you how to use NetworkVariables to perform state synchronization in a way that also sends the most recent information to late joining or reconnecting clients.

## The ProximityChecks scene

The ProximityChecks scene shows you how to detect the local user and enable or disable in-game actions based on the player character's distance from a GameObject.

## The RPCs scene

The RPCs scene semonstrates the following Remote Procedure Call (RPC) processes:
* Use RPCs to send information from clients to the server.
* Perform server-side manipulation of the data sent.
* Use connection approval to determine the spawn position of the player.

## Additional resources

- Get help and ask questions on [Multiplayer Discussions](https://discussions.unity.com/lists/multiplayer).
- Join the community of Multiplayer creators on the [Multiplayer Networking Discord](https://discord.gg/unity-multiplayer-network).
- [Request a feature or report a bug](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/issues/new/choose).
6 changes: 6 additions & 0 deletions docs/learn/distributed-authority-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ public class ConnectionManager : MonoBehaviour
}
```

:::note

It's important to wait until `OnClientConnectedCallback` has been triggered before spawning objects. Spawning objects early will result in errors and unexpected behaviour.

:::

2. Add the `ConnectionManager` component script you created to the *NetworkManager* object.
![add connection manager](/img/learn/distributed-authority-quick-start/create-connection-manager.png)

Expand Down
7 changes: 4 additions & 3 deletions docs/release-notes/ngo-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ The following content tracks features, updates, bug fixes, and refactoring for t

| Release | Date | Changelog |
|---|---|---|
| 2.0.0-pre | 2024-06-17 | [2.0.0-pre](https://docs.unity3d.com/Packages/[email protected]/changelog/CHANGELOG.html) |
| 2.0.0-exp | 2024-04-02 | [2.0.0-exp](https://docs.unity3d.com/Packages/[email protected]/changelog/CHANGELOG.html#200-exp2---2024-04-02) |
| 1.10.0 | 2024-07-22 | [1.10.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/release/1.10.0/com.unity.netcode.gameobjects/CHANGELOG.md) |
| 2.0.0-pre.4 | 2024-08-21 | [2.0.0-pre.4](https://docs.unity3d.com/Packages/[email protected]/changelog/CHANGELOG.html) |
| 2.0.0-exp | 2024-06-03 | [2.0.0-exp](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/develop-2.0.0/com.unity.netcode.gameobjects/CHANGELOG.md#200-exp5---2024-06-03) |
| 1.11.0 | 2024-08-20 | [1.11.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.11.0) |
| 1.10.0 | 2024-07-22 | [1.10.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.10.0) |
| 1.9.1 | 2024-04-18 | [1.9.1](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.9.1) |
| 1.8.0 | 2023-12-12 | [1.8.0](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.8.0) |
| 1.7.1 | 2023-11-15 | [1.7.1](https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/ngo%2F1.7.1) |
Expand Down
4 changes: 4 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ module.exports = {
label: "2.0.0-pre",
path: "current",
},
"1.11.0": {
label: "1.11.0",
path: "1.11.0",
},
"1.10.0": {
label: "1.10.0",
path: "1.10.0",
Expand Down
31 changes: 21 additions & 10 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,19 @@ module.exports = {
"label": "Networking components",
"items": [
{
"type": "doc",
"id": "basics/networkobject"
},
{
"type": "doc",
"id": "advanced-topics/networkobject-parenting"
"collapsed": true,
"type": "category",
"label": "NetworkObject",
"items": [
{
"type": "doc",
"id": "basics/networkobject"
},
{
"type": "doc",
"id": "advanced-topics/networkobject-parenting"
},
]
},
{
"collapsed": true,
Expand All @@ -146,10 +153,6 @@ module.exports = {
},
]
},
{
"type": "doc",
"id": "advanced-topics/physics"
},
{
"type": "doc",
"id": "components/networkmanager"
Expand All @@ -163,6 +166,10 @@ module.exports = {
"label": "NetworkAnimator",
"id": "components/networkanimator"
},
{
"type": "doc",
"id": "advanced-topics/physics"
}
]
},
{
Expand Down Expand Up @@ -536,6 +543,10 @@ module.exports = {
"type": "category",
"label": "Bitesize samples",
"items": [
{
"type": "doc",
"id": "learn/bitesize/bitesize-usecases"
},
{
"type": "doc",
"id": "learn/bitesize/bitesize-introduction"
Expand Down
8 changes: 4 additions & 4 deletions tools/porting-to-dgs/client-vs-dgs.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ The following table lists some pros and cons of using a client-hosted hosting ap
| Client-hosted games are simpler to debug and profile compared to dedicated server-hosted games (your development PC can also run the host, a DGS might run on specialized hardware). | Players can more easily cheat because they have physical access to the server. |
| The above makes it great for LAN (local area network) parties. | Client-hosted games don’t scale well. Player hardware usually isn’t capable of hosting game sessions with hundreds of connections. |

✝ However, some games might generate more traffic (compared to compute resources), which might make a client-hosted game more expensive than using a service like Game Server Hosting (Multiplay) if relying too much on Relay.
✝ However, some games might generate more traffic (compared to compute resources), which might make a client-hosted game more expensive than using a service like Unity Multiplay Hosting if relying too much on Relay.

## Dedicated server-hosted games

A dedicated server-hosted game is a game that runs server builds on hardware that’s dedicated to hosting the game. The dedicated server might be in an [on-premise data center](./hosting-considerations.md#developer-hosted-cloud), in the [cloud](./hosting-considerations#developer-hosted-cloud), or made available through a [managed service provider](#managed-service-provider), such as Unity’s [Game Server Hosting](https://docs.unity.com/game-server-hosting). In any case, players don’t usually have access to the server build.
A dedicated server-hosted game is a game that runs server builds on hardware that’s dedicated to hosting the game. The dedicated server might be in an [on-premise data center](./hosting-considerations.md#developer-hosted-cloud), in the [cloud](./hosting-considerations#developer-hosted-cloud), or made available through a [managed service provider](#managed-service-provider), such as Unity’s [Multiplay Hosting](https://docs.unity.com/game-server-hosting). In any case, players don’t usually have access to the server build.

Games that benefit most from a dedicated server-hosted hosting approach include those that:

Expand All @@ -61,9 +61,9 @@ The following table lists some pros and cons of using a dedicated server hosting
| There’s no extra lag due to relay based connections. | You must consider scalability because the number of players connected to your server fleet can change drastically in a short time. |
| You have more control over performance and quality of service since you as a developer control the hardware the server runs on. | It can quickly get expensive, depending on how you host the server build. |
| It’s easier to think about the server part of your code and the client part of your code when there’s no overlap like a client-hosted game. | It’s more complicated to debug because you usually need to run the production build in a virtual machine for testing. |
| Clients don’t require as much performance because they'ren’t responsible for the processing and bandwidth overhead involved with hosting. | You have to keep a server build and a client build. |
| Clients don’t require as much performance because they aren't responsible for the processing and bandwidth overhead involved with hosting. | You have to keep a server build and a client build. |
| You don’t have to worry about host migrations or what to do when the host player disconnects. ✝ | |
| You don’t have to worry about the unfairness of the host having zero latency or lag. | |
| You have the option of using a managed service provider like Game Server Hosting, which allows you to focus on other aspects of your game. | |
| You have the option of using a managed service provider like Unity Multiplay Hosting, which allows you to focus on other aspects of your game. | |

✝ However, you still need to accommodate for unexpected server failures. These failures are less likely to happen, but you still need to handle them with appropriate error messaging.
10 changes: 5 additions & 5 deletions tools/porting-to-dgs/game-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Games using a DGS hosting approach rely on automation to handle startup events a
Instead of using in-game menus on start-up, you’ll need to implement an automated startup flow that will `StartServer()` automatically, then wait for your clients to connect. This is also when you might want to set up a lobby in your lobby service or advertise yourself as “ready” to your hosting provider and matchmaking service. After your service knows you’re ready, it can redirect clients to your server.

:::note
If you’re interested in using other Unity services for your multiplayer game, see [Lobby](https://docs.unity.com/lobby), [Game Server Hosting](https://docs.unity.com/game-server-hosting), and [Matchmaker](https://docs.unity.com/matchmaker).
If you’re interested in using other Unity services for your multiplayer game, see [Lobby](https://docs.unity.com/lobby), [Multiplay Hosting](https://docs.unity.com/game-server-hosting), and [Matchmaker](https://docs.unity.com/matchmaker).
:::

### Automate closing the lobby
Expand Down Expand Up @@ -126,7 +126,7 @@ Starting a new game with connected players and keeping the same game session is

### Automate exit codes

Many hosting providers, such as [Unity’s Game Server Hosting service](https://docs.unity.com/multiplay/), watch your server and react to exit codes. For example, if you have a bug resulting in `StartServer` failing, you can call `Application.Quit(1)` with exit code `1`. Exit codes greater than `0` let the hosting provider know something went wrong and the provider can automatically react to this appropriately by trying to reboot your server or just destroying it.
Many hosting providers, such as [Unity’s Multiplay Hosting service](https://docs.unity.com/multiplay/), watch your server and react to exit codes. For example, if you have a bug resulting in `StartServer` failing, you can call `Application.Quit(1)` with exit code `1`. Exit codes greater than `0` let the hosting provider know something went wrong and the provider can automatically react to this appropriately by trying to reboot your server or just destroying it.

## General game changes

Expand Down Expand Up @@ -296,9 +296,9 @@ I've also seen self-signed certificates used for "offline" purposes, such as enc
The content in this section might only apply to some hosting providers. Other hosting providers might have zero bandwidth costs for in-datacenter and ingress transfers.
:::

Some hosting providers manage build updates for you and charge for in-datacenter and ingress transfers. One such hosting provider is [Unity’s Game Server Hosting (GSH)](https://docs.unity.com/multiplay/) solution (Multiplay).
Some hosting providers manage build updates for you and charge for in-datacenter and ingress transfers. One such hosting provider is [Unity’s Multiplay Hosting](https://docs.unity.com/multiplay/) solution.

If you use GSH, you can make sure there’s no downtime between updates. GSH performs [build updates and rollouts](https://docs.unity.com/game-server-hosting/legacy/how-do-differential-updates-work.html) in the background. However, you can still [optimize your builds to reduce your bandwidth costs](https://docs.unity.com/game-server-hosting/legacy/cost-optimization.html). For example, you can speed up the update process (and incur fewer charges) by ensuring you have as few changes as possible between build versions.
If you use Multiplay Hosting, you can make sure there’s no downtime between updates. Multiplay Hosting performs [build updates and rollouts](https://docs.unity.com/game-server-hosting/legacy/how-do-differential-updates-work.html) in the background. However, you can still [optimize your builds to reduce your bandwidth costs](https://docs.unity.com/game-server-hosting/legacy/cost-optimization.html). For example, you can speed up the update process (and incur fewer charges) by ensuring you have as few changes as possible between build versions.

There are several ways you can mitigate the differences between build versions. For example, you can use:

Expand Down Expand Up @@ -331,5 +331,5 @@ You can use DGS asset stripping to optimize many aspects of your server-hosted g
If you’re a small game studio with a small player base, you might not consider the bandwidth costs involved with updating your game. However, these costs can grow quickly without optimizations like incremental builds. A server build of 30 GB and a fleet of 15,000 servers equates to hundreds of terabytes of bandwidth costs for each update.

:::tip
The recommended best practice is to review the bandwidth and related costs of your hosting provider so you can calculate the true cost of rolling out an update. You can view the pricing information for Unity’s Game Server Hosting [here](https://docs.unity.com/game-server-hosting/concepts/pricing.html).
The recommended best practice is to review the bandwidth and related costs of your hosting provider so you can calculate the true cost of rolling out an update. You can view the pricing information for Unity’s Multiplay Hosting [here](https://docs.unity.com/game-server-hosting/concepts/pricing.html).
:::
Loading

0 comments on commit d563c54

Please sign in to comment.