How are outgoing messages put together?

Options
Could I set PhotonNetwork.sendRate and PhotonNetwork.sendRateOnSerialize to 0 and handle my outgoing messages just with PhotonNetwork.SendOutgoingCommands(); without breaking Photons internal sending stuff? It would be nice if I could see if Photon wants to send something so I can say that I want to send something with it. Additionally, I want to know if Photon would put these two messages together:
RaiseEventOptions raise = new RaiseEventOptions();
                    raise.InterestGroup = 5;
                    raise.Receivers = ReceiverGroup.All;
                    raise.TargetActors = new int[] { 0, 1, 2};
                    raise.CachingOption = EventCaching.DoNotCache;
                    PhotonNetwork.RaiseEvent(14, new object[0, 5, 10], true, raise);
and
RaiseEventOptions raise2 = new RaiseEventOptions();
                    raise2.InterestGroup = 3;
                    raise2.Receivers = ReceiverGroup.Others;
                    raise2.TargetActors = new int[] { 2, 3};
                    raise2.CachingOption = EventCaching.AddToRoomCacheGlobal;
                    PhotonNetwork.RaiseEvent(0, new object[2, 11], false, raise2);
--

PhotonNetwork.SendOutgoingCommands();

Comments

  • Hi @lennart862,

    Could I set PhotonNetwork.sendRate and PhotonNetwork.sendRateOnSerialize to 0 and handle my outgoing messages just with PhotonNetwork.SendOutgoingCommands(); without breaking Photons internal sending stuff?


    No, you can't, because when setting one of these values, an interval between sending messages is calculated. Therefore a certain value is divided by one of these two (depends on which one you are setting), which would result in a DivideByZeroException.

    Instead of using 0 you can for example use another value like 1. In this case, Photon would just send once per second. This however adds some delay to the game. An example: you want to pick up an item and prepare a certain message for this event. In best case this message is sent directly afterwards, in worst case it takes nearly a second before this message get sent. Since this is a relevant message for the game logic, you can use SendOutgoingCommands to send this message immediately. With this message, all other messages, which are currently buffered in between the send interval, will get sent as well.