Findig a reliable Master on Android

Options
Have been using "isMaster" to set various in game variables, but if an Android device is master and it goes to sleep or is bumped into background, then it never releases its Master status, no other player can take over master status, so game stalls. Master is still recorded as active after 30 min or more sleeping.

Any clues on how I can get a reliable (present) Master?
Do I just try to poll the lowest present ID number? an easy way to do this?

Background:
I am setting up a race between a group of players that lasts say 10 min, then the "Master" kicks off another race (with different variables). If the Master has gone to sleep, no new race ever starts.
I have been trying to do a workaround using "Photon Network time" on "lobby" and also "room" and recording times in an external online database and then comparing them whenever a player goes to lobby. During the race all players monitor room time via same mechanism, but I am ending up in a world of hurt as the time in lobby and rooms are all on different servers and are all different. I also have to force all players back to the lobby for each new race and create a new room for each race, which is all yuk!

Best Answer

Answers

  • vadim
    Options
    Do you use latest PUN version? The issue should be fixed already.
    You can find more details in discussion: http://forum.photonengine.com/discussion/6680/idle-android-players#latest
  • kingsley
    Options
    I tested it with the latest Demo off asset store ie 1.62 or 1.63? (see other version post).
    Used ownership transfer demo ... if a slave leaves and returns it is assigned a new ID & colour (perfect). If the master (android) leaves it stays listed on other running copy (my editor) for over 30 min. Will explore link above.
  • kingsley
    Options
    The test was done in new project of Unity, to avoid any of my code hanging around.
  • kingsley
    Options
    and another little bit is needed to come back after going to sleep....
    In the DemoChangeOwner demo ... I added the following to ConnectAndJoinRandom.cs to allow a re-connection and return to game (if that is what you want).

    protected void OnApplicationPause(bool pause)
    { //false when coming out of pause state
    if(!pause)
    {
    ConnectInUpdate = true;
    }
    }