Able to explain this project look Lite LitePeer differ from

Options
lpp168
lpp168
edited July 2012 in Photon Server


As shown above,
The the Lite.LiteGame ExecuteOperation processing the Join, Leave, and other operations.
The the Lite.LitePeer OnOperationRequest handling Join, Leave, and other operations.
LiteGame in processing need OnStart (), the OnComplete () operation.
If I have inherited LiteGame and LitePeer
Issued by the client what kind of request in LiteGame treatment, what kind of requests handled in LitePeer?
I do not understand the code, there are detailed some of the document explains these?
Alas, the existing document feel too deep, do not understand.

Comments

  • Hello,

    I recommend that you check out the concepts of the "Lite" application here:
    http://doc.exitgames.com/photon-server/ ... te%20Lobby

    Short answer to your questions:
    - all operations are handled by the Peer class first, in the same order as they arrived (per client, they are ordered)
    - if the operation affects the Room (LiteGame), or other players in the same Room (e.g.: set properties for a room, or send event to other players), the operation is passed to the Room (LiteGame). To ensure that the order is correct, the operation is enqueued, like this:

    LitePeer.cs:
     protected virtual void HandleGameOperation(OperationRequest operationRequest, SendParameters sendParameters)
    {
     // enqueue operation into game queue. 
     // the operation request will be processed in the games ExecuteOperation method.
     if (this.RoomReference != null)
     {
      this.RoomReference.Room.EnqueueOperation(this, operationRequest, sendParameters);
      return;
    }
    

    The Room (LiteGame) has an own thread that dequeues the operations and handles them in LiteGame.ExecutionOperation(). (Photon is using Retlang message passing principles to handle concurrency - here is a simple explanation: http://www.lanwin.de/2009/10/04/painles ... h-retlang/ - in Photon, each Peer and each Room has a separate fiber. This might help you to understand why we need to pass operations from the peer to the room / litegame.)

    In Operation.OnStart() and Operation.OnStop(), we only measure the execution time, there is no "business logic" in these methods. It's only for performance monitoring reasons, the execution times are shown in the Photon Dashboard.

    I hope that you got a better understanding, let me know if something is still unclear.