diff --git a/doc/Components/Authenticators/Facebook.md b/doc/Components/Authenticators/Facebook.md deleted file mode 100644 index cca2b9be9..000000000 --- a/doc/Components/Authenticators/Facebook.md +++ /dev/null @@ -1,3 +0,0 @@ -# Facebook Authenticator - -Coming Soon diff --git a/doc/Components/Authenticators/Google.md b/doc/Components/Authenticators/Google.md deleted file mode 100644 index 5400da1f0..000000000 --- a/doc/Components/Authenticators/Google.md +++ /dev/null @@ -1,3 +0,0 @@ -# Google Authenticator - -Coming Soon diff --git a/doc/Components/Authenticators/PlayFab.md b/doc/Components/Authenticators/PlayFab.md deleted file mode 100644 index ea41eb781..000000000 --- a/doc/Components/Authenticators/PlayFab.md +++ /dev/null @@ -1,3 +0,0 @@ -# PlayFab Authenticator - -Coming Soon diff --git a/doc/Components/Authenticators/index.md b/doc/Components/Authenticators/index.md index 15fb666f4..1c9bfe067 100644 --- a/doc/Components/Authenticators/index.md +++ b/doc/Components/Authenticators/index.md @@ -15,9 +15,3 @@ In addition to the Authenticators listed below, you can make your own! Check out - [Basic Authenticator](Basic.md) Mirror includes a Basic Authenticator in the Mirror / Authenticators folder which just uses a simple username and password. -- [PlayFab Authenticator](PlayFab.md) - Coming Soon -- [Facebook Authenticator](Facebook.md) - Coming Soon -- [Google Authenticator](Google.md) - Coming Soon diff --git a/doc/Components/Authenticators/toc.yml b/doc/Components/Authenticators/toc.yml index acebbc96f..725e55455 100644 --- a/doc/Components/Authenticators/toc.yml +++ b/doc/Components/Authenticators/toc.yml @@ -2,9 +2,3 @@ href: index.md - name: Basic Authenticator href: Basic.md -- name: PlayFab Authenticator - href: PlayFab.md -- name: Facebook Authenticator - href: Facebook.md -- name: Google Authenticator - href: Google.md diff --git a/doc/Components/NetworkDiscovery.md b/doc/Components/NetworkDiscovery.md index 6cd051b33..e8eca7577 100644 --- a/doc/Components/NetworkDiscovery.md +++ b/doc/Components/NetworkDiscovery.md @@ -1,4 +1,4 @@ -# NetworkDiscovery +# Network Discovery Network Discovery uses a UDP broadcast on the LAN enabling clients to find the running server and connect to it. diff --git a/doc/Components/NetworkIdentity.md b/doc/Components/NetworkIdentity.md index a1d4fc359..760ef8b8c 100644 --- a/doc/Components/NetworkIdentity.md +++ b/doc/Components/NetworkIdentity.md @@ -1,7 +1,7 @@ -# NetworkIdentity +# Network Identity **See also in the API Reference.** - + The Network Identity component is at the heart of the Unity networking high-level API. It controls a game object’s unique identity on the network, and it uses that identity to make the networking system aware of the game object. It offers two different options for configuration and they are mutually exclusive, which means either one of the options or none can be checked. - **Server Only** Tick this checkbox to ensure that Unity only spawns the game object on the server, and not on clients. diff --git a/doc/Components/NetworkManager.md b/doc/Components/NetworkManager.md index c7488cbee..08668736b 100644 --- a/doc/Components/NetworkManager.md +++ b/doc/Components/NetworkManager.md @@ -1,4 +1,4 @@ -# NetworkManager +# Network Manager The Network Manager is a component for managing the networking aspects of a multiplayer game. diff --git a/doc/Components/NetworkManagerHUD.md b/doc/Components/NetworkManagerHUD.md index 8704489bd..bd519b5a1 100644 --- a/doc/Components/NetworkManagerHUD.md +++ b/doc/Components/NetworkManagerHUD.md @@ -1,4 +1,4 @@ -# NetworkManagerHUD +# Network Manager HUD The Network Manager HUD (“heads-up display”) is a quick-start tool to help you start building your multiplayer game straight away, without first having to build a user interface for game creation/connection/joining. It allows you to jump straight into your game play programming, and means you can build your own version of these controls later in your development schedule. diff --git a/doc/Components/NetworkProximityChecker.md b/doc/Components/NetworkProximityChecker.md index d222f7266..3dc484038 100644 --- a/doc/Components/NetworkProximityChecker.md +++ b/doc/Components/NetworkProximityChecker.md @@ -1,4 +1,4 @@ -# NetworkProximityChecker +# Network Proximity Checker The Network Proximity Checker component controls the visibility of game objects for network clients, based on proximity to players. diff --git a/doc/Components/NetworkRoomManager.md b/doc/Components/NetworkRoomManager.md index 79385dce5..69849aebb 100644 --- a/doc/Components/NetworkRoomManager.md +++ b/doc/Components/NetworkRoomManager.md @@ -1,4 +1,4 @@ -# NetworkRoomManager +# Network Room Manager \*\*Please see the Room example in the Examples folder in your Mirror folder diff --git a/doc/Components/NetworkRoomPlayer.md b/doc/Components/NetworkRoomPlayer.md index 343893be9..7ef9fc659 100644 --- a/doc/Components/NetworkRoomPlayer.md +++ b/doc/Components/NetworkRoomPlayer.md @@ -1,4 +1,4 @@ -# NetworkRoomPlayer +# Network Room Player The Network Room Player stores per-player state for the [Network Room Manager](NetworkRoomManager.md) while in the room. When using this component, you need to write a script which allows players to indicate they are ready to begin playing, which sets the ReadyToBegin property. diff --git a/doc/Components/NetworkSceneChecker.md b/doc/Components/NetworkSceneChecker.md index e05d11e4c..bce57d5c8 100644 --- a/doc/Components/NetworkSceneChecker.md +++ b/doc/Components/NetworkSceneChecker.md @@ -1,4 +1,4 @@ -# NetworkSceneChecker +# Network Scene Checker The Network Scene Checker component controls the visibility of game objects for network clients, based on which scene they're in. diff --git a/doc/Components/NetworkStartPosition.md b/doc/Components/NetworkStartPosition.md index dde995137..210d8e506 100644 --- a/doc/Components/NetworkStartPosition.md +++ b/doc/Components/NetworkStartPosition.md @@ -1,4 +1,4 @@ -# NetworkStartPosition +# Network Start Position To control where players are spawned, you can use the Network Start Position component. diff --git a/doc/Components/NetworkTransform.md b/doc/Components/NetworkTransform.md index 6c74d70ef..737378e8d 100644 --- a/doc/Components/NetworkTransform.md +++ b/doc/Components/NetworkTransform.md @@ -1,4 +1,4 @@ -# NetworkTransform +# Network Transform [![Network transform video tutorial](../images/video_tutorial.png)](https://www.youtube.com/watch?v=Z0th49NERl4&list=PLkx8oFug638oBYF5EOwsSS-gOVBXj1dkP&index=3) diff --git a/doc/Components/NetworkTransformChild.md b/doc/Components/NetworkTransformChild.md index 943bda047..c617a6776 100644 --- a/doc/Components/NetworkTransformChild.md +++ b/doc/Components/NetworkTransformChild.md @@ -1,4 +1,4 @@ -# NetworkTransformChild +# Network Transform Child [![Network transform child video tutorial](../images/video_tutorial.png)](https://www.youtube.com/watch?v=5EgN8IqFfUI&list=PLkx8oFug638oBYF5EOwsSS-gOVBXj1dkP&index=2) diff --git a/doc/Components/index.md b/doc/Components/index.md index f725d855c..10704e09f 100644 --- a/doc/Components/index.md +++ b/doc/Components/index.md @@ -2,27 +2,27 @@ These core components are included in Mirror: -- [NetworkAnimator](NetworkAnimator.md) +- [Network Animator](NetworkAnimator.md) The Network Animator component allows you to synchronize animation states for networked objects. It synchronizes state and parameters from an Animator Controller. -- [NetworkIdentity](NetworkIdentity.md) +- [Network Identity](NetworkIdentity.md) The Network Identity component is at the heart of the Mirror networking high-level API. It controls a game object’s unique identity on the network, and it uses that identity to make the networking system aware of the game object. It offers two different options for configuration and they are mutually exclusive, which means either one of the options or none can be checked. -- [NetworkManager](NetworkManager.md) +- [Network Manager](NetworkManager.md) The Network Manager is a component for managing the networking aspects of a multiplayer game. -- [NetworkManagerHUD](NetworkManagerHUD.md) +- [Network Manager HUD](NetworkManagerHUD.md) The Network Manager HUD is a quick-start tool to help you start building your multiplayer game straight away, without first having to build a user interface for game creation/connection/joining. It allows you to jump straight into your gameplay programming, and means you can build your own version of these controls later in your development schedule. - [NetworkDiscovery](NetworkDiscovery.md) + [Network Discovery](NetworkDiscovery.md) Network Discovery uses a UDP broadcast on the LAN enabling clients to find the running server and connect to it. -- [NetworkProximityChecker](NetworkProximityChecker.md) +- [Network Proximity Checker](NetworkProximityChecker.md) The Network Proximity Checker component controls the visibility of game objects for network clients, based on proximity to players. -- [NetworkRoomManager](NetworkRoomManager.md) +- [Network Room Manager](NetworkRoomManager.md) The Network Room Manager is an extension component of Network Manager that provides a basic functional room. -- [NetworkRoomPlayer](NetworkRoomPlayer.md) +- [Network Room Player](NetworkRoomPlayer.md) The Network Room Player is a component that's required on Player prefabs used in the Room Scene with the Network Room Manager above. -- [NetworkStartPosition](NetworkStartPosition.md) +- [Network Start Position](NetworkStartPosition.md) Network Start Position is used by the Network Manager when creating player objects. The position and rotation of the Network Start Position are used to place the newly created player object. -- [NetworkTransform](NetworkTransform.md) +- [Network Transform](NetworkTransform.md) The Network Transform component synchronizes the movement and rotation of game objects across the network. Note that the network Transform component only synchronizes spawned networked game objects. -- [NetworkTransformChild](NetworkTransformChild.md) +- [Network Transform Child](NetworkTransformChild.md) The Network Transform Child component synchronizes the position and rotation of the child game object of a game object with a Network Transform component. ## Authenticators @@ -31,9 +31,3 @@ These core components are included in Mirror: - [Basic Authenticator](Authenticators/Basic.md) Mirror includes a Basic Authenticator in the Mirror / Authenticators folder which just uses a simple username and password. -- [PlayFab Authenticator](Authenticators/PlayFab.md) - Coming Soon -- [Facebook Authenticator](Authenticators/Facebook.md) - Coming Soon -- [Google Authenticator](Authenticators/Google.md) - Coming Soon diff --git a/doc/Components/toc.yml b/doc/Components/toc.yml index 19fc74588..fad62a57c 100644 --- a/doc/Components/toc.yml +++ b/doc/Components/toc.yml @@ -1,28 +1,28 @@ - name: Overview href: index.md -- name: NetworkAnimator +- name: Network Animator href: NetworkAnimator.md -- name: NetworkIdentity +- name: Network Identity href: NetworkIdentity.md -- name: NetworkManager +- name: Network Manager href: NetworkManager.md -- name: NetworkManagerHUD +- name: Network ManagerHUD href: NetworkManagerHUD.md -- name: NetworkDiscovery +- name: Network Discovery href: NetworkDiscovery.md -- name: NetworkProximityChecker +- name: Network ProximityChecker href: NetworkProximityChecker.md -- name: NetworkSceneChecker +- name: Network SceneChecker href: NetworkSceneChecker.md -- name: NetworkRoomManager +- name: Network RoomManager href: NetworkRoomManager.md -- name: NetworkRoomPlayer +- name: Network RoomPlayer href: NetworkRoomPlayer.md -- name: NetworkStartPosition +- name: Network StartPosition href: NetworkStartPosition.md -- name: NetworkTransform +- name: Network Transform href: NetworkTransform.md -- name: NetworkTransformChild +- name: Network TransformChild href: NetworkTransformChild.md - name: Authenticators href: Authenticators/toc.yml diff --git a/doc/General/ChangeLog.md b/doc/General/ChangeLog.md index 69083674e..fb2f20294 100644 --- a/doc/General/ChangeLog.md +++ b/doc/General/ChangeLog.md @@ -1,13 +1,21 @@ # Change Log +**Mirror is published to the Asset Store at the start of every month, unless some critical issue causes a delay.** + +Mirror uses semantic versioning, and the versions shown here are those that were published to the Asset Store, and occasionally major version bumps happen mid-month between store submissions and are therefore not individually shown here. + ## Version 10.x.x - In Progress - Added: Weaver will now block play mode and builds if there are weaver errors and show them in the console again. - Added: PooledNetworkReader and PooledNetworkWriter, both Disposable. - Added: NetworkReader.ReadMessage. - Added: NetworkDiscovery now handles headless server mode. - Added: SyncVar, Cmd's and Rpc's now support Scriptable Objects via CreateInstance on the receiving side. +- Added: [Discord Transport](../Transports/Discord.md) - Fixed: `isClient` now returns true on clients in OnDestroy for networked objects. -- Changed: NetworkSceneChecker now works from OnEnable instead of Awake. +- Fixed: Host Player race condition for Ready message. +- Fixed: NetworkAnimator and NetworkTransform now correctly check for client authority in their respective Command methods. +- Fixed: Network Room Manager Script Template had a virtual method instead of an override. +- Changed: NetworkSceneChecker now works from OnEnable instead of Awake, and uses Scene instead of scene name. - Changed: Renamed NeworkWriter.Write to WriteMessage for consistency. ## Version 9.0.2 - 2020-Feb-04 diff --git a/doc/General/Start.md b/doc/General/Start.md index f51b5bdcb..54d8768f4 100644 --- a/doc/General/Start.md +++ b/doc/General/Start.md @@ -1,6 +1,6 @@ # Getting Started -This document describes steps to converting a single player game to a multiplayer game, using the new Unity Multiplayer networking system. The process described here is a simplified, higher level version of the actual process for a real game; it doesn’t always work exactly like this, but it provides a basic recipe for the process. +This document describes steps to creating a multiplayer game with Mirror. The process described here is a simplified, higher level version of the actual process for a real game; it doesn’t always work exactly like this, but it provides a basic recipe for the process. ## Video tutorials @@ -21,7 +21,6 @@ See [Using the NetworkManager](../Components/NetworkManager.md). ## Player Prefab - Find the Prefab for the player game object in the game, or create a Prefab from the player game object - Add the NetworkIdentity component to the player Prefab -- Check the LocalPlayerAuthority box on the NetworkIdentity - Set the `playerPrefab` in the NetworkManager’s Spawn Info section to the player Prefab - Remove the player game object instance from the Scene if it exists in the Scene @@ -29,8 +28,9 @@ See [Player Objects](../Guides/GameObjects/SpawnPlayer.md) for more information. ## Player movement - Add a NetworkTransform component to the player Prefab +- Check the Client Authority checkbox on the component. - Update input and control scripts to respect `isLocalPlayer` -- Fix Camera to use spawned player and `isLocalPlayer` +- Override OnStartLocalPlayer to take control of the Main Camera in the scene for the player. For example, this script only processes input for the local player: diff --git a/doc/Guides/Conversion.md b/doc/Guides/Conversion.md deleted file mode 100644 index 3df172e9f..000000000 --- a/doc/Guides/Conversion.md +++ /dev/null @@ -1,82 +0,0 @@ -# Converting a Single-Player Game to Mirror - -This document describes steps to converting a single player game to a multiplayer game, using Mirror. The process described here is a simplified, higher level version of the actual process for a real game; it doesn’t always work exactly like this, but it provides a basic recipe for the process. - -## NetworkManager set-up -- Add a new game object and rename it “NetworkManager”. -- Add the NetworkManager component to the “NetworkManager” game object. -- Add the NetworkManagerHUD component to the game object. This provides the default UI​ for managing the network game state. - -See Using the NetworkManager. - -## Player Prefab Setup -- Find the Prefab for the player game object in the game, or create a Prefab from the player game object -- Add the NetworkIdentity component to the player Prefab -- Set the `playerPrefab` in the NetworkManager’s Spawn Info section to the player Prefab -- Remove the player game object instance from the Scene if it exists in the Scene - -See Player Objects for more information. - -## Player Movement -- Add a NetworkTransform component to the player Prefab -- Update input and control scripts to respect `isLocalPlayer` -- Fix Camera to use spawned player and `isLocalPlayer` - -For example, this script only processes input for the local player: - -```cs -using UnityEngine; -using Mirror; - -public class Controls : NetworkBehaviour -{ - void Update() - { - if (!isLocalPlayer) - { - // exit from update if this is not the local player - return; - } - - // handle player input for movement - } -} -``` - -## Basic Player Game State -- Make scripts that contain important data into NetworkBehaviours instead of MonoBehaviours -- Make important member variables into SyncVars - -See State Synchronization. - -## Networked Actions -- Make scripts that perform important actions into NetworkBehaviours instead of MonoBehaviours -- Update functions that perform important player actions to be commands - -See Networked Actions. - -## Non-player Game Objects - -Fix non-player prefabs such as enemies: -- Add the NetworkIdentify component -- Add the NetworkTransform component -- Register spawnable Prefabs with the NetworkManager -- Update scripts with game state and actions - -## Spawners -- Potentially change spawner scripts to be NetworkBehaviours -- Modify spawners to only run on the server (use isServer property or the `OnStartServer()` function) -- Call `NetworkServer.Spawn()` for created game objects - -## Spawn Positions for Players -- Add a new game object and place it at player’s start location -- Add the NetworkStartPosition component to the new game object - -## Room -- Create Room Scene -- Add a new game object to the Scene and rename it to “NetworkRoomManager”. -- Add the NetworkRoomManager component to the new game object. -- Configure the Manager: - - Scenes - - Prefabs - - Spawners diff --git a/doc/Guides/Visibility.md b/doc/Guides/Visibility.md index eca2a8bdb..40e7c2138 100644 --- a/doc/Guides/Visibility.md +++ b/doc/Guides/Visibility.md @@ -2,11 +2,11 @@ Multiplayer games use the concept of network visibility to determine which players can see which game objects at any given time during game play. In a game that has a moving viewpoint and moving game objects, it’s common that players cannot see everything that is happening in the game at once. -If a particular player, at a certain point in time during game play, cannot see most of the other players, non-player characters, or other moving or interactive things in your game, there is usually no need for the host to send information about those things to the player’s client. +If a particular player, at a certain point in time during game play, cannot see most of the other players, non-player characters, or other moving or interactive things in your game, there is usually no need for the server to send information about those things to the player’s client. This can benefit your game in two ways: - It reduces the amount of data sent across the network between players. This can help improve the responsiveness of your game, and reduce bandwidth use. The bigger and more complex your multiplayer game, the more important this issue is. -- It also helps prevent hacking. Since a player client does not have information about things that can’t be seen, a hack on that player’s computer cannot reveal the information. +- It also helps prevent some cheating. Since a player client does not have information about things that can’t be seen, a hack on that player’s computer cannot reveal the information. The idea of “visibility” in the context of networking doesn’t necessarily relate to whether game objects are directly visible on-screen. Instead, it relates to whether data should or shouldn’t be sent about the game object in question to a particular client. Put simply, if a client can’t ‘see’ an game object, it does not need to be sent information about that game object across the network. Ideally you want to limit the amount of data you are sending across the network to only what is necessary, because sending large amounts of unnecessary data across the network can cause network performance problems. @@ -16,6 +16,10 @@ However, it can be also be resource intensive or complex to determine accurately Mirror’s [Network Proximity Checker](../Components/NetworkProximityChecker.md) component is simplest way to implement network visibility for players. It works in conjunction with the physics system to determine whether game objects are close enough (that is, “visible” for the purposes of sending network messages in your multiplayer game). +## Network Scene Checker Component + +Mirror's [Network Scene Checker](../Components/NetworkSceneChecker.md) component can be used to isolate players and networked objects on the server in additive scene instances. + ## Network Visibility on Remote Clients When a player on a remote client joins a networked game, only game objects that are network-visible to the player will be spawned on that remote client. This means that even if the player enters a large world with many networked game objects, the game can start quickly because it does not need to spawn every game object that exists in the world. Note that this applies to networked game objects in your Scene, but does not affect the loading of Assets. Unity still takes time to load the Assets for registered Prefabs and Scene game objects. @@ -29,3 +33,39 @@ The host shares the same Scene as the server, because it acts as both the server Instead, there is the virtual method OnSetLocalVisibility on the NetworkBehaviour class that is invoked. This method is invoked on all `NetworkBehaviour` scripts on game objects that change visibility state on the host. The default implementation of `OnSetLocalVisibility` disables or enables all renderer components on the game object. If you want to customize this implementation, you can override the method in your script, and provide a new behavior for how the host (and therefore the local client) should respond when a game object becomes network-visible or invisible (such as disabling HUD elements or renderers). + +## Customizing Network Visibility + +Sometimes you might want to use other kinds of visibility check, such as grid-based rules, line-of-sight tests, navigation path tests, or any other type of test that suits your game. + +To do this, you can create your own custom Network Observer from a [script template](../General/ScriptTemplates.md) via the Assets menu by clicking Create -> Mirror -> Network Observer. + +It may be helpful to understand how the Network Proximity Checker works. + +The Network Proximity Checker is implemented using the public visibility interface of Mirror’s HLAPI. Using this same interface, you can implement any kind of visibility rules you desire. Each `NetworkIdentity` keeps track of the set of players that it is visible to. The players that a NetworkIdentity game object is visible to are called the “observers” of the NetworkIdentity. + +The Network Proximity Checker calls the `RebuildObservers` method on the Network Identity component at a fixed interval (set using the “Vis Update Interval” value in the inspector), so that the set of network-visible game objects for each player is updated as they move around. + +On the `NetworkBehaviour`class (which your networked scripts inherit from), there are some virtual functions for determining visibility. These are: +- **OnCheckObserver** + This method is called on the server, on each networked game object when a new player enters the game. If it returns true, that player is added to the object’s observers. The Network Proximity Checker does a simple distance check in its implementation of this function, and uses `Physics.OverlapSphereNonAlloc` to find the players that are within the visibility distance for this object. +- **OnRebuildObservers** + This method is called on the server when `RebuildObservers` is invoked. This method expects the set of observers to be populated with the players that can see the object. The NetworkServer then handles sending `ObjectHide` and `ObjectSpawn` messages based on the differences between the old and new visibility sets. +- **OnSetHostVisibility** + This method is called on the server by the visibility system for objects on a host. Objects on a host (with a local client) cannot be disabled or destroyed when they are not visibile to the local client. So this function is called to allow custom code to hide these objects. A typical implementation will disable renderer components on the object. This is only called on local clients on a host. + +You can check whether any given networked game object is a player by checking if its `NetworkIdentity` has a valid connectionToClient. For example: + +``` cs +int hitCount = Physics.OverlapSphereNonAlloc(transform.position, visRange, hitsBuffer3D, castLayers); + +for (int i = 0; i < hitCount; i++) +{ + Collider hit = hitsBuffer3D[i]; + + NetworkIdentity identity = hit.GetComponent(); + + if (identity != null && identity.connectionToClient != null) + observers.Add(identity.connectionToClient); +} +``` diff --git a/doc/Guides/VisibilityCustom.md b/doc/Guides/VisibilityCustom.md deleted file mode 100644 index 2383420ed..000000000 --- a/doc/Guides/VisibilityCustom.md +++ /dev/null @@ -1,31 +0,0 @@ -# Customizing Network Visibility - -The built-in [Network Proximity Checker](../Components/NetworkProximityChecker.md) component is the built-in default component for determining a game object’s network visibility. However, this only provides you with a distance-based check. Sometimes you might want to use other kinds of visibility check, such as grid-based rules, line-of-sight tests, navigation path tests, or any other type of test that suits your game. - -To do this, you can implement your own custom equivalent of the Network Proximity Checker. To do that, you need to understand how the Network Proximity Checker works. See documentation on the Network Proximity Checker component. - -The Network Proximity Checker is implemented using the public visibility interface of Mirror’s HLAPI. Using this same interface, you can implement any kind of visibility rules you desire. Each `NetworkIdentity` keeps track of the set of players that it is visible to. The players that a NetworkIdentity game object is visible to are called the “observers” of the NetworkIdentity. - -The Network Proximity Checker calls the `RebuildObservers` method on the Network Identity component at a fixed interval (set using the “Vis Update Interval” value in the inspector), so that the set of network-visible game objects for each player is updated as they move around. - -On the `NetworkBehaviour`class (which your networked scripts inherit from), there are some virtual functions for determining visibility. These are: -- **OnCheckObserver** - This method is called on the server, on each networked game object when a new player enters the game. If it returns true, that player is added to the object’s observers. The Network Proximity Checker does a simple distance check in its implementation of this function, and uses `Physics.OverlapSphereNonAlloc` to find the players that are within the visibility distance for this object. -- **OnRebuildObservers** - This method is called on the server when `RebuildObservers` is invoked. This method expects the set of observers to be populated with the players that can see the object. The NetworkServer then handles sending `ObjectHide` and `ObjectSpawn` messages based on the differences between the old and new visibility sets. - -You can check whether any given networked game object is a player by checking if its `NetworkIdentity` has a valid connectionToClient. For example: - -``` cs -int hitCount = Physics.OverlapSphereNonAlloc(transform.position, visRange, hitsBuffer3D, castLayers); - -for (int i = 0; i < hitCount; i++) -{ - Collider hit = hitsBuffer3D[i]; - - NetworkIdentity identity = hit.GetComponent(); - - if (identity != null && identity.connectionToClient != null) - observers.Add(identity.connectionToClient); -} -``` diff --git a/doc/Guides/toc.yml b/doc/Guides/toc.yml index f29152a27..424fedf05 100644 --- a/doc/Guides/toc.yml +++ b/doc/Guides/toc.yml @@ -8,22 +8,20 @@ href: Authentication.md - name: Network Discovery href: NetworkDiscovery.md -- name: Conversion - href: Conversion.md +- name: Player Movement + href: CheatSafeLocalPlayerMovement.md - name: Network Profiler href: Profiler.md - name: Attributes href: Attributes.md -- name: NetworkBehaviour - href: NetworkBehaviour.md +- name: Network Behaviour + href: Network Behaviour.md - name: Clock Synchronization href: ClockSync.md - name: Data Types href: DataTypes.md - name: Visibility href: Visibility.md -- name: Custom Visibility - href: VisibilityCustom.md - name: Development Servers href: DevServer/toc.yml topicHref: DevServer/ diff --git a/doc/Transports/DiscordMirror.PNG b/doc/Transports/Discord.PNG similarity index 100% rename from doc/Transports/DiscordMirror.PNG rename to doc/Transports/Discord.PNG diff --git a/doc/Transports/DiscordMirror.md b/doc/Transports/Discord.md similarity index 60% rename from doc/Transports/DiscordMirror.md rename to doc/Transports/Discord.md index 31bb04111..e05cee95d 100644 --- a/doc/Transports/DiscordMirror.md +++ b/doc/Transports/Discord.md @@ -1,8 +1,8 @@ -# Discord-Mirror +# Discord Transport -Discord-Mirror is a networking transport that enables sending networking packets via [Discord's Game SDK](https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide). +Discord Transport is a networking transport that enables sending networking packets via [Discord's Game SDK](https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide). -![The Discord-Mirror Transport](DiscordMirror.PNG) +![The Discord Transport](Discord.PNG) [Latest Release](https://github.com/Derek-R-S/Discord-Mirror/releases) diff --git a/doc/Transports/index.md b/doc/Transports/index.md index 405e4ec62..9a16b99b5 100644 --- a/doc/Transports/index.md +++ b/doc/Transports/index.md @@ -12,7 +12,7 @@ Mirror is a high level Networking Library that can use several different low lev - [Fallback](Fallback.md) Fallback is a compatibility transport for transports that don't run on all platforms and need fallback options to cover all other platforms. -- [Discord](DiscordMirror.md) Discord-Mirror is a networking transport that enables sending networking packets via [Discord's Game SDK](https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide). +- [Discord](Discord.md) Discord Transport is a networking transport that enables sending networking packets via [Discord's Game SDK](https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide). - [UDP - Ignorance](Ignorance.md) Ignorance implements a reliable and unreliable sequenced UDP transport based on ENet. diff --git a/doc/Transports/toc.yml b/doc/Transports/toc.yml index 9e7bcad07..a20a7bef3 100644 --- a/doc/Transports/toc.yml +++ b/doc/Transports/toc.yml @@ -9,7 +9,7 @@ - name: Fallback href: Fallback.md - name: Discord - href: DiscordMirror.md + href: Discord.md - name: UDP - Ignorance href: Ignorance.md - name: UDP - LiteNetLib4Mirror diff --git a/doc/index.md b/doc/index.md index b4df3b1d2..4341ea957 100644 --- a/doc/index.md +++ b/doc/index.md @@ -28,17 +28,16 @@ We've developed a [List Server](https://mirror-networking.com/list-server/) wher - Additive Scene Loading - Single and separated Unity projects supported - Network [Authenticators](Guides/Authentication.md) to protect your game +- Network [Discovery](Guides/NetworkDiscovery.md) to easily connect LAN players to a LAN Host - Network [Manager](Components/NetworkManager.md) and [HUD](Components/NetworkManagerHUD.md) - Network [Room Manager](Components/NetworkRoomManager.md) and [Room Player](Components/NetworkRoomPlayer.md) - Network [Identity](Components/NetworkIdentity.md) -- Network [Transform](Components/NetworkTransform.md) +- Network [Transform](Components/NetworkTransform.md) to sync position, rotation, and scale with interpolation - Network [Animator](Components/NetworkAnimator.md) with 64 parameters -- Network [Proximity Checker](Components/NetworkProximityChecker.md) +- Network [Proximity Checker](Components/NetworkProximityChecker.md) to help with Area of Interest +- Network [Scene Checker](Components/NetworkSceneChecker.md) to islolate players and networked objects to Additive scene instances - [SyncVar](Guides/Sync/SyncVars.md), [SyncList](Guides/Sync/SyncLists.md), [SyncEvent](Guides/Sync/SyncEvent.md), [SyncDictionary](Guides/Sync/SyncDictionary.md), and [SyncHashSet](Guides/Sync/SyncHashSet.md) -**Guides** -- [Cheat safe, local player movement beyond NetworkTransform](Guides/CheatSafeLocalPlayerMovement.md) - **Integrations** - [Dissonance Voice Chat](https://assetstore.unity.com/packages/tools/audio/dissonance-voice-chat-70078) - [Network Sync Transform](https://github.com/emotitron/NetworkSyncTransform) @@ -47,3 +46,5 @@ We've developed a [List Server](https://mirror-networking.com/list-server/) wher - [RTS Engine](https://assetstore.unity.com/packages/templates/packs/rts-engine-79732) - [Smooth Sync](https://assetstore.unity.com/packages/tools/network/smooth-sync-96925) - [Weather Maker](https://assetstore.unity.com/packages/tools/particles-effects/weather-maker-unity-weather-system-sky-water-volumetric-clouds-a-60955) +- [Steamworks Networking](https://assetstore.unity.com/packages/tools/integration/steamworks-networking-151300) +- [Master Audio Multiplayer](https://assetstore.unity.com/packages/tools/audio/master-audio-multiplayer-69547)