Best Practices for a Countdown Game / Match Timer that is syncronized neatly across clients

Options
I've searched all the regular search terms.... Countdown, game time, timer, match time and the like and I have seen a few articles on a couple methods for a 5 4 3 2 1 timer.... I was thinking of more of a game timer that would last 5 min, 10min or 20min. So a game would start and at the end of the match / game the room would reset or reload.

The issue is really finding the best way of doing this... I have read about using the server time but it will wrap over to zero once it overflows. But truely a neat way of doing this would be greatly appriecated.

Thinking that it should be maintained by the masterclient....

perhaps a rpc call once a second across all clients to add the seconds to match the required game time...
5 x 60 for a 5 min game etc...

also thinking some game design logic that would go like... 5 min game that flows into a 30 second restart countdown then back to a 5min countdown... or 10min or whatever is designed that just continually goes 24/7

Comments

  • SkyboardStudios
    edited September 2015
    Options
    with a Little bit of work I managed to create a sweet little system to keep all clients 100% syncronized for as long as needed let it be a 1min , 5 min, 10min etc match with a 30 second interval between matches...

    I managed to create a couple of RPCs that work together...

    1 RPC for getting Masterclients clock tick
    1 RPC for Getting the "Restart" signal of match

    with a Coroutine ticking off every second and sending the current clock tick (countdown of a pre set integer max) on the master client and the clients displaying the result of the masters sent data works amazingly well...

    if you want to check it out access the beta at:
    https://play.google.com/apps/testing/com.skyboardstudios.annex





    I also have a little routine on my main networkmanagersystem that listens for a new masterclient change and then signals the activation of the coroutine to do the heavy lifting of the count system.


    void OnMasterClientSwitched(PhotonPlayer newMasterClient) {
    Manager.networkrpcsystem.ActivateGameTimer();
    }

    I will make things more elegant with more "post game" detail reporting and perhaps even like a interval increase etc.
  • Tobias
    Options
    Thanks for posting your info! Very nice.
    Did you have a look at the InRoomRoundTimer.cs in PUN, too?