Search Unity

Peer to peer asset bundles?

Discussion in 'Multiplayer' started by Frano Sailer, Apr 15, 2009.

  1. Frano Sailer

    Frano Sailer

    Joined:
    Apr 15, 2009
    Posts:
    15
    We are in a situation where we are loading levels/prefabs, and other assets all dynamically from a web server using asset bundles.

    (so, for example, if a player wants to enter a level, he'll grab that level only, and any prefabs that he will be using in that level)

    However, right now, if a different player connects to the first player(the first player started a server), he will ALSO have to grab the level and prefabs from the web server. This means the server is sending that data each time for every different player.


    I was just wondering if there was any way we could have the first player send the level data to the second player as the second player joins. The first player still has the level data stored in www.assetBundle, but I can't find a way to actually send the data to the second player.

    A couple of ideas that we've had:

    1. Use C# sockets to set up a "fake" server, so the second player could make a www request to the first player. This "might" work, but it requires the inclusion of about 900KB of System dlls, and is not really an option for a web player.

    2. Send the raw data in www.bytes to the second player via RPC calls(and in chunks of data). We can send the data this way, but as far as I can tell, there is no way to to reconstruct the WWW object on the second player in order to get to the www.assetBundle that the data represents. One idea would be to save the data to a file, and then call the WWW constructor with (file://<pathtofile>). However, I don't think this will work in the web player, since we are sandboxed, and can't save files locally.

    Any thoughts and/or ideas? Anyone doing anything remotely related to this?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Sending it from the player is not a good idea.
    Common user have <= 1000kbit/s upstreams, compared to 10mbit+/s on the webserver, potentially they even have a metered connection
    As such the loading time will significantly raise if you attempt to send it from player to player and it at worst costs the player additionally to host the game.

    both things will definitely not help you to make friends.