Manage timer within connected players

Options
I am working on roulette multiplayer game at present.
All functionality of game working fine now but now at this stage of game I have to implement time for game.

For example player has 60 seconds to put their bets otherwise they loose change to put bet and start wheel spinning.
I want some suggestions from other members regarding time management within network.

As per my consideration I have to use photonview to pass continuous timer data over network.
Please give some hints here.

Comments

  • vadim
    Options
    Try PhotonNetwork.time property. This is network-synchronized time.
    From documentation:
    This time reflects milliseconds since start of the server, cut down to 4 bytes. It will overflow every 49 days from a high value to 0.
  • Thanks @vadim, Now I can able to implement timer for my game easily.
  • vadim
    Options
    What you mean by timer?
    You can compare current time with timer end time in Update() for instance.
  • Tobias
    Options
    In PUN, there is a InRoomRoundTimer in UtilityScripts. Take a look and dissect how this works. It should be a basic blueprint for your own timer.
  • Thanks for all you help.
    For this question, I have found solution using your suggestions.
    long betTime = (Convert.ToInt64(PhotonNetwork.time) - GameManager.Instance.BetSpawnTime);
            betTimeText.text = betTime < 10 ? "Time : 0" + betTime : "Time : " + betTime;
    

    For my roulette game, I am resetting my BetSpawnTime variable each time when single turn is complete.

    Basically I have to give each connected players 60 seconds to place their bet.
  • We've been using PhotonNetwork.time (and Photon Cloud) -- but it appears it may not be reliable from one logon to another, perhaps because we are hitting different cloud servers? Is this time not guaranteed to be continuous for PhotonCloud connections?
  • vadim
    Options
    PhotonNetwork.time is not synchronized between servers. You may find it different in different rooms. But within one room (or lobby) it's always same for all clients.