Custom Operation error message

Options
zoultrex
zoultrex
edited August 2010 in Photon Server
By looking at the error message below, is there something obvious being logged in this error that I should check?
Unity: unexpected operation error OperationNotSupported from operation Shoot in state WorldEntered
UnityEngine.Debug:Log(Object)
MmoEngine:LogError(Game, String) (at Assets\Photon\MmoEngine.cs:192)
Photon.MmoDemo.Client.Game:OnUnexpectedOperationError(OperationCode, ErrorCode, String, Hashtable)
Photon.MmoDemo.Client.GameStateStrategies.WorldEntered:OnOperationReturn(Game, OperationCode, ReturnCode, Hashtable)
Photon.MmoDemo.Client.Game:OperationResult(Byte, Int32, Hashtable, Int16)
ExitGames.Client.Photon.NConnect:deserializeNeutron(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.EnetPeer:Service()
ExitGames.Client.Photon.PhotonPeer:Service()
Photon.MmoDemo.Client.GameStateStrategies.WorldEntered:OnUpdate(Game)
Photon.MmoDemo.Client.Game:Update()
MmoEngine:Update() (at Assets\Photon\MmoEngine.cs:151)

I really believe everything is ok, I just copied everything from the previous version of photon where I have this working, and where btw I call the operation inside the Player class like that:
this.engine.Peer.OpCustom((byte)OperationCode.Shoot, shootOpData, true);

Maybe some things changed in this version, like its not necessary to call PopulateParameters anymore, so maybe there is more that was changed that I should take care of?

Thanks ;)

Comments

  • ktweedy1
    Options
    Did you add your Shoot operation to the switch statement in the OnOperationReturn function?
  • Boris
    Options
    OperationNotSupported is probably the debug return from the server.
    Check the MmoActor if the "case OperationCode.Shoot" is missing.
  • zoultrex
    Options
    Boris wrote:
    Check the MmoActor if the "case OperationCode.Shoot" is missing.

    That was it, it was missing...
    I knew i was forgetting something.

    Thanks guys
  • zoultrex
    Options
    I got the custom Operation working but now Im having a problem with the serialize function, this is the error log from the server log file.
    2010-08-31 08:22:45,088 [9] ERROR Photon.MmoDemo.Server.PhotonApplication - System.IO.InvalidDataException: cannot serialize(): Photon.SocketServer.Mmo.Vector
       at #7d.#8d.Write(IBinaryWriter , Object , Boolean ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteWriter.cs:line 72
       at #7d.#8d.#vd(IBinaryWriter , Hashtable ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteWriter.cs:line 16777215
       at #7d.#8d.Write(IBinaryWriter , Object , Boolean ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteWriter.cs:line 134
       at #7d.#8d.Write(IBinaryWriter , Object ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteWriter.cs:line 35
       at #7d.#he.SerializeEventData(EventData ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Protocols\GpBinaryByte\GpBinaryByteProtocol.cs:line 361
       at Photon.SocketServer.PhotonPeer.SendEvent(EventData eventData) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\PhotonPeer.cs:line 187
       at Photon.SocketServer.Rpc.Peer.#e.#A.#Sd() in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Rpc\Peer.cs:line 185
       at (Object )
       at Photon.SocketServer.Concurrency.ActionQueue.#bd(Action ) in c:\Dev\photon-socketserver-sdk\src\Photon.SocketServer\Concurrency\ActionQueue.cs:line 16777215
    

    It looks to me that its saying it cant serialize a vector, but im not sure where would that be happening, would it be telling me that it cant serialize what I am Sending To the server or what the Server is Returning to the clients?
    Id like to know more about the serialize function and whats its basic functionality. Is it called only when the clients send data or from the server to the clients too?

    Thanks in advance :)
  • dreamora
    Options
    Looks like its the step where the server want to send the event forward.
  • Boris
    Options
    Serialization on the server happens when you send an operation response or an event to the client.
    Events are serialized with "peer.PhotonPeer.Protocol.SerializeEventData", and the operation response with "SerializeOperationResponse" found in the same class. The bytes are then sent with the PhotonPeer.SendBytes method.

    Custom types such Vector cannot be serialized.
    Supported types are:
    boolean
    byte
    short
    integer
    long
    string
    float
    double
    hashtable
    and all of the above as array or list

    There are several conversion methods defined in ExtensionMethods.cs, one adds a ToFloatArray() to the Vector.
    If you got the Vector from an ICoordinate use the ICoordinate.Value property - it contains the original values that were previously submitted from the client.