mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Remove Usage of LAN in HUD and Docs (#1592)
* Remove usage of LAN in HUD and docs * Server + Client * Host (Server + Client) * HUD Image
This commit is contained in:
parent
4c15fcf771
commit
c796116758
@ -1,4 +1,4 @@
|
|||||||
# Additive Scenes Example
|
# Additive Scenes Example
|
||||||
|
|
||||||
IMPORTANT: Make sure you have a layer in project settings called Player for this example to work well.
|
IMPORTANT: Make sure you have a layer in project settings called Player for this example to work well.
|
||||||
|
|
||||||
@ -12,10 +12,10 @@ File -> Build and Run
|
|||||||
|
|
||||||
Start up to 3 built instances: These will all be client players.
|
Start up to 3 built instances: These will all be client players.
|
||||||
|
|
||||||
Press Play in the Editor and click LAN Host in the editor
|
Press Play in the Editor and click Host (Server + Client) in the HUD
|
||||||
- This will be the host and the 1st player of up to 4. You can also use LAN Server if you prefer.
|
- This will be the host and the 1st player of up to 4. You can also use Server Only if you prefer.
|
||||||
|
|
||||||
Click LAN Client in the built instances.
|
Click Client in the built instances.
|
||||||
- WASDQE keys to move & turn your player capsule.
|
- WASDQE keys to move & turn your player capsule.
|
||||||
- There are objects in the corners of the scene hidden by Proximity Checkers.
|
- There are objects in the corners of the scene hidden by Proximity Checkers.
|
||||||
- The big area in the middle is where the subscene will be loaded when you get near the shelter.
|
- The big area in the middle is where the subscene will be loaded when you get near the shelter.
|
||||||
|
@ -6,11 +6,11 @@ This is a bare bones example of a running game with Network Manager and UI prefa
|
|||||||
|
|
||||||
2. Open the Example scene and build the project.
|
2. Open the Example scene and build the project.
|
||||||
|
|
||||||
3. In the editor, click Play, and LAN Host or LAN Server...it will be listening on port 7777.
|
3. In the editor, click Play, and Server + Client or Server Only...it will be listening on port 7777.
|
||||||
- If you clicked LAN Host, the host player will appear as Player 00.
|
- If you clicked Host (Server + Client), the host player will appear as Player 00.
|
||||||
|
|
||||||
4. Run one or more instances (up to 16 total players) of the built application.
|
4. Run one or more instances (up to 16 total players) of the built application.
|
||||||
|
|
||||||
5. Click LAN Client on each instance.
|
5. Click Client on each instance.
|
||||||
|
|
||||||
6. Now you will see all players in the editor and the clients, all with data being updated and synchronized.
|
6. Now you will see all players in the editor and the clients, all with data being updated and synchronized.
|
||||||
|
@ -13,9 +13,9 @@ Start up to 4 built instances: These will all be client players.
|
|||||||
|
|
||||||
Open the Offline scene in the Editor and press Play
|
Open the Offline scene in the Editor and press Play
|
||||||
|
|
||||||
Click LAN Host in the editor: This will be host and the 5th player. You can also use LAN Server if you prefer.
|
Click Host (Server + Client) in the HUD: This will be host and the 5th player. You can also use Server Only if you prefer.
|
||||||
|
|
||||||
Click LAN Client in the built instances.
|
Click Client in the built instances.
|
||||||
|
|
||||||
Click Ready in each instance, and finally in the Editor (Host).
|
Click Ready in each instance, and finally in the Editor (Host).
|
||||||
|
|
||||||
|
@ -47,25 +47,25 @@ void OnGUI()
|
|||||||
{
|
{
|
||||||
if (!NetworkClient.active)
|
if (!NetworkClient.active)
|
||||||
{
|
{
|
||||||
// LAN Host
|
// Server + Client
|
||||||
if (Application.platform != RuntimePlatform.WebGLPlayer)
|
if (Application.platform != RuntimePlatform.WebGLPlayer)
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("LAN Host"))
|
if (GUILayout.Button("Host (Server + Client)"))
|
||||||
{
|
{
|
||||||
manager.StartHost();
|
manager.StartHost();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LAN Client + IP
|
// Client + IP
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
if (GUILayout.Button("LAN Client"))
|
if (GUILayout.Button("Client"))
|
||||||
{
|
{
|
||||||
manager.StartClient();
|
manager.StartClient();
|
||||||
}
|
}
|
||||||
manager.networkAddress = GUILayout.TextField(manager.networkAddress);
|
manager.networkAddress = GUILayout.TextField(manager.networkAddress);
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
// LAN Server Only
|
// Server Only
|
||||||
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
if (Application.platform == RuntimePlatform.WebGLPlayer)
|
||||||
{
|
{
|
||||||
// cant be a server in webgl build
|
// cant be a server in webgl build
|
||||||
@ -73,7 +73,7 @@ void OnGUI()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("LAN Server Only")) manager.StartServer();
|
if (GUILayout.Button("Server Only")) manager.StartServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -20,11 +20,11 @@ The Network Manager HUD provides the basic functions so that people playing your
|
|||||||
|
|
||||||
## Using the HUD
|
## Using the HUD
|
||||||
|
|
||||||
The Network Manager HUD starts in LAN Host mode, and displays buttons relating to hosting and joining a multiplayer game.
|
The Network Manager HUD starts in Server + Client mode, and displays buttons relating to hosting and joining a multiplayer game.
|
||||||
|
|
||||||
### LAN Host
|
### Host (Server + Client)
|
||||||
|
|
||||||
Click the LAN Host button to start a game as a host on the local network. This client is both the host *and* one of the players in the game. It uses the information from the Network Info section in the inspector to host the game.
|
Click the Host (Server + Client) button to start a game as a host on the local network. This client is both the host *and* one of the players in the game. It uses the information from the Network Info section in the inspector to host the game.
|
||||||
|
|
||||||
When you click this button, the HUD switches to a simple display of network details, and a Stop button which allows you to stop hosting the game and return to the main HUD menu.
|
When you click this button, the HUD switches to a simple display of network details, and a Stop button which allows you to stop hosting the game and return to the main HUD menu.
|
||||||
|
|
||||||
@ -34,19 +34,19 @@ When you have started a game as a host, other players of the game can then conne
|
|||||||
|
|
||||||
Click the Stop button to disconnect from the host. Clicking Stop also returns to the main HUD menu.
|
Click the Stop button to disconnect from the host. Clicking Stop also returns to the main HUD menu.
|
||||||
|
|
||||||
### LAN Client
|
### Client
|
||||||
|
|
||||||
To connect to a host on the internet use the text field to the right of the LAN Client button to specify the address of the host. The default host address is “localhost”, which means the client looks on its own computer for the game host. In addition to *localhost*, you can specify an IPv4 address, and IPv6 address, or a fully-qualified domain name (FQDN), e.g. *game.example.com*, and the transport with resolve the name using DNS. Click LAN Client to attempt to connect to the host address you have specified.
|
To connect to a host on the internet use the text field to the right of the Client button to specify the address of the host. The default host address is “localhost”, which means the client looks on its own computer for the game host. In addition to *localhost*, you can specify an IPv4 address, and IPv6 address, or a fully-qualified domain name (FQDN), e.g. *game.example.com*, and the transport with resolve the name using DNS. Click Client to attempt to connect to the host address you have specified.
|
||||||
|
|
||||||
Use the default “localhost” in this field if you are running multiple instances of your game on one computer, to test multiplayer interactivity. To do this, you can create a standalone build of your game, and then launch it multiple times on your computer. This is a common way to quickly test that your networked game interactions are functioning as you expect, without you needing to deploy your game to multiple computers or devices.
|
Use the default “localhost” in this field if you are running multiple instances of your game on one computer, to test multiplayer interactivity. To do this, you can create a standalone build of your game, and then launch it multiple times on your computer. This is a common way to quickly test that your networked game interactions are functioning as you expect, without you needing to deploy your game to multiple computers or devices.
|
||||||
|
|
||||||
![An example of three instances of a networked game running on the same desktop PC. This is useful for quick tests to ensure networked interactions are behaving as you intended. One is running as LAN Host, and two are running as LAN Client.](NetworkGame3Instances.jpg)
|
![An example of three instances of a networked game running on the same desktop PC. This is useful for quick tests to ensure networked interactions are behaving as you intended. One is running as Host, and two are running as Client.](NetworkGame3Instances.jpg)
|
||||||
|
|
||||||
When you want to test your game on multiple machines you need to put the address of the computer acting as host into the address text field.
|
When you want to test your game on multiple machines you need to put the address of the computer acting as host into the address text field.
|
||||||
|
|
||||||
The computer acting as the host needs to tell their IP address to everyone running clients, so that you can type this into the box. For local clients on a LAN, that's the local IP address. For remote clients, that's the WAN IP address of the router of the host. Firewall rules and port-forwarding are generally required for a computer to act as host and accept connections from other computers, whether they're on the LAN or the internet.
|
The computer acting as the host needs to tell their IP address to everyone running clients, so that you can type this into the box. For local clients on a LAN, that's the local IP address. For remote clients, that's the WAN IP address of the router of the host. Firewall rules and port-forwarding are generally required for a computer to act as host and accept connections from other computers, whether they're on the LAN or the internet.
|
||||||
|
|
||||||
Enter the IP address (or leave it as “localhost” if you are testing it on your own machine), then click LAN Client to attempt to connect to the host.
|
Enter the IP address (or leave it as “localhost” if you are testing it on your own machine), then click Client to attempt to connect to the host.
|
||||||
|
|
||||||
When the client is attempting to connect, the HUD displays a Cancel Connection Attempt button. Click this if you want to stop trying to connect to the host.
|
When the client is attempting to connect, the HUD displays a Cancel Connection Attempt button. Click this if you want to stop trying to connect to the host.
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ If the connection is successful, the HUD displays the Stop button. Click this if
|
|||||||
|
|
||||||
![The HUD GUI after a successful connection](NetworkManagerHUDConnected.png)
|
![The HUD GUI after a successful connection](NetworkManagerHUDConnected.png)
|
||||||
|
|
||||||
### LAN Server Only
|
### Server Only
|
||||||
|
|
||||||
Click LAN Server Only to start a game which acts as a server that other clients can connect to, but which does not act as a client to the game itself. This type of game is often called a “dedicated server”. A user cannot play the game on this particular instance of your game. All players must connect as clients, and nobody plays on the instance that is running as the server.
|
Click Server Only to start a game which acts as a server that other clients can connect to, but which does not act as a client to the game itself. This type of game is often called a “dedicated server”. A user cannot play the game on this particular instance of your game. All players must connect as clients, and nobody plays on the instance that is running as the server.
|
||||||
|
|
||||||
A dedicated server results in better performance for all connected players, because the server doesn’t need to process a local player’s game play in addition to acting as server.
|
A dedicated server results in better performance for all connected players, because the server doesn’t need to process a local player’s game play in addition to acting as server.
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.8 KiB |
@ -42,8 +42,8 @@ will be automatically registered by the NetworkManager as spawning positions.
|
|||||||
## Setting up the network
|
## Setting up the network
|
||||||
|
|
||||||
A very convenient component for establish/testing connections is the
|
A very convenient component for establish/testing connections is the
|
||||||
NetworkManagerHUD. It provides basic functionality for start a game as LAN
|
NetworkManagerHUD. It provides basic functionality for start a game as
|
||||||
client, LAN server or host (LAN client and LAN server at the same time). It
|
Client, Server, or Host (Client and Server at the same time). It
|
||||||
requires the NetworkManager component.
|
requires the NetworkManager component.
|
||||||
|
|
||||||
![NetworkManagerHUD](Pong4.jpg)
|
![NetworkManagerHUD](Pong4.jpg)
|
||||||
|
@ -28,7 +28,7 @@ We've developed a [List Server](https://mirror-networking.com/list-server/) wher
|
|||||||
- Additive Scene Loading
|
- Additive Scene Loading
|
||||||
- Single and separated Unity projects supported
|
- Single and separated Unity projects supported
|
||||||
- Network [Authenticators](Guides/Authentication.md) to protect your game
|
- Network [Authenticators](Guides/Authentication.md) to protect your game
|
||||||
- Network [Discovery](Guides/NetworkDiscovery.md) to easily connect LAN players to a LAN Host
|
- Network [Discovery](Guides/NetworkDiscovery.md) to easily connect LAN players to a LAN Server or Host
|
||||||
- Network [Manager](Components/NetworkManager.md) and [HUD](Components/NetworkManagerHUD.md)
|
- Network [Manager](Components/NetworkManager.md) and [HUD](Components/NetworkManagerHUD.md)
|
||||||
- Network [Room Manager](Components/NetworkRoomManager.md) and [Room Player](Components/NetworkRoomPlayer.md)
|
- Network [Room Manager](Components/NetworkRoomManager.md) and [Room Player](Components/NetworkRoomPlayer.md)
|
||||||
- Network [Identity](Components/NetworkIdentity.md)
|
- Network [Identity](Components/NetworkIdentity.md)
|
||||||
|
Loading…
Reference in New Issue
Block a user