How intercept RPC and save game data in server?

Options
Hi all,

First all, sorry for my english, I am spanish native :disappointed:

We had a game in Photon Cloud but for a specific game logic we need a server side logic. Then we are testing the Photon Server, all work perfectly with the LoadBalancing application, but we have some questions.

Our game is a ball game based, then we need to save some variables like the last team with possesion. When a player get the ball, he send a PunRPC to the remote player.

Then we need that the server intercepts that RPC and it check first if the last team possesion is diferent. If it is different it will let the RPC continue else the server will block the RPC and will send a reponse to the source (local player) with a error code.

We are trying to debug the server, and we have checked the OnOperationRequest method in GameClientPeer.cs, but the PunRPC dont use this method.

Must we change all the RPC to operations? In which script we must save the variables and data for every game? Maybe in Game.cs?

Thanks for your time, kind regards!


Comments

  • chvetsov
    Options
    Easiest way for you will be use of plugins. you may write your own plugin which will do this trick for you.

    Rpc is RaiseEven with special structure. it might be intercepted in plugin. https://doc.photonengine.com/en-us/onpremise/current/plugins/manual
  • PixelCream
    Options
    Thanks chvetsov for you really fast answer.

    Now we use the OnRaiseEvent for to intercept the RPC. But we have a new question_

    How can we know which RPC it is?

    we used the IRaiseEventCallInfo but it show the same code always 253 (RaiseEvent). We search over this structure for hours but we didnt see useful information.

    Any idea?

    Anyway thanks!!
  • chvetsov
    Options
    there is 'EvCode' and 'Data' fields. EvCode may contain application specific code. Data applicatioin specific data. i assume that all data for RPC call are placed to Data field. it is hashtable. so, you need to check its content and filter out what you need
  • PixelCream
    Options
    Thanks!!

    We found it!!

    Really aprecciated, now we can do magic!!
  • PixelCream
    edited October 2016
    Options
    Thanks again, really productive day :D
  • chvetsov
    Options
    thank you

    you are welcome