Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Unity Multiplayer Disconnection Theory Xlog vs disconnect

Discussion in 'Connected Games' started by Resilo, Dec 8, 2017.

  1. Resilo


    Dec 8, 2016
    So the common thing with pvp multiplayer games can be the ability to closing the program with the X commonly referred to as xlogging.

    what are some ways you could theoretically tell the difference between someone using the logoff button or x logging and if your feeling really ambitious the difference between a regular disconnect or pulling your network cable? now i know the last one may be impossible which is why im asking for some theory's on how i could achieve checking for these conditions?
  2. Joe-Censored


    Mar 26, 2013
    Well with a regular log off you can have the client send a message to the server that it is logging off, which wouldn't be sent if either the client process was somehow killed or if the network cable was disconnected. As far as detecting an "X Log", you could try putting something in OnApplicationQuit, but I've never tried it.

    I don't see how you could tell the difference between the player pulling their network cable and some dummy doing the same thing to one of the routers over at Comcast (an example of a "regular" disconnect scenario).

    I suppose you could try to get clever and have the client check for pings to their home router, and if they stop at the same time the client times out then you could assume the player pulled their own cable. You'd need to first verify they are using a private IP address, and even then you'd be trusting the client data when they reconnect to report the type of disconnect. I wouldn't recommend going down this rabbit hole though. For all you know their wifi could just go out every time someone at their house uses the microwave oven. (I had a cheap microwave that would do exactly that)
    Last edited: Dec 9, 2017