Unity5.1 新的网络引擎UNET(十五) Networking 引用--中
孙广东 2015.7.21
本节提供了与网络系统一起使用的组件的具体信息。
3、NetworkClient
NetworkClient 是一个 HLAPI 类,管理网络连接到服务器 — — 相应着 UNET NetworkServer。它能够用于将消息发送到服务器和从服务器接收消息。NetworkClient 还能够帮助管理衍生的网络对象和 RPC 消息和网络事件的路由。
Properties
| Property: | Function: | |
|---|---|---|
| serverIP | The IP address of the server that this client is connected to. | |
| serverPort | The port of the server that this client is connected to. | |
| connection | The NetworkConnection object this client is using. | |
| handlers | The set of registered message handler functions. | |
| numChannels | The number of configured NetworkTransport QoS channels. | |
| isConnected | True if the client is connected to a server. | |
| allClients | List of active network clients (static). | |
| active | True if any network clients are active (static). | |
4、NetworkConnection
NetworkConnection是一个 HLAPI 类。封装了网络连接。NetworkClient 对象具有一个NetworkConnections,和 NetworkServers 有多个NetworkConnections------来自每一个客户端。 网络连接已能发送字节数组,或序列化的对象作为 网络消息。
Properties
| Property: | Function: | |
|---|---|---|
| hostId | The NetworkTransport hostId for this connection. | |
| connectionId | The NetworkTransport connectionId for this connection. | |
| isReady | Flag to control whether state updates are sent to this client. | |
| address | The IP address of the end-point that this connection is connected to. | |
| playerControllers | The set of players that have been added with AddPlayer(). | |
5、NetworkIdentity
NetworkIdentity 组件是Unity 组件,它是 新网络系统的核心 。
它能够被加入到对象。
从-AddComponents->Network->NetworkIdentity 菜单项 。此组件控制对象的网络标识。这表明 NetworkIdentity 组件在一个对象上例如以下所看到的:
与Unity Network System的 服务器权威系统,网络的对象的NetworkIdentities 必须是由服务器使用 NetworkServer.Spawn()所 “spawned” 。这会导致他们被分配NetworkInstanceId。在连接到服务器的客户端上创建。
场景物体比动态实例化对象有点差别对待。
这些对象是全部 出如今客户端和服务器上的场景中。然而。当建设游戏 的全部场景对象的identities 将被都禁用。
当客户端连接到服务器时,服务器将通知客户端应启用哪些场景对象 和其最新的状态信息是通过 spawn 消息。这可确保客户端将不会包括对象放置在如今不对的位置。当他開始playing。或 甚至对象会马上被删除连接由于一些事件中移除他们之前客户端连接。
"ServerOnly" 复选框将确保这某一特定对象不会催生了或在客户端上启用。
此组件包括像什么场景 ID,网络 ID 和 资产 ID 已分配给对象的跟踪信息。场景 ID 是一个在 NetworkIdentity 组件的全部场景物体中有效。网络 ID 是此特定对象实例的 ID,可能有多个对象的特定对象类型的实例化和 网络 ID 用于的标识的对象,比如,网络更新应适用。资产 ID 是指什么源资产对象被实例化。
这是内部使用。当特定对象预置被网络spawned 。
此信息被公开的预览面板底部的Inspector:
在执行时是要在此处显示的具体信息 (disabled NetworkBehaviour 显示 非粗体):
Properties
| Property: | Function: | |
|---|---|---|
| netId | A unique identifier for this network session, assigned when spawned. | |
| sceneId | A unique identifier for networked objects in a scene. This is only populated in play-mode. | |
| isClient | True if this object is running on a client. | |
| isServer | True if this object is running on the server, and has been spawned. | |
| hasAuthority | True if this object is the authoritative version of the object. So either on a the server, or on the client with localPlayerAuthority. | |
| localPlayerAuthority | True if this object is controlled by the client that owns it - the local player object on that client has authority over it. This is used by other components such as NetworkTransform. | |
| serverOnly | A flag to make this object not be spawned on clients. | |
| assetId | This identifies the prefab associated with this object (for spawning). | |
| playerControllerId | The identifier of the controller associated with this object. Only valid for player objects. | |
| observers | The list of client NetworkConnections that are able to see this object. This is read-only. | |
Hints
- Put a NetworkIdentity component on prefabs that will be spawned.
- A NetworkIdentity is required for every object that is networked.
6、Network Lobby Manager
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
NetworkLobbyManager 是一种特殊的网络管理器。主要玩游戏进入主场景之前的提供一个多层的大堂。
• 提供网络大厅的player限制
• 游戏開始时全部玩家都是准备好了
• 玩家不能加入game-in-progress
• 支持“Couch Multiplayer”
• 可自己定义的方式为玩家选择在大厅中的选项
有两种类型的球员与 NetworkLobbyManager 的对象:
LobbyPlayer 对象
• 对于每一个玩家
• 创建客户端连接,或player被加入时
• 持续,直到客户端断开连接
• 拥有准备flag和配置数据
• 处理在大厅里的命令
• 应该使用 NetworkLobbyPlayer 组件
GamePlayer 对象
• 对于每一个玩家
• 開始游戏场景时被创建
• 又一次进入大厅时被摧毁
• 处理在游戏中命令
Properties
| Property: | Function: |
|---|---|
| showLobbyGUI | Show the legacy OnGUI controls for the lobby. |
| maxPlayers | The maximum number of players allowed in the lobby. |
| maxPlayersPerConnection | The maximum number of players allowed to be added for each client connection. |
| lobbyPlayerPrefab | The prefab to create for players when they enter the lobby. |
| gamePlayerPrefab | The prefab to create for players when the game starts. |
| lobbyScene | The scene to use for the lobby. |
| playScene | The scene to use for main game play. |
Details
- LobbyPlayerPrefab 插槽应填写。一个对象的 NetworkLobbyPlayer 组件。
- 有一个lobby manager GUI。看到多人游戏大厅资产包。
7、Network Lobby Player
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Properties
| Property: | Function: | |
|---|---|---|
| ShowLobbyGUI | True to show the legacy user interface for players in the lobby. | |
| slot | The slot that this player was allocated too. Only one player can be in each lobby slot. | |
| readyToBegin | Flag to control if the player is ready for the game to start. | |
8、Network Manager UNet
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
网络 管理器是一个更高的水平类 使您能够控制一个网络游戏的状态 。
它提供了界面编辑器用于 ,和场景。以用于不同的网络游戏状态的预置控制网络的配置中。
Properties
| Property: | Function: |
|---|---|
| networkPort | The network port used to listen on and connect to. |
| networkAddress | The network address to connect to. |
| dontDestroyOnLoad | Flag to make the NetworkManager persist between scenes. |
| runInBackground | Flag to make the player run in the background by default. |
| sendPeerInfo | Flag to have network information on all peers sent to all participating clients. |
| maxDelay | The maximum time in seconds to delay buffered messages. |
| logLevel | The level of network logging to write. |
| playerPrefab | The prefab to instantiate for players when a client connects. |
| autoCreatePlayer | Flag to automatically add a player when a client connects. |
| playerSpawnMethod | How to spawn players at StartPositions. |
| offlineScene | The scene to switch to when the network goes off-line. |
| onlineScene | The scene to switch to when the network goes on-line. |
| spawnPrefabs | The set of registered spawnable prefabs. |
| startPositions | The set of NetworkStartPosition objects found in the scene. |
| customConfig | Flag to use custom network configuration (advanced). |
| connectionConfig | Advanced custom network configuration data. |
| maxConnections | The maximum number of connections allowed by the server. |
| channels | The number of transport layer QoS Channels. |
| secureTunnelEndpoint | End point for XBox Live connectivity. |
| useSimulator | Flag to use network conditions simulation. |
| simulatedLatency | Latency in milliseconds to add when network simulator active. |
| packetLossPercentage | The percentage of packet loss to add when network simulator active |
| matchHost | Matchmaker host address. |
| matchPort | Matchmaker host port. |
9、Network Manager HUD
Suggest a change
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Your name Your email Suggestion *Submit suggestion
控制游戏的网络状态提供了默认的用户界面。它还在编辑器中显示有关网络管理器的当前状态信息。
Properties
| Property: | Function: |
|---|---|
| showGUI | Flag to show the default UI. |
| offsetX | The horizontal pixel offset of the UI. |
| offsetY | The vertical pixel offset of the UI.. |
Details
NetworkManagerHUD 同意您查看在编辑器中,比如connections,非常多细节 列出 已知的网络的对象,和激活 玩家对象。
Unity5.1 新的网络引擎UNET(十五) Networking 引用--中的更多相关文章
- Unity5.1 新的网络引擎UNET(二) UNET 官方推荐Demo案例
http://blog.csdn.net/u010019717/article/details/46873153 视频 http://www.iqiyi.com/playlist391685502.h ...
- Unity5.1 新的网络引擎UNET(九) UNET 官方推荐视频教程
孙广东 2015.7.14 在新的网络引擎出现之前,Unity提供的是 内置 Raknet网络引擎, 这一次Unity想更新UGUI一样,花了大的手笔更新了, UNET. 原来的旧的网络组件 被提示 ...
- Unity5.1 新的网络引擎UNET(十五) Networking 引用--下
孙广东 2015.7.21 本节提供了与网络系统一起使用的组件的具体信息. 10.Network Proximity Checker Suggest a change Success! Than ...
- Unity5.1 新的网络引擎UNET(十五) Networking 引用--上
http://blog.csdn.net/u010019717/article/details/46993697 孙广东 2015.7.21 本节提供了与网络系统一起使用的组件的详细信息. 1.Ne ...
- Unity5.1 新的网络引擎UNET(八) UNET 系统概括
孙广东 2015.7.12 Server and Host 在Unity 的 网络系统,游戏有 一个server和多个client. 当没有专用的server时,client之中的一个扮演s ...
- Unity5.1 新的网络引擎UNET(四) UNET Remote Actions
孙广东 2015.7.12 网络系统 具有网络中执行操作actions 的方法.这些类型的actions 有时是调用远程过程调用(Remote Procedure Calls). 在网络系统中有两 ...
- Unity5.1 新的网络引擎UNET(七) UNET 单人游戏转换为多人
单人游戏转换为多人 孙广东 2015.7.12 本文档描写叙述将单人游戏转换为使用新的网络系统的多人游戏的步骤.这里描写叙述的过程是简化,对于一个真正的游戏事实上须要更高级别版本号的实际 ...
- centos Linux系统日常管理2 tcpdump,tshark,selinux,strings命令, iptables ,crontab,TCP,UDP,ICMP,FTP网络知识 第十五节课
centos Linux系统日常管理2 tcpdump,tshark,selinux,strings命令, iptables ,crontab,TCP,UDP,ICMP,FTP网络知识 第十五节课 ...
- 学习笔记:CentOS7学习之二十五:shell中色彩处理和awk使用技巧
目录 学习笔记:CentOS7学习之二十五:shell中色彩处理和awk使用技巧 25.1 Shell中的色彩处理 25.2 awk基本应用 25.2.1 概念 25.2.2实例演示 25.3 awk ...
随机推荐
- IDEA破解方法以及快捷键大全
IntelliJ IDEA2017.3 激活 - CSDN博客:https://blog.csdn.net/dc2222333/article/details/78582131 Eclipse和Int ...
- php循环结构
1.while循环 先判断条件,如果条件成立则执行循环的代码 嵌套循环,需要先把嵌套在内的循环执行完毕再执行外面的循环 While(条件语句){......} //如果()条件成立,执行{}里面的语句 ...
- Python 设计模式--策略模式
策略模式(Strategy Pattern) 策略模式是一种与行为相关的设计模式,允许你在运行时根据指定的上下文确定程序的动作.可以在两个类中封装不同的算法,并且在程序运行时确定到底执行哪中策略. 特 ...
- ADPU 大全
APDU协议 APDU协议,即是智能卡与读写器间的应用层协议,在ISO7816-4[7]中定义了该协议的结构格式.APDU数据有两种结构,读写器使用的APDU结构为命令APDU,C-APDU(Comm ...
- Python批量生成用户名
写在最前 平时在工作中尤其是在做压测的时候难免需要一些用户名和密码,写个简单的Python小脚本批量生成一些 代码示例 import random,string #生成大小字母和数字一起的大字符串 a ...
- 对SNL语言的解释器实现尾递归优化
对于SNL语言解释器的内容可以参考我的前一篇文章<使用antlr4及java实现snl语言的解释器>.此文只讲一下"尾递归优化"是如何实现的--"尾递归优化& ...
- solr 6.5.1 linux 环境安装
前言 最近在研究搜索引擎,准备搭建一套属于自己的搜索APP,用于搜索的数据我已通过scrapy抓到本地了,现在需要一个搜索引擎来跑这些数据.于是选择了基于Lucene的solr来为我做搜索引擎的工作. ...
- Redis系列(十一)--阿里云开发规范
本文主要介绍阿里云Redis的开发规范,主要从以下几个方面说明: 1.键值设计 2.命令使用 3.客户端使用 4.相关工具 一.键值设计 1.key name设计 1).[建议]:可读性和可管理性 以 ...
- java虚拟机(四)--内存溢出、内存泄漏、SOF
学习了java运行时数据区,知道每个内存区域保存什么数据,可以参考:https://www.cnblogs.com/huigelaile/p/diamondshine.html,然后了 解内存溢出和内 ...
- 「 COGS 2240 」 X 「 Luogu P2885 」 架设电话线
解题思路 首先很容易就想到了一个二维的朴素的 $dp$. 设 $dp[i][j]$ 表示第 $i$ 个位置的电话线杆的高度为 $j$ 时的最小花费,就需要枚举第 $i$ 个电话线杆.第 $i$ 个电话 ...