Search Unity

Best strategy for checking mobile connectivity over time

Discussion in 'Multiplayer' started by Jerhyn777, Jan 21, 2020.

  1. Jerhyn777

    Jerhyn777

    Joined:
    Nov 9, 2017
    Posts:
    7
    Hi, I'm developing a mobile game, and was wondering what the best approach would be for checking if the game is able to connect to our game server (using UnityWebRequest calls for everything). Ideally I'd like to show a modal popup or something once connections can't be made, so I was thinking about just making a test API call every 3-5 seconds or so, and pause the game once one fails to connect. And then if no connection could be made after a few more attempts, throw the message up that the user would need to close and reconnect. Seems like the overhead would be minimal, but I'm wondering if there were many users simultaneously playing, would that create too much network traffic to the server? Would it be better to just test the connection before each API call? What do people normally do to handle intermittent/dropped connections for phone apps? Thanks!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    People often play games while sitting in the passenger seat of a car, and mobile data can drop in and out frequently. You'll piss a lot of players off if a few seconds of connectivity issues results in some popup. Clash of Clans for example just displays this spinning circle when you can't talk to their servers and queues up all your actions, playing like you're still connected. When it reconnects it sends everything.

    As far as checking the connection, you should check the connection in the same manner you are using it. So if you are using web requests for everything you should check connection using a web request.