Sending moderate sized data disconnects server

Mortoc
edited February 2012 in DotNet
So, here's my situation:
The Model portion of my Unity3d application is all serializable using the system provided in System.Runtime.Serialization. In my app, I run a classroom, and in that classroom are pieces of state that get sent to a student when they first arrive in a class - which seat was selected, student set up info (name, gender, etc), professor position and the largest piece, the history of the lines drawn on the board. That largest part in the worst case (when I scribble on the whiteboard for about 5 minutes to make it a solid color) is about 200kb serialized. I compress this (using LZMA) down to 20kb.

And here's the problem:
On slow users' connections, especially if the MasterClient is on a slow connection, they'll disconnect from the server when a large bit of information is sent. Even this 20kb seems to do it if their connection is slow enough. I'm able to replicate this bug if I set my internet connection to something like 10kbps upload max. Is there a better way to send 20kb worth of bytes than to pack it all in to the argument for a photonView.RPC? I understand the engine will split it up in to 1200 byte packets.

My initial thought to solve this issue is to do some sort of detection of the client's upload speed and stay under that limit per second to try to give the system some room to breathe on larger uploads. This seems like it isn't the most robust solution since their upload speed may change and I can't be continuously testing their max. Anyone with some experience here able to point me in a better direction?

Comments

  • Reduce the amount of data you send or ensure its on a correspondingly high channel number so it gets a lower priority and hence only sent if there is bandwidth left.

    Chances are pretty good that you are simply overloading the master client and if he is doing some relevant job like being the authorative node, that will 'block the whole game'.

    Also you might want to consider using room properties to store this history so its held and distributed through photon instead of being property of the master client.
  • Thanks dreamora. I found another post that talked about sending on a higher channel number, but I can't find anything in the API that allows me to do this - do you know if that concept goes by another term in the Unity Photon API?
  • You choose the channel number when you raise the custom op / raise an event.

    If you use PUN (in which case this would be the wrong board) you have to implement it yourself, it does neither expose channel numbers nor game properties
  • Most likely your amount of data creates a lot of packages which are reliable and thus require additional packages to be ACKd.
    Our demos are built to send the amount of data they create (namely: few). You could most likely improve the situation by finding the place where SendOutgoingCommands is called and change this into "while (SendOutgoingCommands()) {}".
    This allows your client to send any amount of packages to get your locally produced data on the way to the server.