Photon——Setup and Config 设置与配置
生活随笔
收集整理的这篇文章主要介绍了
Photon——Setup and Config 设置与配置
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
Setup and Config 设置与配置
This chapter explains how files and folders are organized for the Photon Server and how things are setup. Everything needed is in the deploy folder. 这章解释了在服务器上文件和文件夹是如何被组织和配置的。Content 内容
-
- Organization of Server and Applications 组织服务器与应用程序
- Configuration: PhotonServer.config 配置PhotonServer.config
- The Application Node 应用程序节点
- UDPListeners and TCPListeners Nodes UDP监听和TCP监听节点
- TCPSilverlightListeners and TCPFlashListeners Nodes TCP的Silverlight和Flash的监听节点
- Timeout Settings 超时设置
- Send Delay and Ack Delay 发送延迟和Ack延迟
Organization of Server and Applications 组织服务器与应用程序
There are four versions of Photon in the folders: “bin_Win32”, “bin_x64”, “bin_Win32_xp” and “bin_win64_xp”. We refer to these as binaries-folders. 在文件夹中这有不同版本的Photon:“bin_Win32”, “bin_x64”, “bin_Win32_xp” and “bin_win64_xp”,我选择需要使用的那个二进制文件夹。 Photon requires a separate folder next to the binaries-folder per application (e.g. “Lite” in the deploy folder). The assemblies must be in a “bin” subfolder (e.g. Lite/bin). Photon需要独立的文件夹去存放应用程序,程序集必须放在文件夹内的Bin目录下。 The following folders in the Server SDK deploy folder are applications: Lite, LiteLobby, MMO, CounterPublisher, Policy Applications are setup in Photon’s config file, as explained below. 在服务器SDk deploy 文件夹下的应用程序有: Lite, LiteLobby, MMO, CounterPublisher, Policy Applications,被配置在Photon的配置文件中。 The bin_tools folder currently contains useful tools: bin_tools文件夹中有以下可用的工具:- Baretail: Our favorite log viewer in the free edition. It is used by PhotonControl to view the latest logs.
- Photon Dashboard: The service to collect and concentrate Dashboard Counters and display them on a webpage.
- Perfmon: Contains a list of PerfMon counters used when you setup counter logging to a file. This is explained under “Administration”.
- Stardust: A commandline testclient that can be used to get some load on a machine. This is shown in Photon in 5 Minutes
Configuration: PhotonServer.config 配置PhotonServer.config
The main configuration file for Photon is the PhotonServer.config. An identical copy is located in each binaries-folder in the SDK. It is used to setup applications, listeners for IPs and performance specific values. It does not contain config values for the game logic. PhotonServer.config是Photon的主配置文件,在每个二进制文件夹中,它是用来配置应用程序,监听器和性能值。他不能用来配置游戏逻辑的值。 The default values make sure Photon scales nicely on more cores but does not overwhelm a regular machine. In general performance tweaks are not needed. 这默认值保证了Photon的兼容性,一般情况下性能不需要调整 The following settings are most commonly used. More options are described in the “photon-configuration.pdf”, located in the Server SDK. 以下是最常用的设置项,更多的设置请参看“photon-configuration.pdf”,在本地服务器的SDK中。The Application Node 应用程序节点
The config file defines which applications Photon should load on startup. In the “Applications” node, several “Application” entries can be added. 配置文件定义了Photon将运行哪些应用程序,在 “Applications” 节点中为每个应用程序添加一个 “Application”节点。| <ApplicationsDefault="Lite"> <!-- Lite Application --> <Application Name="Lite" BaseDirectory="Lite\Lite" Assembly="Lite" Type="Lite.LiteApplication" EnableAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> </Applications> |
UDPListeners and TCPListeners Nodes UDP监听和TCP监听节点
These configure UDP and TCP endpoints on your machine respectively. You can use either (e.g. only UDP) or both. 在你的机器上配置UDP和TCP的端口,你可以使用其中的一种或两种。 The default IP 0.0.0.0 makes Phonton listen on any locally available IP. By replacing the wildcard IP, Photon will open only specific IPs and ports. Multiple UDPListener and TCPListener nodes can be defined, opening several IP/port combinations. 默认IP是0.0.0.0,这使得Photon将监听所有的本地可用的IP。通过替换IP通配符,Photon将打开指定的IP和端口。可以定义多个UDPListener 和 TCPListener 节点来打开多组IP与端口组合。 Per UDPListener and TCPListener node, you can setup an OverrideApplication or DefaultApplication. Override means: any client that connects to this port will end up in the application named, no matter what the client connects to. Default is a fallback, in case the application named by a client is not found. 每个UDPListener 和 TCPListener 节点,你可以设置一个OverrideApplication 或 DefaultApplication。Override 的意义是:任意连接该端口的客户端无论它连接到什么都将在已命名的应用中结束,Default 是备用的,用在客户端找不到已命名的应用程序。| <UDPListeners> <UDPListener IPAddress="0.0.0.0" Port="5055" OverrideApplication="Master"> </UDPListener> <UDPListener IPAddress="0.0.0.0" Port="5056" OverrideApplication="Game1"> </UDPListener> </UDPListeners> |
TCPSilverlightListeners and TCPFlashListeners Nodes TCP的Silverlight和Flash的监听节点
Could be removed but are needed when you create Silverlight or Flash games respectively. Both client-side plugins require a server to respond with a “policy file” (unless the website is on the same domain as Photon). 可以移除该配置,单当你需要创建Silverlight 或 Flash 游戏时是需要的,客户端请求服务器响应一个policy文件(除非网站在同一个域内)Timeout Settings 超时设置
Two values in the instance node describe how the server times out unresponsive UDP clients:MinimumTimeoutandMaximumTimeout. 有两个节点来描述服务器超时:MinimumTimeout 和 MaximumTimeout| <Instance1 EnablePerformanceCounters="true" DataSendingDelayMilliseconds="50" AckSendingDelayMilliseconds="50" MinimumTimeout="5000" MaximumTimeout="30000”> |
Send Delay and Ack Delay 发送延迟和Ack延迟
The attributesDataSendingDelayMillisecondsandAckSendingDelayMillisecondsrepresent a tradeoff between performance and minimal response times. This delay directly adds some lag to reduce the bandwidth usage: the wait allows the server to aggregate commands and send them in one package. Thesenddelay is triggered when the server sends anything, theackdelay by incoming reliable data. 属性DataSendingDelayMilliseconds 和 AckSendingDelayMilliseconds 代表了性能与最小响应时间之间的权衡。这延迟减小了带宽流量的使用:这等待允许服务器识别命令并用一个数据包发送他们。当服务器进行发送时将触发这个发送延迟,ack延迟是通过传入可靠的数据。 As you can see above, the default values are 50ms each. We found this to be a good value but it causes a \~50ms roundtrip time, even if client and server run on the same machine. 正如你所看到的,这默认值是50ms。我们发现它是一个很好的设置,在50ms内进行一次往返,即使当客户端和服务器在同一台机器上也是如此。 Depending on your game, you should load test with different values. A delay of 0 is a special case that skips usage of timers, so avoid low delays < 10. 你可以根据你的游戏,加载测试不同的值。0ms是一个特殊值用于跳过延迟,尽量避免延迟小于10ms转载于:https://www.cnblogs.com/liusuqi/archive/2013/05/15/3079697.html
总结
以上是生活随笔为你收集整理的Photon——Setup and Config 设置与配置的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 类实现Java模板方法模式中的HookM
- 下一篇: 名为“ds”的+DataTable+已属