docs: Updated various documents

This commit is contained in:
Chris Langsenkamp 2020-02-17 23:10:47 -05:00
parent f4677ff627
commit e5dec90499
29 changed files with 104 additions and 197 deletions

View File

@ -1,3 +0,0 @@
# Facebook Authenticator
Coming Soon

View File

@ -1,3 +0,0 @@
# Google Authenticator
Coming Soon

View File

@ -1,3 +0,0 @@
# PlayFab Authenticator
Coming Soon

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<T>.
- 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

View File

@ -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 doesnt 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 doesnt 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 NetworkManagers 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:

View File

@ -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 doesnt 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 NetworkManagers 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 players 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

View File

@ -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, its 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 players 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 players 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 cant be seen, a hack on that players computer cannot reveal the information.
- It also helps prevent some cheating. Since a player client does not have information about things that cant be seen, a hack on that players computer cannot reveal the information.
The idea of “visibility” in the context of networking doesnt necessarily relate to whether game objects are directly visible on-screen. Instead, it relates to whether data should or shouldnt be sent about the game object in question to a particular client. Put simply, if a client cant 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
Mirrors [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 Mirrors 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 objects 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<NetworkIdentity>();
if (identity != null && identity.connectionToClient != null)
observers.Add(identity.connectionToClient);
}
```

View File

@ -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 objects 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 Mirrors 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 objects 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<NetworkIdentity>();
if (identity != null && identity.connectionToClient != null)
observers.Add(identity.connectionToClient);
}
```

View File

@ -8,8 +8,8 @@
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
@ -22,8 +22,6 @@
href: DataTypes.md
- name: Visibility
href: Visibility.md
- name: Custom Visibility
href: VisibilityCustom.md
- name: Development Servers
href: DevServer/toc.yml
topicHref: DevServer/

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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)