Search Unity

Ping matchmade host to check if it is live

Discussion in 'Multiplayer' started by RR7, Sep 3, 2017.

  1. RR7

    RR7

    Joined:
    Jan 9, 2017
    Posts:
    254
    this seems obvious so please point me to the relevant documentation if it exists, I wasn't able to find it.

    i am a n00b, I've got the basic lobby and multiplayer working using my own lobby derived from the example. I'm using HLAPI to keep things simple, when joining a match I want to be sure its not 'dead' in that it was started and the host has left it.

    so my plan is, join the match, issue a 'ping' command to the match host, have the host issue a pong, all is well, if no pong is received, leave the match and join another.

    there seems no way to do this. I've tried adding a networkbehaviour script to the lobbymanager, but it then issues an error that you cant do that.

    so I created a singleton ConnectionManager networkbehavior script that has a CmdPing and TargetPong, the idea being I send CmdPing from the client and it runs TargetPong in response. but it keeps erroring saying that CmdPing was run on the server, which was the kind of the point I thought.

    I read various places that you can use GetCurrentRTT and use the returned int value, but I haven't found a way to make that work either.

    i'd really just appreciate some pointers here as to what i'm supposed to be doing and where the relevant documents are. i.e am I going about this entirely the wrong way?

    i'm using 5.6 right now.