sync time between games

anbu369
edited July 2014 in DotNet
Hi I am new to PUN. I have a card game that has a timer running. I need to use PUN to sync both the players so they get same cards and same time running. Can someone point me in the right direction? The timer in the game is set as a Label so I need to sync this label across the games.

Comments

  • You can send an RPC which has the cards as parameter and a start time.
    PhotonNetwork.time is synced by the clients. Make sure you don't use it while the value is 0 but otherwise, all client will show the same time value approximately.
    This allows you to send an RPC: "start round" with parameters/values: starttime=PhotonNetwork.time+1.0f, card1, card2, card2, ...
  • Thanks for the reply. I also need to know if I can have my users login using facebook so that they can invite a particular friend to play with ? I have read the previous forum answers but it says u can create a room with a name that all your friends know and let them join it but I need an application like quizup where the users can challenge friends.
  • Quizup? This sounds like a turnbased game which players might play asynchronously? If it's your turn, you can play, no matter if the other is online?

    Please have a look at Photon Turnbased for such games. PUN is for realtime games only and doesn't keep state when all players leave the room.
    Also, Photon Turnbased makes it easy to integrate push notifications, which are a must have to challenge friends. If the other player is not online, you can use them to challenge players. It can also be used to store challenges on the server and when a player returns to the game, the client can check which games are still going on, which challenges are there and where it's "this user's" turn...
  • Thanks Tobias, I just need the challenging option like quizup but my game is not turn based. It is a card based game where users play with different decks and whoever finishes first wins. I just want to know if this can be done in PUN with the challenging feature or should I use other photon services. Thanks
  • I think you should look into Photon Chat for challenging. It's independent of the rooms, so you can challenge players no matter if they play or not. Also, there is an online state, etc. It can be combined with PUN easily, too.
    Photon Chat for Unity is here:
    https://www.exitgames.com/en/Chat/Download
  • Thanks Tobias... very helpful.. I just wanted to clear if I could combine Photon Chat and PUN and this explains it..:)