作用:配置Photon2 Server
C:.
│ app.config------------------------------#配置文件-不用怎么改
│ ClientPeer.cs---------------------------#客户端文件
│ hibernate.cfg.xml----------------------#连接数据库配置文件
│ log4net.config---------------------------#日志配置文件
│ MyGameServer.cs-----------------------#
│ MyGameServer.csproj------------------#
│ NHibernateHelper.cs-------------------#连接数据库帮助文件
│ packages.config-------------------------#
├─bin
│ ├─Debug
│ │ MyGameServer.dll
│ │ MyGameServer.pdb
│ │
│ └─Release
├─Handler------------------------------------#处理请求
│ BaseHandler.cs-------------------------#基本
│ DefaultHandler.cs----------------------#
│ LoginHandler.cs------------------------#登录
│ RegisterHandler.cs---------------------#注册
│ SyncPlayerHandler.cs-----------------#同步客户端
│ SyncPositionHandler.cs---------------#同步位置信息
│
├─Manager
│ IUserManager.cs------------------------#User表增删改查接口
│ UserManager.cs-------------------------#User表增删改查
│
├─Mappings
│ User.hbm.xml---------------------------#User表的hibernate配置文件
│
├─Model
│ User.cs----------------------------------#User表的类
│
├─obj
│ └─Debug
│ │ DesignTimeResolveAssemblyReferencesInput.cache
│ │ MyGameServer.csproj.FileListAbsolute.txt
│ │ MyGameServer.csprojResolveAssemblyReference.cache
│ │ MyGameServer.dll------------------#放入Photon的全项目文件
│ │ MyGameServer.pdb
│ │ TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │
│ └─TempPE
├─Properties
│ AssemblyInfo.cs
│
└─Threads--------------------------------------#线程
SyncPositionThread.cs
只能3.5其他不行
3个方法:
1、
服务器管理器—仪表板—添加角色和功能
一直下一步到“确认”的指定备用源路径
可以先不填、不行在加
D:\Sources\SxS
2、
https://dotnet.microsoft.com/download
下载有Framework、下载有visualstudio的
3、
https://msdn.itellyou.cn
工具和资源
https://msdn.itellyou.cn
开发人员工具
下载C#插件
Photon官网:
有server(系统)和plugin(插件)选,选server(系统)
是一个Photon-OnPremise-Server-SDK_v4-0-29-11263.exe文件,是一个压缩包
解压到D:就可以,但不要解压在中文目录
目录:
-|build
-|deploy———————部署核心(有启动文件)
-|doc————————-文档(API)
-|lib
-|src-server—————-源码
deploy文件夹:
-|bin_tools
-|bin_32———————启动Photon2 Server
-|bin_win64—————-启动Photon2 Server
-|CounterPublisher——应用
-|Loadbalancing———-应用负载均衡,管理平衡多个服务器端
-|Plugins
-|Policy
看是32/64位的PhotonControl.exe
官网登录账号
your servers 可以下载一个license授权文件
邮箱名字.Photon-vX.free.100-ccu.license
把这个文件放到bin_win64/32文件夹里,和PhotonControl.exe相同目录
重启PhotonControl.exe
左下角的托盘
可以启动:Loadbalancing和MMO demo
日志:Open logs
|<configuration></configuration>
|—<Loadbalancing></Loadbalancing>——-应用负载均衡,管理平衡多个服务器端
|—<MMODemo></MMODemo>
—|—Displayname=”显示名字”
—|—<UDPListeners></UDPListeners>UDP协议0.0.0.0代表所有ip
—|—<TCPListeners></TCPListeners>TCP协议0.0.0.0代表所有ip
—|—<PolicyFileListeners></PolicyFileListeners>端口
—|—<WebSocketListener></WebSocketListener>端口
—|—<runtime></runtime>内核
—|—<applications></applications>可以有多个应用
—|—|—<application></application>
HTTP、UDP、TCP协议
HTTP:访问网站
UDP:数据传输、下载、聊天(不是很稳定、快)(PhotonServer解决了UDP的不稳定)
TCP:数据传输、下载、聊天(比较稳定、慢)
application:
Name=名字可以自己定义
BaseDirectory=deploy文件夹的文件名,需要把文件上传到此处
Assembly=程序集的名字
Type=指定主程序
ForceAutoRestart=是否自动重启true/false
ExcludeFiles=
共11个位置
C:\Photon-OnPremise-Server-SDK_v4-0-29-11263\deploy\bin_Win64\PhotonServer.config
<!-- Instance settings -->
<MyGameInstance
MaxMessageSize="512000"
MaxQueuedDataPerPeer="512000"
PerPeerMaxReliableDataInTransit="51200"
PerPeerTransmitRateLimitKBSec="256"
PerPeerTransmitRatePeriodMilliseconds="200"
MinimumTimeout="5000"
MaximumTimeout="30000"
DisplayName="Mygame"
>
<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<!-- Port 5055 is Photon's default for UDP connections. -->
<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055"
OverrideApplication="MyGame1">
</UDPListener>
</UDPListeners>
<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<!-- Port 4530 is Photon's default for TCP connecttions. -->
<!-- A Policy application is defined in case that policy requests are sent to this listener (known bug of some some flash clients) -->
<TCPListeners>
<TCPListener
IPAddress="0.0.0.0"
Port="4530"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000"
OverrideApplication="MyGame1"
>
</TCPListener>
</TCPListeners>
<!-- Defines the Photon Runtime Assembly to use. -->
<Runtime
Assembly="PhotonHostRuntime, Culture=neutral"
Type="PhotonHostRuntime.PhotonDomainManager"
UnhandledExceptionPolicy="Ignore">
</Runtime>
<!-- Defines which applications are loaded on start and which of them is used by default. Make sure the default application is defined. -->
<!-- Application-folders must be located in the same folder as the bin_win32 folders. The BaseDirectory must include a "bin" folder. -->
<Applications Default="MyGame1">
<!-- MMO Demo Application -->
<Application
Name="MyGame1"
BaseDirectory="MyGameServer"
Assembly="MyGameServer"
Type="MyGameServer.MyGameServer"
ForceAutoRestart="true"
WatchFiles="dll;config"
ExcludeFiles="log4net.config">
</Application>
</Applications>
</MyGameInstance>
<!-- Instance settings -->
<MyGameInstance #######名字+Instance(随意的)
MaxMessageSize="512000"
MaxQueuedDataPerPeer="512000"
PerPeerMaxReliableDataInTransit="51200"
PerPeerTransmitRateLimitKBSec="256"
PerPeerTransmitRatePeriodMilliseconds="200"
MinimumTimeout="5000"
MaximumTimeout="30000"
DisplayName="Mygame" #######名字(右下角显示的名字)
>
<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<!-- Port 5055 is Photon's default for UDP connections. -->
<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055"
OverrideApplication="MyGame1"> #######名字+数字,与下方application的name一致
</UDPListener>
</UDPListeners>
<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<!-- Port 4530 is Photon's default for TCP connecttions. -->
<!-- A Policy application is defined in case that policy requests are sent to this listener (known bug of some some flash clients) -->
<TCPListeners>
<TCPListener
IPAddress="0.0.0.0"
Port="4530"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000"
OverrideApplication="MyGame1" #######名字+数字,与下方application的name一致
>
</TCPListener>
</TCPListeners>
<!-- Defines the Photon Runtime Assembly to use. -->
<Runtime
Assembly="PhotonHostRuntime, Culture=neutral"
Type="PhotonHostRuntime.PhotonDomainManager"
UnhandledExceptionPolicy="Ignore">
</Runtime>
<!-- Defines which applications are loaded on start and which of them is used by default. Make sure the default application is defined. -->
<!-- Application-folders must be located in the same folder as the bin_win32 folders. The BaseDirectory must include a "bin" folder. -->
<Applications Default="MyGame1">
<!-- MMO Demo Application -->
<Application
Name="MyGame1" #######名字+数字
BaseDirectory="MyGameServer" #######文件夹名字
Assembly="MyGameServer" #######程序集
Type="MyGameServer.MyGameServer" #######主类.启动方法
ForceAutoRestart="true"
WatchFiles="dll;config"
ExcludeFiles="log4net.config">
</Application>
</Applications>
</MyGameInstance>