How to send unreliable calls?

I'm working on a shooter game and part of the process is including tracers and bullet impacts. I'd like to send data about shots fired and their impact locations, but also have the data capable of being dropped.

The only two solutions I've been able to discover is OnPhotonSerializeView, and RaiseEvent.
SerializeView however is a constant stream and would require a lot of additional checks to send and receive the data.
RaiseEvent doesn't seem to be able to use photonviews and would require a lot of additional work to implement.

Is there another option I'm missing?

Comments

  • Hi @Distul,

    if I understand it correctly, RaiseEvent seems to be a good idea for this behaviour. When a client fires a shot, you can raise an event with his character's position as the start point and the previously calculated impact point as the end point. Clients who receive this event can then create the tracers on their own according to the data they received before. It also seems to be enough, that each client will have those tracers only locally, means that you don't have to make a networked objects of them. Please correct me, if I got something wrong.

    You can basically achieve the same behaviour with a RPC sent from the player's PhotonView component.
    As you already mentioned OnPhotonSerializeView is not a good idea for that.
  • ...


    What I read about RaiseEvent suggested that it didn't behave like RPC in the sense that it wasn't aware what script called it nor which object, where-as RPCs do.

    Am I mistaken? Does RaiseEvent run on the same script which calls it but for other players on their copy of the object?
  • Does RaiseEvent run on the same script which calls it but for other players on their copy of the object?


    Depends on. Whenever a client receives a RaiseEvent call, all registered OnEventCall delegates are executed. You can register such a delegate in the same script, but you don't have to. Events are distinguishable from their EventCode the sender specifies. Basically you want to have a centralized object every client has - it doesn't need to be instantiated across the network, an object loaded by the scene with an registered delegate will be enough.