world:GetTimeOfDay() can grow out of sync

Describe the bug:

The world:GetTimeOfDay() result can grow out of sync when in the editor.

How do you cause this bug?

  1. Set the Day Length to 1 minute in the world properties
  2. Install the World Time Bug package
  3. Drag the Bug folder onto the User template
  4. Preview the game normally, wait a few seconds, then stop the preview
  5. On the top right of the editor, click the cog, then select “Preview on a new server”
  6. Preview the game, wait a few seconds
  7. Repeat steps 3 through 5 as many times as necessary to reproduce the problem

Please note: as far as I can tell, this is only happening on the new server. You won’t see it without the “Preview on a new server” checked, however I’m also pretty sure you need to preview normally at least once to see it.

Screenshots / video of bug:

Which platform: PC / Stadia

Your Crayta username: Cereal

Game seen in (including “Hub” or “Editor for XYZ”): Editor

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): Once you get it breaking, it’ll just keep breaking until you nuke the server

Time + date seen: November 7th 2021

Version number (found in Help tab in Settings): 0.d5.9.111485

Hi Cereal, I have tried this around 6 times and cannot get this to reproduce. Can you confirm the rough amount of reproduction attempts you had? This is more that I want to be accurate so enough attempts are made.

@StuartF Looks like I might have missed a step!

I recorded a video of reproducing it - Like you said, just previewing didn’t trigger it, however after changing some code and previewing on the new server, I witnessed the difference again.

World Time Bug - YouTube

I’m still not having it happen, but I will add the bug as it is with the video and maybe someone else may have more luck?

Thanks for the way that you have put together the bug (even if I cannot see it.) it makes it much easier for us to send it to the team. :slight_smile:

@StuartF Little bit of extra info for you to add to your report.

If you turn on “Editor Rendering Setting Override” in the world tab, then preview the game the server GetTimeOfDay will report the correct time, but the local/client times will remain static.

@StuartF Hi, we just published Crayta Cruiselines, and you can see this issue when joining the game on a new server.

See here:

On the right hand side, you can see an event is going to end at 15:00 in game time.

Now we can see that the event has seemingly ended at 14:31 - 29 “minutes” early.

This is because the widget display is local, but the event management is server side.

This was occurring for me, as I was the first one to join the server.

You can also see the dance floor in both of those pictures, which is also de-synced. That floor exists on the server, walking over it on the client causes havoc (teleportation, stuttering).

We fixed the first issue by adding a schedule that sent the server time to every client, and the client set their local startTime to that time.

We fixed the floor desync by adding an artificial 15 second delay on server init before animating.

I will see if we can get an internal copy to look at, thanks for submitting an example.

I’m tried previewing a new server again, and still not reproduced this on the copy I took. Does this also happen on the published version if I was to create a new server? i.e. Play the game when there is no server live with it on.

Sorry, we have a bandaid applied.

If you pulled down Crayta Cruiselines, you’re going to want to disable the schedule timeFixControllerScript (or fixTimeControllerScript, don’t remember the name).

Yes, you could see it when previewing on a new server, though I’m not sure if it happened on the first preview, or if it was restricted to subsequent previews.

Regardless, we first saw it when previewing on a new server in the editor in Crayta Cruiselines. We thought it was an editor issue until we published it and saw it live - hence the bandaid.

I have disabled that script and now I think I am having it happen, I had a pizza cooking event active while being told it was about to start in X minutes.