Is there a way to set up client send delay for packets ?

Options
Hello,

I know that my question looks trivial but I did not find a way to set packet send delay ?
Moreover, how do you decide if a packet should be send immediatly or should be added in the queue with other packets ?

Thank you very much.

Comments

  • Tobias
    Options
    Everything in the client is put in a queue first. Incoming as well as outgoing.
    Operation requests (outgoing), responses and events are all put into "commands" and queued in that form.

    In the plain Photon API, you would call SendOutgoingCommands() to create a udp package (let's say you use udp) and as much is crammed in as possible.
    In Photon Unity Networking things are handled for you by two PhotonNetwork properties:
    sendRate and sendRateOnSerialize
    They set internal values which define the frequency of sending.

    Have a look at PhotonHandler. In its Update method, DispatchOutgoingCommands and SendOutgoingCommands are used.

    The plain Photon API lets you fine-control everything directly, while the PUN framework tries to do stuff like Unity.
  • Thanks for this answer !
  • Lets say I would like to send 20 packet/s => 1 packet every 50ms.
    What are the correct sendRate and sendRateOnSerialize values ?
    50 for both ?
  • dreamora
    Options
    it would be 20 but that does not guarantee 20 packets per second, only that the sending happens 20 times a second but its none the less possible that its more than 1 packet per send.
  • Tobias
    Options
    Dreamora is right about the send rate setting.
    Currently, a setting of "20 packages / sec" means, that there are a max of 20 packages per second.
  • dreamora
    Options
    so it would just not send out 'on tick' if you try to send large packets then instead of sending more than one packet per 'send cycle'?

    Or is package just a 'sending phase' where the whole send queue is processed
  • Tobias wrote:
    In Photon Unity Networking things are handled for you by two PhotonNetwork properties

    I did not find any PhotonNetwork properties.
    When I do PhotonNetwork.sendRate it does not find PhotonNetwork :(

    Edit : This is client side
  • dreamora
    Options
    does it find PhotonNetwork at all?
  • No it did not find any PhotonNetwork
  • dreamora
    Options
    then you either didn't import the package correctly, try a reimport or you try to use it from js / boo which is in plugins where you can not access it.

    unless you talk only about the generated solution or monodevelop, then its just a blurp that especially unity 3.4.2f3 creates with totally messing the solution
  • I tried to reimport and it did not change anything.

    My scripts are all made in C# and I am using Visual Studio 2010.
    I am going to use SendOutgoingCommands. There are no problems for me to use it.
  • Tobias
    Options
    Are you even using the "Photon Unity Networking" package in Unity?
    We think so, cause this forum relates to that but it seems more like you are using the DotNet or Unity client SDKs directly.

    In the "plain" API, there is no send-interval defined. You do this in your game's main loop and have full control over it.
    Each time you call SendOutgoingCommands(), this will create one UDP package (if you use UDP, that is) and puts in as much data as fits in. Any rest will stay on your client until SendOutgoingCommands is called again. The return value of this method lets you know if something was not sent.