当前位置:必发365电子游戏 > 编程 >           运行和结束Photon,编制程序模型连接的相互都是见仁见智的(TCPClient在旁边



What's in Photon 3 Photon3是什么

1. High Performance S2S API (Native/C++卡塔尔国 高品质的S2S API

     A while back we introduced the TCPClient a managed class better suited for server to server communication than the standard client library. The TCPClient had two disadvantages: First the programming model on both ends of the connection was different (TCPClient on one side, peer on the other), second it was designed for low-bandwidth communication. With this release Photon can setup a connection to other Photon instances leveraging the networking power of the Photon Core while allowing to use the same programming model using peers on both ends of the connection.

     前几天大家介绍了托管类TCPClient比规范顾客端类库更适合于服务器到服务器的通讯。那个TCPClient有八个毛病:第意气风发,编程模型连接的多头都以例外的(TCPClient在边上,peer在另风华正茂侧卡塔尔国,第二,是专为低带宽通讯。那几个本子的Photon可以设置叁个连接其余Photon实例,利用Photon Core,同一时间同意peer在接连的两端使用相仿的编程模型。


2. Load Balancing 负载均衡


     With Photon Load Balancing, developers are enabled to create scalable multi-node solutions. It includes out of the box a master server hosting the lobby and game servers to host the active games. The Lite Lobby Application is delivered with a set of matchmaking methods and a load balancing component that distributes the load (where to create new games).

     Photon负载均衡,开采职员能够创造可扩展的多节点的缓和方案。它归纳了一个主服务来托管大厅和多少个游戏服务来托管游戏。那么些Lite Lobby应用程序是由此设置配成对方法和平运动用负载均衡组件分配负载来实行付出工作的。


3. Event Caching 事件缓存

     So far, Lite had “Properties” for rooms and actors to store values for players who join later on. They are a nice idea but a bit clumsy to use: Whenever something has to be stored, you had to set properties. In all other cases, you send events.The new Lite Application combines both and gives you caching for events. Per player and event, you could cache the values in it. If anyone joins, the events are sent immediately, like they were just raised.



4. Extended Data Type Support 援助数据类型的恢宏

     Photon now supports more data-types than ever: Null values, dictionaries, arrays of objects (each with its own type) and even custom classes can be integrated and used in events.



5. The Peer has new properties Peer的新属性

     NetworkProtocol, LocalIP, LocalPort.


6. Up to now you configured a global default application 为你布署贰个大局的暗许应用程序

     Now it is also possible to define a default application per listener.


Photon Control  Photon控制器


     Photon Control is your one-stop, control UI for Photon. Starting PhotonControl.exe doesn’t open a window, doesn’t start the server but adds an icon to the tray bar.A gray icon shows that Photon is not running. When any Photon Server is process running, the icon turns blue.

     Photon Control是一个照准Photon的一整套的可视化的调控软件,展开PhotonControl.exe不会师世windows窗口,不会运行服务,但会追加二个系统绒毛木莓,高粱红的Logo表示Photon不在运维,而浅紫蓝的Logo表示Photon正在运行。


Changed 改变

1. Lite and Lite Lobby Code-Cleanup Lite和Lite Lobby代码清理

     Event-, Operation- and Parameter-Codes are cleaned up. Everything was reassigned and the predefined codes should be out of your way now. There is an extra page which lists each old and new value.

     事件、操作和参数编码被清理干净。 未来是一切重新分配和预约义的代码应该现身了。有三个相当的页面,在那之中列出了各类旧的和新的值。     


2. Type of Codes 代码的类型

     We decided to keep using bytes as type for codes. It’s just effective and lean. If needed, any operation or event could get sub-codes (not supported out of the box).The ReturnCode for operation responses was of type int. This is now short-typed. Not extremely lean. But short.



3. Protocol Cleanup 公约清理 

     We cleaned up the protocol for Photon 3. This is next to invisible for you, but has some benefits. Most of all, the new protocol does no longer hard-code any codes. Any code for operations, results, parameters or events can be defined by your code.

     大家为Photon3清理了交涉。那对于你的话大致是看不见的,但有点实惠。最重大的是用新的争辨来做,不再要求硬编码任何代码。任何代码的操作、结果、 参数或事件能够依照你的代码来定义。


4. Error Handling 错误处理

     The error handling was re-designed to


     Note: due to a bug in 2.6 sometimes exceptions where “transformed” into ThreadAbortException or the application was unloaded without being loaded again (this is also fixed with 2.6.28).

     注意:由于四个不当(在2.6)有时有例外,“transformed”到 ThreadAbortException 或应用程序被卸载不会再也被加载(那也是牢固与2.6.28卡塔尔(英语:State of Qatar)。

5. Server SDK Changes (breaking) 服务器SDK改变(破坏)

6. Client SDK Changes (breaking) 客户端SDK改变(破坏)

  1. PhotonHostRuntime version attribute was removed from the config file and is no longer required - we recommend to remove it to ease feature updates.
  2. The application NetSyncObjects is no longer part of the SDK.
  3. Changed default for dump files from mini to full
  4. Added version display to log file during start up.
  1. PhotonHostRuntime version属性已从构造文件中移除,和不再是少不了的,大家建议删除它以便于功效更新。
  2. 应用程序NetSyncObjects不再是SDK的豆蔻梢头部分。
  3. 变动转储文件的暗中认可选项从Mini到全体。
  4. 增进版本显获得日志文件在起步的时候。

     Content 内容

Bug Fixes Bug修复

  1. Fixed a memory leak when canceling actions scheduled on a fiber.
  2. S2S.TCPClient did not close the socket at disconnect which caused an error when calling Connect again.
  3. Flash policy file is claimed malformed with a top-level XML tag that is not, see
  4. Fixed CLR startup to ensure GC Server is used (issue affected .net 4.0 only).
  5. Fixed ENet fragmented buffering flow control bug.
  6. Fixed TCP magic byte issues - fragmented pings where not parsed correctly and an issue in the internal handling of the size of packets could lead to parsing errors (bigger packets and high load).
  7. Fixed Photon hang on shutdown trying to log on a dead logging instance.
  8. Fixed the method Peer GetRemoteAddress - due to a caching issue the result was wrong in some cases.
  9. Fixed mini dumps - now obey configured limits.
  10. Changed PhotonPeer::GetRemotePort so that it doesn’t rely on a cached port.
  1. 改进了当废除线程池的运动时内部存款和储蓄器的败露。
  2. S2S。 在断开的时候TCPClient未有小憩套接字,然后再一次连接产生的三个荒唐。
  3. Flash计谋文件被声称为不许绳的参天阶段的XML标识,其实它不是,见到 #狼狈的大旨文件
  4. 修改了CLWrangler运营时以管教GC服务器是可用的。
  5. 改良了eNet分散缓冲流动调查整的不当。
  6. 校正了TCP法力字节难题——不科学的剖判ping 和一个里面管理的主题素材,数据包的深浅或许以致分析错误(越来越大的数据包和高负荷卡塔尔(英语:State of Qatar)。
  7. 改正了Photon在关机时试图在二个闭馆的日记实例进行记录。
  8. 匡正了点子peer GetRemoteAddress ——由于缓慰劳题,在有些意况下结果错了。
  9. 校订Mini转储——以后遵守安顿的限制。
  10. 改进了 PhotonPeer::GetRemotePort ,由此,它不依据于叁个缓存的端口。

     Overview 概述

图片 1.jpg)

     Click the icon to open the menu. It allows you to:



          初始化,启动,停止 Photon服务







     Admin rights are required when you start Photon Control. This allows us to make an entry in the Windows Firewall and most importantly you can now add or remove services for Photon.On start, Photon Control reads your license to let you verify how long it is valid and checks if you use the latest version of Photon, shown in the “Photon Control” menu.The “Autostart Photon Control” option starts Photon Control when you login to Windows. This can be handy when you access a remote machine and can use “Explore Working Path” to spot Photon’s files.If the icon is not visible, click the tiny triangle and drag and drop the Photon Control icon from the popup back to the tray.

     必要管理员权限技巧运转Photon Control,配置防火墙使Photon服务可用。当Photon Control运转时会读取许可证来设置Photon的本子,展现在Photon Control的菜单上,设置“Autostart Photon Control” 选项能够在报到体系时自动运转Photon Control。那是极度便于的去远程访谈二个机械,况兼能够经过 “Explore Working Path”找到Photon的文本,假如Logo不可知,点击小三角拖放该Logo到大麦泡上。


图片 2.jpg)

     Running Photon 运行Photon

     By default, two separate Photon configurations (also called “Instances”) are available. Each starts a combination of server applications and used ports. The “Default” instance is running Lite, LiteLobby, MMO and the Policy Application. Starting instance “LoadBalancing (MyCloud)” will run a Master Server and two Game Servers, which is a minimum Photon Cloud compatible setup.

     私下认可景况下,有二种独立的Photon配置是可用的,各类能够运维一个服务器应用程序和选用所需的端口,Default实例运转的是Lite、 LiteLobby、MMO 和 Policy Application。LoadBalancing (MyCloud) 实例运维的是多个主服务器和七个游戏服务器,那是一个细微的 Photon Cloud 兼容设置。


     On a public server, Photon should run as service. This requires three steps in Photon Control:






图片 3.jpg)


     The PerfMon Counters are not exactly a requirement to run but they can’t be enabled while Photon is running, so it makes sense to set them up first.Running Photon as application is an alternative for local development. When you log off, Photon will be shut down.

     PerfMon Counters不是劳务运维的必需标准,可是当Photon正在运维的时候她们不可能被启用,所以要风流倜傥开头就设置它,运转Photon为应用程序是地面开荒的意气风发种选用,当你注销时,Photon就能够被关门。

     Moving Photon 移动Photon

     Before you move Photon from one folder to another, you should make sure to remove all services and also Photon Control autostart. Install again at the new location.

     在您活动Photon从一个文件夹到另贰个事情发生之前,你须要鲜明移除全部的服务,何况Photon Control是自动运维的,然后在新的地点再一次最早化。

     Changing the “LoadBalancing IP Config” Path 更改“LoadBalancing IP Config” 的路径

     While Photon Control can’t be modified extensively, some important settings can be found in PhotonControl.exe.config. The “GameServerConfigPaths” setting is the one you might need when your project is based off LoadBalancing but renamed.The GameServerConfigPaths is a list of ‘;’-separated paths, relative to the folder of PhotonControl.exe.

     Photon Control不能被遍布的更正,一些注重的安装能够在PhotonControl.exe.config里找到。当您的门类是依附LoadBalancing,但不是重命名的,“GameServerConfigPaths” 设置项或许是您必要的,GameServerConfig帕特hs 是一个以 ‘;’间距的地址路线列表,路线绝对于PhotonControl.exe所在的文件夹。 


     Logs 日志


     Photon is logging essential information (state, exceptions, etc.) to several log files. Click on “Open Logs” to show all logs that Photon used in the past 12 hours. You can open more files as needed, of course.

     Photon会记录一些必须的新闻到服务器的日记文件中。点击 “Open Logs” 能够看见有着过去12钟头内的日记,当然,要求的话你能够张开更多的文件。


     There are two “log” folders:



          全部应用程序的日记是在deploy/log folder。任何的事体逻辑的记录都会填充到那几个文件夹下的多个文本中。

          运行和结束Photon,编制程序模型连接的相互都是见仁见智的(TCPClient在旁边。          服务器的骨干日志文件夹在您运维的二进制目录之下的log文件夹内,当中包蕴了装有有关的实例和CLRAV4


          We use Log4Net in the logic layer. It can be configured extensively and proved very useful. Learn more about Log4Net here .


     Counters 计数器

     Photon keeps track of several essential values as support for performance- and error-analysis. These are published in two separate sets of Counters: “PerfMon Counters” and “Dashboard Counters”.

     Photon持续追踪一些大旨的值用作品质和不当剖判。以下是七个已发布的独门的流速計:“PerfMon Counters” 和 “Dashboard Counters”。

     PerfMon Counters 质量监视器

     The PerfMon Counters are key values from the Photon Core. They track values like connected peers, package count, reliable UDP usage, bandwidth and much more. These Counters cannot be changed by the developer and are accessed by PerfMon. PerfMon is a GUI to create those performance graphs and is already installed with Windows.If PerfMon Counters should be logged over a longer time (and without running the GUI), Photon Control can setup and start logging to a file. Under “PerfMon Counters”, click “Create Logging Set” and “Start Logging”. The logs should end up under C:PerfLogsAdminphoton_perf_log_<date>.blg

     PerfMon Counters的值来自Photon Core。他们追踪一些值,举个例子连接顾客,包计数,可相信UDP的行使,带宽流量。这一个流量计无法透过开采和做客PerfMon而被退换。PerfMon 是八个已经安装在windows上的图形化的工具用来创建一些性情图形。假如在叁个较长的时光范围内PerfMon流速计被记录,Photon Control恐怕会设置和记录消息到文件里。 在“PerfMon Counters”里可以点击“Create Logging Set” 和“Start Logging”实行安顿。日志放置在C:PerfLogsAdminphoton_perf_log_<date>.blg。

     Dashboard Counters 仪表板流速計

     The Dashboard Counters track values within the business logic and can be extended as needed.



     Dashboard 仪表板


     The Dashboard aggregates counter values and generates graphs for a website to monitor them.The Dashboard itself can be installed as service while Photon is already running. Which Counter Data an application publishes (if at all), depends on the application’s setup. Lite has several pre-defined Counters ready to use.


     Troubleshooting 故障确诊

     If Photon does not behave as expected, always have a look at the logs.



     These are the most common pitfalls you should check as well.







     Dump File Setup 转储文件设置

     If a server crashes and the reason for it is not found in the logs, Photon can be configured to create dump files. These reflect the state and memory of the crash and are invaluable to debug these cases.To enable the feature, you need to edit your PhotonServer.config. Set the instance-attribute “ProduceDumps” to true and restart the server.



     It might look like this example:



EnablePerformanceCounters = "true"


     This will write up to 10 “full” dump files. Once a dump file is written, you can zip it with the logs and mail it to us with a description of the issue. In most cases, we will get in touch with you to get more information and solve the case.