Any way to send large data via rpc's without it kicking us offline?

We are trying to implement a level editor in our game, however instead of getting the users to download the maps via the workshop and restarting the game etc, we would like to try and send the level via an rpc.

The only problem is, some of the strings that the level editor produces can become 100,000 characters upwards quite rapidly and when we try to connect a second client to the room, when the rpc tries to get sent then the master client gets removed from the room and we recieve the following error:

"Cannot send messages when not connected. Either connect to Photon OR use offline mode!"

I assume its just a case of the string is way too long to be supported. We have tried numerous ways to try and get it to work including splitting the string up more than just sending it in one whole string, and also trying bytes.

I was wondering if anyone might have a way to get this to work, or if we would just be better using something like sockets or the workshop itself and getting users to download the maps on their own.

We are currently using Pun 1.X, just incase that changes anything.

Thanks

Comments

  • So, the level someone creates gets turned into a string? Do I get this right?

    In general, strings are probably not really effective.
    You might be able to minimize the data by using a binary format for your level.
    Maybe you can apply compression (depends on what you get for the level).

    Sending an RPC is also ineffective, as you have to send it multiple times (whenever someone joins), so it might make more sense to use a custom property or at least a buffered/cached event. Then the server will send the message, when someone joins.

    In general, single messages have an upper limit of size and there is a send-buffer size restriction on the server, too. I will ping a colleague to help with the values.
  • @Zek99 try to keep strings not bigger than 16K in bytes.

    Also, you should keep in mind that if the entire message is bigger then 512Kb it will be discarded.

    best,
    ilya
Sign In or Register to comment.