Help, Sync rotation speed for multiplayer (Blueprint)

I’m trying to make a day and night system that will work for an online game, and get the light to rotate on the server and client, but I can’t find a way to sync the rotation speed.
Can someone help me out?

The way I handle these types of events is to send an RPC to clients telling them “when” to start the event. Most of my events of this nature have predetermined durations and speeds. So knowing when in game time or network time to start is all that is needed. It’s the closest I’ve been able to get client and server sequences to sync.

Simply sending an “execute this event now” rpc doesn’t work. Different connection qualities [pings, packet loss, jitter] have a profound effect. You will never get a perfect sync because of these factors. The best you can get is a few ms variance.

To start you need a network clock. UE implements a synchronized network clock… GetServerWorldTimeSeconds(). Yet it isn’t accurate. Well, let’s just say it isn’t accurate enough for my liking and usage.

For a “more accurate” network clock you’ll need to write one yourself. Thankfully there’s an article (w/code) that covers this.

Once you have a network clock implemented you’d simply setup RPC’s to send a future network time for the event to start, then use a timer to execute.

  1. Server: RPC event start time
  2. Server/Client: (Network start time - Current network time) = Timer duration
  3. Server/Client: Set Timer by Event/Function (Timer duration)

edit…
I recommend sending the start times a few seconds before the event is to occur on the server. 3 to 5s is plenty of time to account for drops/fragmentation resends, network saturation etc.

Thank you for the help

1 Like

is there a way to do this in blueprints that link is C++

no, C++ only.