🌀
WebSocket用のPhoton Serverセットアップ手順
やった事
オンプレPhoton ServerにWebSocketで接続するための環境構築
環境・バージョン
- Windows10
- Photon Server v5.0.12.24499-rc1
Photon Server環境構築
資材ダウンロード
- 下記Photonページからphoton serverをダウンロードし解凍しておく
https://www.photonengine.com/sdks#server
ライセンスファイルダウンロード
- 同じページの右上に"Sign In"と書かれたとこをクリック、ユーザ登録をする
ApplicationsのSelf-Hostedページにある左の100CCU制限付きライセンスファイルをダウンロードし、ライセンスファイルをphoton serverフォルダ内のdeploy\bin_Win64に配置する
photon configファイルの書き換え
- deploy\bin_Win64\PhotonControl.exeでサーバーコントローラーが立ち上がる、まずはIPを確認する
- Winユーザなら見慣れたタスクバーの上矢印っぽいマークのところにphoton serverがいる、これをクリック
- GameServer IP Configから今PCに設定されているローカルIPが確認できる
- アクセス先IPを変えたい場合、Windowsの設定からIPを振り直してPC再起動しPhotonControl.exeを起動すると自動的に現在のPCのIPを認識してくれる
- IPがGameServer IP ConfigのSet Local IPのもので問題無ければ、このIPを控えておく
- "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config"を開き、22, 40, 43行目を控えたLocal IPに書き換える(43行目は書き換えなくてもよいかも、未検証)
GameServer.xml.config
<GameServer>
<!-- GameServer-to-Master connections. -->
<S2S>
<ConnectRetryInterval>15</ConnectRetryInterval>
<!-- Set to the IP Address of the Photon instance where your Master application is running. -->
<MasterIPAddress>控えたIPに書き換える</MasterIPAddress>
<OutgoingMasterServerPeerPort>4520</OutgoingMasterServerPeerPort>
</S2S>
<Master>
<!-- LB stats - disabled, because vApps use their own app-stats-publishing-mechanism -->
<AppStatsPublishInterval>1000</AppStatsPublishInterval>
<GamingWsPath>Game</GamingWsPath>
<!-- Client-to-Gameserver Secure WebSocket connections. Needs to match the secure WebSocketListener in PhotonServer.config -->
<GamingSecureWebSocketPort>19091</GamingSecureWebSocketPort>
<!-- Client-to-Gameserver TCP connections. Needs to match the TCPListener in PhotonServer.config -->
<GamingTcpPort>4531</GamingTcpPort>
<!-- Client-to-Gameserver UDP connections. Needs to match the UDPListener in PhotonServer.config -->
<GamingUdpPort>5056</GamingUdpPort>
<!-- Client-to-Gameserver WebSocket connections. Needs to match the WebSocketListener in PhotonServer.config -->
<GamingWebSocketPort>9091</GamingWebSocketPort>
<PublicIPAddress>控えたIPに書き換える</PublicIPAddress>
<PublicIPAddressIPv6></PublicIPAddressIPv6>
<!-- the hostname for this gameserver. Required for HTTP & websocket connections. Change it to a useful entry, like hostname.mydomain.com, for a production scenario. -->
<PublicHostName>控えたIPに書き換える</PublicHostName>
</Master>
- 次にこのページを参考に"deploy\bin_Win64\PhotonServer.config"の129, 146, 164行目のUrl="/*"をUrl="/+"に書き換える
Photon Server起動確認
- ここまでの設定が終わったらPhotonControl.exeのStart as applicationをクリックし、アイコンが青色になりphotonが起動できたら成功
おわりに
以上、Photon ServerのWebSocket疎通用での環境セットアップ手順でした。
URL="/+"にするところとかIP書き換えとか普通わからん・・・めっちゃ探し周りました。
あんまりオンプレで構築するケースはないと思いますが、参考になれば幸いです。
Discussion