Search Unity

IOS Networking

Discussion in 'Multiplayer' started by WolfShield, Oct 21, 2011.

  1. WolfShield

    WolfShield

    Joined:
    Feb 7, 2011
    Posts:
    126
    I have a pretty good understanding of networking in Unity, so how does networking for IOS and Android differ from standard Unity networking?

    Thanks,

    - WolfShield
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    It doesn't, its the same

    but the cpu is so much slower that you should not overdo it :)
    Also don't forget that you can't host games on 2G/3G/LTE likely cause udp communication is forbidden, so game hosting is limited to Wifi
     
  3. pezz

    pezz

    Joined:
    Apr 29, 2011
    Posts:
    606
    So you are saying the same networking tutorial will work on mobiles too?
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
  5. WolfShield

    WolfShield

    Joined:
    Feb 7, 2011
    Posts:
    126
    Awesome!
    So, is there a way to use unity for networking for 2G/3G/LTE connections?

    Thanks,

    - WolfShield
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sure, it just won't be very fast. I think you would need TCP for it.
     
  7. WolfShield

    WolfShield

    Joined:
    Feb 7, 2011
    Posts:
    126
    *Gasp*
    Well, I guess I'll wait on that one! :)

    Thanks for the knowledge,

    - WolfShield
     
  8. madcow64

    madcow64

    Joined:
    Feb 25, 2011
    Posts:
    9
    We'll, you could use of course something like Photon Unity Networking. We had our game set up for Unity Networking but ran into your problem: there is no way for a two phones directly connect (which happens after the MasterServer bits). Mainly due to the operators blocking every incoming connection possible. With Photon you can run a server in the cloud (part of the package) which acts as a proxy and with their Upgrade Wizard it translates your Unity Networking to Photon in breeze. They can do that because it is 1:1 API match :)

    For our game, Beer Pong HD (Android is out for a while, iOS coming soon, look it up :) ), it cost me half a day to port it but since it was all in beta back then I had to setup my own server which was probable the hardest part, but since that is now a cloud thing I think I could have done it under an hours :)

    Cheers,
    Maurice
     
  9. WolfShield

    WolfShield

    Joined:
    Feb 7, 2011
    Posts:
    126
    Cool,
    The Clouds and Breezes'. :) I will have to try that when I get the chance. Thanks!

    - WolfShield
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    2G is definitely not capable of networking

    3G+ is no problem, but you can't host games, you can only join them.

    But be warned that on 3G etc, the latency can vary from 100ms to 10s at worst due to the fact that all devices on the same antenna share the bandwidth and get timesliced. Have a congested antenna and you won't play 'realtime' anymore.

    TCP makes no real difference, on average its actually even worse cause you can't make less important things unrealiable in TCP while you can on UDP (unrealiable view syncronization in unity) which can help seriously when the network quality is dropping due to overload

    Reason is that on TCP, if a single message does not get through it needs to be resent. That on its own isn't bad, but fact is that the messages are ordered, so none of the later sent messages will be processed until this one is reached. That becomes a major problem if you sent through messages at high frequencies like movement / position updates for example which happen often yet are not of 'high importance' as you know that they will be replaced many many times in the near future. For that reason this kind of updates are normally marked as unimportant and unrealiable.
     
    Last edited: Oct 24, 2011