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+已属