Download - Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity
![Page 1: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/1.jpg)
![Page 2: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/2.jpg)
Work
Unity
Private
https://medium.com/@neuecc http://neue.cc/
@neuecc
https://github.com/neuecc/UniRx
![Page 4: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/4.jpg)
Main feature on Game
Chat and Notification
![Page 5: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/5.jpg)
Support C#!
Can be able to write logic in server
Have many cases in Unity
![Page 6: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/6.jpg)
PUN(Photon Unity Network)
We don’t use PUN,
use Client SDK(with Own Framework)
![Page 7: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/7.jpg)
Getting Started
Photon Server
![Page 8: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/8.jpg)
It is class library
Execution flow
![Page 9: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/9.jpg)
public class Startup : ApplicationBase{
// create connection when connected on serverprotected override PeerBase CreatePeer(InitRequest initRequest){
if (/* from client request */){
return new MyClientPeer(initRequest);}else // from server request{
return new InboundS2SPeer(initRequest);}
}
protected override void Setup(){
// Launching process// Connect to master servervar outboundPeer = new OutboundS2SPeer();outboundPeer.ConnectTcp();
}
protected override void TearDown(){
// Quitting process}
}
public class MyClientPeer : ClientPeer{
public MyClientPeer(InitRequest initRequest): base(initRequest)
{
}
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters{
// byte: operationRequest.OperationCode// Dictionary<byte, object>: operationRequest.Parameters
// Send response to clientthis.SendOperationResponse(new OperationResponse(), sendParameters);
}
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail){}
}
![Page 10: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/10.jpg)
// 1. from Unity to Servervar peer = new ClientSidePeer(new MyListener());peer.OpCustom(opCode: 10, parameter: new Dictionary<byte, object>());
// 2. Receive on Serverprotected override void OnOperationRequest(OperationRequest operationRequest){
// switch by opCodeswitch (operationRequest.OperationCode){
case 10:// Parameter from dictionary(<byte, object>)var parameter = operationRequest.Parameters;
/* process request */
// 3. Send result to clientthis.SendOperationResponse(new OperationResponse(operationCode: 5));break;
default:break;
}}
![Page 11: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/11.jpg)
// Unity Clientpublic class MyListener : IPhotonPeerListener{
// 4. Received from Serverpublic void OnOperationResponse(OperationResponse operationResponse){
// Return responseswitch (operationResponse.OperationCode){
case 5:// process responsebreak;
}}
}
// 3. Server: Send result to clientthis.SendOperationResponse(new OperationResponse(operationCode: 5), sendParameters);
![Page 12: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/12.jpg)
// switch by opCodeswitch (operationRequest.OperationCode){
case 0:break;
case 1:break;
case 2:break;
case 3:break;
case 4:break;
case 5:break;
case 6:break;
case 7:break;
case 8:break;
case 9:break
case 10:break;
![Page 13: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/13.jpg)
// switch by opCodeswitch (operationRequest.OperationCode){
case 0:break;
case 1:break;
case 2:break;
case 3:break;
case 4:break;
case 5:break;
![Page 14: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/14.jpg)
// switch by opCodeswitch (operationRequest.OperationCode){
case 0:break;
case 1:break;
case 2:break;
case 3:break;
case 4:
![Page 15: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/15.jpg)
![Page 16: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/16.jpg)
Intro to PhotonWire
![Page 17: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/17.jpg)
send byte, Dictionary and switch and switch
Can not track send-receive message
![Page 18: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/18.jpg)
![Page 19: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/19.jpg)
![Page 20: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/20.jpg)
Typed Asynchronous RPC Layerhttps://github.com/neuecc/PhotonWire
![Page 21: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/21.jpg)
Windows Client
![Page 22: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/22.jpg)
Server to Server
![Page 23: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/23.jpg)
![Page 24: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/24.jpg)
![Page 25: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/25.jpg)
![Page 26: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/26.jpg)
![Page 27: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/27.jpg)
![Page 28: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/28.jpg)
![Page 29: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/29.jpg)
Next PhotonWire
![Page 30: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/30.jpg)
DESERIALIZE SPEED
Replacing serializer
![Page 31: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/31.jpg)
(De)serialize is slow in Unity
ScriptableObject > JsonUtility > *** > MsgPack > XxxJSON
![Page 32: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/32.jpg)
New WireFormat which does not Deserialize
Fit to C# and Unity
Will be available soon
![Page 33: Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer Framework for Unity](https://reader033.vdocument.in/reader033/viewer/2022052117/587ed09e1a28abdb198b4f33/html5/thumbnails/33.jpg)