Skip to content

Commit c1a9675

Browse files
committed
Doc review
1 parent 018ace0 commit c1a9675

File tree

8 files changed

+72
-70
lines changed

8 files changed

+72
-70
lines changed

com.unity.netcode.gameobjects/Documentation~/TableOfContents.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [Distributed authority WebGL quickstart](learn/distributed-authority-webgl.md)
88
* [Networking concepts](networking-concepts.md)
99
* [Authority](terms-concepts/authority.md)
10+
* [Ownership](terms-concepts/ownership.md)
1011
* [Network topologies](network-topologies.md)
1112
* [Network topologies](terms-concepts/network-topologies.md)
1213
* [Client-server](terms-concepts/client-server.md)
@@ -33,9 +34,6 @@
3334
* [NetworkAnimator](components/helper/networkanimator.md)
3435
* [NetworkTransform](components/helper/networktransform.md)
3536
* [Physics](advanced-topics/physics.md)
36-
* [Ownership and authority](ownership-authority.md)
37-
* [Understanding ownership and authority](basics/ownership.md)
38-
* [Ownership race conditions](basics/race-conditions.md)
3937
* [Spawning and despawning](spawn-despawn.md)
4038
* [Object spawning](basics/object-spawning.md)
4139
* [Network prefab handler](advanced-topics/network-prefab-handler.md)

com.unity.netcode.gameobjects/Documentation~/basics/race-conditions.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

com.unity.netcode.gameobjects/Documentation~/networking-concepts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Understand the networking concepts that underpin Netcode for GameObjects.
55
| **Topic** | **Description** |
66
| :------------------------------ | :------------------------------- |
77
| **[Authority](terms-concepts/authority.md)** | Multiplayer games are games that are played between many different game instances. Each game instance has their own copy of the game world and behaviors within that game world. To have a shared game experience, each networked object is required to have an **authority**. |
8+
| **[Ownership](terms-concepts/ownership.md)** | Understand how ownership works in Netcode for GameObjects as a precursor to [authority](terms-concepts/authority.md). |
89
| **[Network topologies](network-topologies.md)** | Understand and decide which network topology to use in your project. |

com.unity.netcode.gameobjects/Documentation~/ownership-authority.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

com.unity.netcode.gameobjects/Documentation~/terms-concepts/authority.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,19 @@ Netcode for GameObjects provides two authority models: [server authority](#serve
1414

1515
The server authority model has a single game instance that is defined as the server. That game instance is responsible for running the main simulation and managing all aspects of running the networked game. Server authority is the authority model used for [client-server games](client-server.md).
1616

17-
The server authority model has the strength of providing a centralized authority to manage any potential game state conflicts. This allows the implementation of systems such as game state rollback and competitive client prediction. However, this can come at the cost of adding latencies, because all state changes must be sent to the server game instance, processed, and then sent out to other game instances.
17+
The server authority model has the strength of providing a centralized authority to manage any potential game state conflicts. This allows the implementation of systems such as game state rollback and competitive client prediction. However, this can come at the expense of adding latencies, because all state changes must be sent to the server game instance, processed, and then sent out to other game instances.
1818

1919
Server authority games can also be resource intensive. The server runs the simulation for the entire game world, and so the server needs to be powerful enough to handle the simulation and networking of all connected game clients. This resource requirement can become expensive.
2020

2121
Server authority is primarily used by performance-sensitive games, such as first-person shooters, or competitive games where having a central server authority is necessary to minimize cheating and the effects of bad actors.
2222

2323
### Distributed authority
2424

25-
The distributed authority model shares authority between game instances. Each game instance is the authority for a subdivision of the networked objects in the game and is responsible for running the simulation for their subdivision of objects. Updates are shared from other game instances for the rest of the simulation.
25+
The [distributed authority model](distributed-authority.md) shares authority between game instances. Each game instance is the authority for a subdivision of the networked objects in the game and is responsible for running the simulation for their subdivision of objects. Updates are shared from other game instances for the rest of the simulation.
2626

27-
The authority of each networked object is responsible for simulating the behavior and managing any aspects of running the networked game that relate to the objects it is the authority of.
27+
The authority of each networked object is responsible for simulating the behavior and managing any aspects of running the networked game that relate to the objects it's the authority of.
2828

29-
Because distributed authority games share the simulation between each connected client, they are less resource intensive. Each machine connected to the game processes a subdivision of the simulation, so no single machine needs to have the capacity to process the entire simulation. This results in a multiplayer game experience that can run on cheaper machines and is less resource intensive.
30-
31-
The distributed authority model is the authority model used for [distributed authority games](distributed-authority.md).
29+
Because distributed authority games share the simulation between each connected client, they're less resource intensive. Each machine connected to the game processes a subdivision of the simulation, so no single machine needs to have the capacity to process the entire simulation. This results in a multiplayer game experience that can run on cheaper machines and is less resource intensive.
3230

3331
## Checking for authority
3432

@@ -58,6 +56,10 @@ public class MonsterAI : NetworkBehaviour
5856
}
5957
```
6058

61-
Using distributed authority with Netcode for GameObjects requires a shift in the understanding of authority: instead of authority belonging to the server in all cases, it belongs to whichever client instance currently has authority. This necessitates a shift away from using local, non-replicated properties to store pertinent states; instead, [NetworkVariables](networkvariable.md) should be used to keep states synchronized and saved when all clients disconnect from a session or ownership is transferred to another client.
59+
Using distributed authority with Netcode for GameObjects requires a shift in the understanding of authority: instead of authority belonging to the server in all cases, it belongs to whichever client instance currently has authority. This necessitates a shift away from using local, non-replicated properties to store pertinent states; instead, [NetworkVariables](../basics/networkvariable.md) should be used to keep states synchronized and saved when all clients disconnect from a session or ownership is transferred to another client.
60+
61+
Distributed authority supports all built-in NetworkVariable data types. Because there's no concept of an authoritative server in a distributed authority session, all NetworkVariables are automatically configured with owner write and everyone read permissions.
62+
63+
## Additional resources
6264

63-
Distributed authority supports all built-in NetworkVariable data types. Since there's no concept of an authoritative server in a distributed authority session, all NetworkVariables are automatically configured with owner write and everyone read permissions.
65+
- [Ownership](ownership.md)

com.unity.netcode.gameobjects/Documentation~/terms-concepts/client-server.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ Client-server is one possible [network topology](network-topologies.md) you can
44

55
## Defining client-server
66

7-
The client-server topology is made up of two distinct types of game instances. There is one server game instance, and many client game instances. The server is always the [authority](./authority.md) and is responsible for running the main simulation of the game. The server is responsible for simulating physics, spawning and despawning objects, authorizing client requests along with any other responsibilities. Client game instances can then connect to the server to interact with and respond the the server's game simulation.
7+
A client-server topology consists of two distinct types of game instances: a single server game instance, and one or more client game instances. The server always has [authority](authority.md) and runs the main simulation of the game, including simulating physics, spawning and despawning objects, and authorizing client requests. Client game instances can then connect to the server to interact with and respond to the server's game simulation.
88

9-
Client-server encompasses a number of potential network arrangements. The most common is a dedicated game server, in which a specialized server manages the game and exists solely for that purpose.
9+
Client-server encompasses multiple potential network arrangements. The most common is a dedicated game server, in which a specialized server manages the game and exists solely for that purpose.
1010

11-
An alternative client-server arrangement is to have a [listen server](../learn/listenserverhostarchitecture.md), in which the game server runs on the same machine as a client. In this arrangement, the server game instance is referred to as a host. A host game instance runs as both a server and a client simultaneously.
11+
An alternative client-server arrangement is a [listen server](../learn/listenserverhostarchitecture.md), in which the game server runs on the same machine as a client. In this arrangement, the server game instance is referred to as a host. A host game instance runs as both a server and a client simultaneously.
1212

1313
## Checking for game instance type
1414

1515
### `IsServer`
1616

1717
`IsServer` or `!IsServer` is the traditional client-server method of checking whether the current game instance is running as a server instance. This is useful for ensuring that the server instance is the only instance running authoritative game logic, such as spawning objects, processing game rules, and validating client actions.
1818

19-
You should use `IsServer` to ensure that only the server executes code that should be authoritative or global. For example, spawning enemies, handling core game logic, or updating shared state should only happen on the server. This prevents clients from making unauthorized changes and helps maintain a consistent game state across all connected players.
19+
Use `IsServer` to ensure that only the server executes authoritative or global code. For example, spawning enemies, handling core game logic, or updating shared state should only happen on the server. This prevents clients from making unauthorized changes and helps maintain a consistent game state across all connected players.
2020

2121
```csharp
2222
public class MonsterAI : NetworkBehaviour
@@ -44,9 +44,9 @@ public class MonsterAI : NetworkBehaviour
4444

4545
### `IsHost`
4646

47-
The `IsHost` property is used to determine if the current game instance is running as both a server and a client simultaneouslya configuration known as a host. In Unity's Netcode for GameObjects, this is common when using a listen server, where the server and one client share the same process.
47+
Use the `IsHost` property to determine if the current game instance is running as both a server and a client simultaneously, a configuration known as a host. In Netcode for GameObjects, this is common when using a [listen server](../learn/listenserverhostarchitecture.md), where the server and one client share the same process.
4848

49-
`IsHost` could be useful for branching resource heavy logic so that a game running as a listen-server can use code-paths optimized for running on end devices.
49+
`IsHost` can be useful for branching resource heavy logic so that a game running as a listen-server can use code-paths optimized for running on end devices.
5050

5151
```csharp
5252
public class MonsterAI : NetworkBehaviour
@@ -80,7 +80,7 @@ public class MonsterAI : NetworkBehaviour
8080

8181
### `IsClient`
8282

83-
The `IsClient` property is used to check if the current game instance is running as a client. This is helpful for executing logic that should only run on client machines, such as updating UI elements, handling local input, or playing client-specific effects. Use `IsClient` to ensure that code only runs on the client side, preventing unintended execution on the server or in non-client contexts.
83+
Use the `IsClient` property to check if the current game instance is running as a client. This is helpful for executing logic that should only run on client machines, such as updating UI elements, handling local input, or playing client-specific effects. Use `IsClient` to ensure that code only runs on the client side, preventing unintended execution on the server or in non-client contexts.
8484

8585
`IsClient` will be `true` for host instances as a host game instance is running as both a server and a client simultaneously.
8686

@@ -111,3 +111,9 @@ public class MonsterAI : NetworkBehaviour
111111
Dedicated servers are often the most expensive network topology, but also offer the highest performance and can provide additional functionality such as competitive client prediction, rollback, and a centralized authority to manage any potential client conflicts. However, this comes at the cost of added latencies when communicating state changes from one client to another, as all state changes must be sent from client to server, processed, and then sent back out to other clients.
112112

113113
Client-server is primarily used by performance-sensitive games, such as first-person shooters, or competitive games where having a central server authority is necessary to minimize cheating and the effects of bad actors.
114+
115+
## Additional resources
116+
117+
- [Network topologies](network-topologies.md)
118+
- [Distributed authority](distributed-authority.md)
119+
- [Listen server architecture](../learn/listenserverhostarchitecture.md)

0 commit comments

Comments
 (0)