新增FishNet文档
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
# ObserverConditions
|
||||
|
||||
**ObserverConditions** in Fish-Networking define specific conditions under which clients receive updates about a [NetworkObject's](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) state. These conditions help optimize network traffic by ensuring that only relevant updates are transmitted, as well as prevent client's from cheating by only sending relevant data to individual clients.
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# DistanceCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Distance Condition** ensures that an object is only observed if it is at least a specified minimum distance away from all objects owned by a client. The Distance Condition is a [Timed Condition](#user-content-fn-1)[^1].
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/distance-observer-condition.svg" alt="" width="563"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/distance-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
### :gear: **Maximum Distance**
|
||||
|
||||
> The maximum distance that any object owned by a client must be within an object to observe it. If all of the client's owned [NetworkObjects](../../../guides/features/networked-gameobjects-and-scripts/networkobjects/) are farther than this distance, the object will not be visible to them.
|
||||
|
||||
### :gear: **Hide Distance Percent**
|
||||
|
||||
> **This** determines an additional buffer zone beyond the maximum distance before an object is hidden. The purpose of the "Hide Distance Percent" is to prevent objects from flickering in and out of visibility when a client is near the maximum distance threshold. It creates a smoother transition for hiding objects by adding a percentage-based distance buffer. As an example, if the **Maximum Distance** is set to `100f` and the **Hide Distance Percent** is `0.5` (50%), the object will remain visible until the client is `150f` units away. This ensures objects do not disappear immediately as they cross the initial visibility boundary.
|
||||
|
||||
[^1]: A Timed Condition is evaluated periodically rather than only when certain conditions change.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# GridCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Grid Condition** is similar to the [DistanceCondition](distancecondition.md) and evaluates to true if clients are within specified distance of the object. The Grid Condition is however less accurate but more performant; it is also a [Timed Condition](#user-content-fn-1)[^1]. This condition requires you to place a [HashGrid ](../../components/managers/observermanager/hashgrid.md)on or beneath your [NetworkManager](../../components/managers/network-manager.md) object.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/grid-observer-condition.svg" alt="" width="443"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/grid-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
[^1]: A Timed Condition is evaluated periodically rather than only when certain conditions change.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# HostOnlyCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Host Only Condition** evaluates to true when the player is a client host. Any connection which is not client host will fail this evaluation. You can use this observer condition to only show objects to the host player, either permanently or temporarily. This condition is not a timed condition.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/host-only-observer-condition.svg" alt="" width="419"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/host-only-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# MatchCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Match Condition** evaluates to true when players or objects share the same match[^1]. Both owned and non-owned objects can be added to matches. Objects or players not added to matches will have their data synchronized with everyone, unless prevented by another condition. See the [MatchCondition api](https://fish-networking.com/FishNet/api/api/FishNet.Component.Observing.MatchCondition.html) for more information on usage. This condition is not a timed condition.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/match-observer-condition.svg" alt="" width="466"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left" data-full-width="false"><figure><img src="../../../.gitbook/assets/match-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
|
||||
[^1]: A _match_ can mean a lot of different things, but in this case it is basically a custom tag you can give objects and players to separate them from observing one another.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# OwnerOnlyCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Owner Only Condition** evaluates to true when a player owns the object. An owner condition will make an object only visible to its owner. If there is no owner, the object will not be visible to any clients. This can be very useful for sharing information with only the owner client, for example inventory data or a player's hand of cards, which shouldn't be shared with other clients to prevent cheating and wasted bandwidth.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/owner-only-observer-condition.svg" alt="" width="469"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/owner-only-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# SceneCondition
|
||||
|
||||
## Description <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
The **Scene Condition** evaluates to true if the client shares any scenes with the object. This is arguably the most important observer condition, and it is the only one that is added by default to the [example NetworkManager prefab](../../prefabs/networkmanager.md). This condition is important because it helps avoid serious de-syncs that would happen if the server tried to tell clients about objects from a scene they haven't yet loaded.
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/scene-observer-condition.svg" alt="" width="457"><figcaption></figcaption></figure></div>
|
||||
|
||||
## Settings <a href="#server-and-host" id="server-and-host"></a>
|
||||
|
||||
<div align="left"><figure><img src="../../../.gitbook/assets/scene-observer-condition.png" alt=""><figcaption><p>Default settings</p></figcaption></figure></div>
|
||||
|
||||
### :gear: **Add Order**
|
||||
|
||||
> This controls the order in which this observer condition will be evaluated on an object.
|
||||
>
|
||||
> This can be very useful when having observer conditions that are more computationally complex than others, as it allows you to choose the order in which they will be evaluated. Timed conditions are always evaluated after non-timed conditions.
|
||||
|
||||
### :gear: **Is Constant**
|
||||
|
||||
> Is used to declare whether the condition's settings or data will remain unchanged at runtime. Its purpose is to optimize performance by avoiding unnecessary updates or recalculations for conditions that do not change during execution. It is currently not implemented, but is available for future use and can already be set.
|
||||
Reference in New Issue
Block a user