please include unreliable rpc

Options
Hello!

Is there a chance you could consider adding unreliable RPC support built in into PUN?

I'm able to modify the code myself so the event could be sent unreliably, but it makes it harder to update the package.

I would love to see that feature accessible by default!

thanks,
Slav

Comments

  • Kaiserludi
    Options
    Hi Slav.

    Have you already read this discussion about the same topic?
    viewtopic.php?f=17&t=1404
  • gnoblin
    Options
    Yes, I've seen that thread.

    My use case for unreliable events is sending position updates for objects with different "send rate" (as far as I know that's not possible to change the send rate per view for state sync).

    I just need a built-in way to send small data blobs unreliably - I don't really care how it will be called (RPC or not).

    :roll: :)
  • Tobias
    Options
    Could you use OnPhotonSerializeView() and if you don't want to send anything, just don't put anything in the stream (the update gets skipped then).
    In worst case, I could implement unreliable RPCs, of course but the API gets more and more complex due to many options.
  • Leepo
    Options
    Note; we could eeeeasily add unreliable RPC but so far all use cases are better done via OnPhotonSerializeView(). That's why we didn't want to add it as an RPC option, I would be afraid of people using it wrong and then waste days to figure out why some RPCs never arrive.

    If you have a good use case for unreliable RPC, do please convince me!
  • gnoblin
    Options
    Tobias wrote:
    Could you use OnPhotonSerializeView() and if you don't want to send anything, just don't put anything in the stream (the update gets skipped then).
    In worst case, I could implement unreliable RPCs, of course but the API gets more and more complex due to many options.

    Could you please provide an example on how to send data via OnPhotonSerializeView with a variable rate? (1,2,5, whatever times per second)

    What if the PhotonView mode is set to unreliable - is the update still skipped? (if yes - ok)
  • gnoblin
    Options
    What if I'd like to send the data regularly (1 time per second) unreliably, BUT with a different data size each time? Is it possible with OnSerializePhotonView()? If yes, an example would be great.
  • Tobias
    Options
    It's possible.
    You define whatever you put into the stream and how you read it. For each case you have, assign a number. This number is the first thing you write and read. Depending on that, you can go on reading either format of message you defined.
    You can even send object[] as one object in the stream, so if you wanted to, you could implement RPCs with those, too.The first number in the stream would be the count of RPCs this time and per RPC you have one object[] with the parameters.
    You can skip OnSerializePhotonView by not putting any value into the stream, so you can get your variable rate as multiples of the "regular" frequency. Just skip it in one second or two consecutive ones.