Search Unity

What is the recommended way of sending a lot of data (like a whole level) once over the network?

Discussion in 'Multiplayer' started by Aquira246, May 25, 2015.

  1. Aquira246

    Aquira246

    Joined:
    May 14, 2015
    Posts:
    5
    Hey,
    I'm new to unity and want to be able to have players create custom levels and then play them with friends. I have the level loading and creating down, and I make the levels as XML files. Are there recommended practices for sending large amounts of data like that? (The levels are small 2-D levels).

    Thank you!
     
  2. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    What kind of size are you thinking of?
     
  3. Aquira246

    Aquira246

    Joined:
    May 14, 2015
    Posts:
    5
    At most 15 kb as an xml file. As a loaded level, it will be something like 100 prefabs (just an image and a collider more than an empty game object)
     
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Does your game already have some networking?

    Also I would not describe 15KB as large.
     
  5. Aquira246

    Aquira246

    Joined:
    May 14, 2015
    Posts:
    5
    Yeah, I have been doing networking stuff based off tutorials.
    15KB isn't large, that is my mistake (didn't check to see how big the files were till jpthek9 asked)
     
  6. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    :)

    So does that mean that you already have networking in your game?

    If so, I'd suggest just utilising the same framework you're already using.
     
  7. Aquira246

    Aquira246

    Joined:
    May 14, 2015
    Posts:
    5
    Is there a way to send a file that way? I've just been sending simple things via RPC
     
  8. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    It's XML yeah? Send it as a string using RPC?