Synchronize Time/Music via Bolt

I actually wanted to use PUN for our VR Rhythm Game Holodance but one thing we need to support is local LAN / WIFI multiplayer and while this works really well with Unity Networking, it doesn't seem to be supported with PUN. Bolt seems to be a decent solution for what we need, so here's a first question (of several ;-) ):

The way our game mechanics work, the most important thing for us is having a reliable synchronized time that we can use to reliably synchronize the music between the different machines.

Does Bolt support that both in local and wide area network scenarios?

Comments

  • Use the serverframe
  • jashan
    jashan ✭✭
    Are you sure the frame would be precise enough? Looking at the serverFrame API docs, I just found float BoltNetwork.serverTime, so that would most likely be what I would be using.

    The main question is how reliable these times are. What I'd probably do is check BoltConnection.PingNetwork for all connections to know the maximum time for messages from the server to arrive at the clients (that would be BoltConnection.PingNetwork * 0.5F), then have the server send an event to all clients to start at time X, which is current serverTime plus maximum message travel time (= half ping time), plus a little safety delay.

    Then, while playing, every once in a while compare the time of the song relative to server time, and if any client has an offset, fix that offset.