Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Disconnection Theory Xlog vs disconnect

Discussion in 'Multiplayer' started by Resilo, Dec 8, 2017.

  1. Resilo

    Resilo

    Joined:
    Dec 8, 2016
    Posts:
    139
    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

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    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.

    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationQuit.html

    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