Support to send file between clients?

huangyous
edited June 2010 in DotNet
In my game,player can use their own meshes and textures,when they use these files in the online game,they should send the files to the other players in the same game room.Can I do this in Photon?

Comments

  • Photon supports data transfer up to a certain limit but we decided against support for downloads and concentrate instead on quick, near realtime communication.

    Downloads can be achieved much easier by using http and an integrated web server. One you could intergrate nicely would be (e.g.): Cassini.
    http://en.wikipedia.org/wiki/Cassini_Web_Server

    Http could easily be load balanced, moved around, cached and would not interfere with realtime communication.
  • Thanks for replying!!!

    In my case,our central server's bandwitch is low so it is only used to list the rooms,when the user join a room,he disconnects from server then send his files to the other uses,maybe only to the game hoster,then the hoster send the files to the others.When the transmitting is all done,they will enter the game,so it won't interfere with realtime communication.Can I use the Photon'API to send files before entering the game? The Photon can send array(len<=65535),Can I use it to send files in Byte Array?
  • Boris
    Boris ✭✭
    There is no restriction on the type of byte array content.
    so yes, you can send file content with the byte arrays as long as they don't exceed the maximum length limit.
    If you want to upload byte arrays before entering the game (I assume you use the Lite application?) you will have to add a custom operation (e.g. "UploadFile") and the server logic to dispatch it. See class LitePeer method OnOperationRequest.
  • Thanks for fast reply,I read the document and try the Photon-Unity3D demo,but it's a central Server with multiple Clients demo.I'm wondering does Photon support NAT-punchthrough and let a user become a game room Hoster then let the clients directly communicate with the hoster,not the central Server?Just like the Unity built-in network did.
  • Boris
    Boris ✭✭
    no, photon does not support peer-to-peer.
  • As said: you could create a simple webserver to handle this. Hosting websites is cheap and does not put all load on a random player (who's upload bandwidth might be limited, too).
    Create a page that takes your http uploads and hands out a file id. Then share the id with other players who download the file. The webserver could either communicate with Photon (complex) or throw away files after some timeout (easy, clean).