1. This forum is archived for reference. For support & bug reports visit the help section of forums.stardewvalley.net

Bug/Issue Time desync

Discussion in 'Support' started by ShinyAipom, May 4, 2018.

  1. ShinyAipom

    ShinyAipom Void-Bound Voyager

    So I have a 3 player game going with some friends in the multiplayer beta, and we suddenly had a giant time desync, where each one of us saw the others walking in strange areas instead of doing the activities they actually were doing, as well as being unable to do regular activities such as sleep. I, the host, was at 12:20 am, another person was at 11:00, and the third at 5:00.

    Edit: We believe this happened due to one of us entering the sewer cutscene with the children. We ended up fixing it by pausing the game. When this happened, time went on for everyone else until they caught up to my time.
     
    • hobbittrash

      hobbittrash Space Hobo

      I had this same issue, but it kept happening so we looked for another fix. I set up a LAN network by using Hamachi and had people connect thru LAN. All players need to use Hamachi and have it open so they can connect with the IP and join the LAN way. So far we haven’t had many desync issues since doing so. Other than that, you can probably try restarting the server once an hour maybe to give it a refresh and get everyone back on the same time.
       
      • AsRaccoon

        AsRaccoon Intergalactic Tourist

        The first thing I thought after the desyncs started happening was to try Hamachi, since i've had similar problems with other games, such as Terraria. But everytime we try to connect via LAN (IP) the upload speeds go insane and then the host's internet simply dies for a while. This doesn't seem to happen in any other games...
         
        • KieferSkunk

          KieferSkunk Poptop Tamer

          (Disclosure: I am not part of the Stardew Valley team or Chucklefish. I'm just a player like most everyone else here. :) But I am a software developer and have some familiarity with these kinds of issues.)

          Chucklefish/ConcernedApe: The time desync issue appears to be a case where the host and clients are keeping time independently from one another. If a client has a slow machine, a long load time or some other event that interrupts time progression for them, their game ends up being behind the host's time but then continues to count at a normal rate. This sort of "clock skew" problem seems to be causing a lot of strange issues - I saw one person in the main thread report that they had to wait a full in-game hour between clicking on a chest and the chest actually opening, because their client was an hour behind the host.

          I would really recommend that you rework the time system in this game so that the host sends out periodic "heartbeats" to the clients that include the current in-game time, and that clients then automatically update their clock time to that of the server when they receive that heartbeat. You shouldn't need to send out that packet more than once every few seconds (perhaps even only when the server time updates), but this sort of time-syncing message should be critical to keeping everyone in sync. In short, the host should be the authority on what time it is in-game, even if it means a client's time has to jump forward unexpectedly to correct for lag.

          Along with that, I would really like to recommend that you keep the clock visible in cutscenes and minigames (except, of course, for events like festivals where time isn't counting). Since time doesn't stop when you go into cutscenes or play Prairie King, it's important for players to be able to see the time so they know if they have to cut it short to avoid passing out. This would become even more important when you fix the time-sync issue.

          I'm happy to help with suggestions and additional testing of any potential fixes on this - I am an experienced dev and tester. :)
           
          • vunk

            vunk Void-Bound Voyager

            So many people with this issues, so many reports in the main thread and in others threads, and ZERO word about them acknowledging this... It's frustrating.
             
            • Cell Materia

              Cell Materia Cosmic Narwhal

              nice post by the experienced game dev! apparently the time desync makes multiplayer near unplayable at times because.....loading screens...loading screens everywhere
               
                KieferSkunk likes this.
              • Belualoop

                Belualoop Poptop Tamer

                that's not true, if you look at the main bug thread at top you'll see they have listed this, but still need more details.
                 
                  SlartiBart likes this.
                • BGD_Ranne

                  BGD_Ranne Intergalactic Tourist

                  I didn't know there was a thread just for the desync bug. I'm just posting what I said in the main bug thread to have it all in one place and more info at the end.

                  This is for (Need More Details) Player clocks become desynced
                  What happens is when I and two other friends jump onto Stardew together, we all have the same time at the start of the day. We line up and test to see if there is a delay by moving at the same time and constantly calling out for time checks. It seems that when someone starts chopping down a tree/farming/hoeing/etc that one players time with slow down very considerably. It can happen as normal in-game time at 9.30 when the desynced play has 7.30 on their screen. When they are desynced a lot of weird stuff happens. When we do the /pause command in chat the people who are up to date get paused. The person desynced can do what they want until their time matches up with the other players. But the weird thing is, the paused players can hear him farming/fishing/etc.

                  Also the desynced player will slow down in game from the other peoples perspective. It takes a lot of time for the farm to update what the desynced player has down. So you get trees falling down (whether or not the tree was cut down by another player), items falling where the player was (this does item duplication because the desynced player still gets stuff) and the player model desyncing from the actions they were doing on the farm (so random tree falling down/grass being cut while the player model is slowly moving elsewhere on the map.

                  This doesn't allow us to sleep at the end of the day so we can't save. Even if we /pause and sync up times and are all in bed. It will rarely go to the next day or say (3/3) in bed and not go to the next day. If the desync player goes to bed before the others it will be (1/3) in bed and won't update if others go to bed.

                  The only 'fix' we have found is only having 2 people on the server or rushing straight to bed as soon as time goes out of sync. When only two people are on, there is no desync. We each tried hosting a farm with 3 people on. Each time, 1 person was always desynced (not always the same person). I made a small table showing it. The numbers are each player. G stands for Good Connection and D stands for Desync. Hosting Player
                  1 2 3
                  1 G G G
                  2 G G D
                  3 D D G



                  In every scenario there will be no desync when only two people are on and two people will always be in time when one person is desynced.

                  This bug (network lag?) does the following
                  Not allow 3 people on the server to play normally at once
                  Can't sleep unless times are synced (even then sometimes doesn't work)
                  Item duplication (doesn't matter because can't save)
                  If doing /pause, waiting for the desync players time to 'catch up' take ages (waiting 10min+)
                  So for the moment, we are only having 2 people on the server at one time. All of us want to play together. If you need other details, message me somehow.

                  BGD_Ranne

                  New stuff from playing.

                  If host is downloading or is lagging in voice chat in discord, there will be massive desync to the players connected. Can't really work around that apart from resetting the modem.
                   
                  • Maxjanus

                    Maxjanus Space Hobo

                    I also want to share my experiences with the desync error:

                    For us it occurs in a two player game, not three. Therefore if we go to bed early we can 'wait the desync out' and end the day. We are sleeping in the same room.

                    Both players then start the new day at the same time again. If we stay in the house together and do things there (watching tv, cooking etc.) no desync occurs. The moment we go out and start to do things on the farm we get massive desyncs. I suppose that some actions slow down time slightly for one player. We can see that clearly when the player in the 'future' goes to bed and waits there for the other players clock to reach the time stamp he went into bed, therefore the 'me' in the partners game being in bed for as well for him. Only then the day can be ended by sleeping. If the other player waits in front of the bed time passes at a normal rate for her. If she goes into bed as well her clock runs much slower.

                    For now my partner seems to be synchronised in my game, but from her perspective she sees me do things a few minutes in the past. We also had it the other way around though (same host).

                    BTW. i am on windows and the other player on mac, can othe rpeople rule that out as an potential issue?
                     
                    • Maxjanus

                      Maxjanus Space Hobo

                      Like said before farming actions (watering plants in our case) led to a desync. Weirdly enough lately my partner cant even join from having a 30 ingame minute desync. Then on other days we dont have one at all. Background programms dont seem to have any influence on this.
                       
                      • vunk

                        vunk Void-Bound Voyager

                        That was true, they hadn't acknowledged yet at that time, they finally did after. And if you look at that and this thread, there's so much detail about this issue..
                         
                        • Zaflis

                          Zaflis Pangalactic Porcupine

                          This bug is difficult to reproduce for them i assume. I haven't seen it so far, and i have 2 games ongoing with different people. All from other countries than i am, therefore lag should potentially be just as unpredictable.

                          Only time i can really reproduce time difference is when i use SMAPI and cheat mod's freeze time mode.
                           
                          • O-Castitatis-Lilium

                            O-Castitatis-Lilium Void-Bound Voyager

                            I'm having the same issue. My fiance and I have the game, and he ends up being out of sync with my time. it gets to the point where he can't do anything nor go to sleep. He has to just drop the game and we lost a day of work on the farm. It's a slow process when it happens, but it does happen. I''ll find him doing things and hitting trees, getting grass, rocks, even fighting, things that aren't there. There needs to be something like a catch up mechanic or thing in game that 'skips' the behind player to the right time. Most games have something like this when lag happens, where the player is teleported to the correct time with the items or actions automatically being completed. Maybe the game could implement something like that (forgive me, I don't know the technical terms for it all but I can describe it real well....sort of lol) What I do know, is that it is making the game unplayable for some days in game and then we are forced to quit and lose the day.
                             
                            • Sathosk

                              Sathosk Space Hobo

                              Same issue here, playing on 2 people, always get desync very soon, and end up with alot of time desync after awhile, cant open chests, loading times take forever to non host player, and sometimes even duplicate when harvesting since i can farm what was already farmed before, this need to be fixed otherwise it kills the fun of multiplayer.
                               
                              • Borschik

                                Borschik Tentacle Wrangler

                                I am playing with 3 people. Two of them have no issues, but one can't connect to server half of the time, desyncs with time, can't open chests, have massive loading times, game crashes for him, all of us can't sleep cause he is not considered sleeping. He has a weak PC and bad internet, but I could play with him any other game with no problems.

                                It was okay at the begining, but with months passing he either can't join at all, or can't open any chest, or have massive loading time and in the evening we wait for 10 minutes till he syncs to the start of a new day.
                                 
                                • KieferSkunk

                                  KieferSkunk Poptop Tamer

                                  If reproducing the bug is a problem, I have an idea on how to make it easier to do so (at least on Windows):

                                  Download a program called "Cheat Engine" (https://cheatengine.org). This program is essentially just a script engine that lets people do Gameshark/Game Genie-style cheat searches on their games, and one of its features is a "speed hack". There is a Mac version for this program as well.

                                  Once you install the program, start Stardew Valley, then run Cheat Engine. Click a highlighted icon in the upper-left corner of the program to scan active programs and find the Stardew Valley executable. Once selected, check the box on the right marked "Enable Speedhack". Then set Speed to 0.5 and click Apply.

                                  This causes the game to run at half its normal speed, and I confirmed that that includes making time count at half-speed too. It might also interfere with networking, but it shouldn't prevent you from reproducing the bug reliably.

                                  I haven't tried this in a multiplayer environment yet, but if the host is NOT attempting to keep the clients in sync (and I'm pretty sure it isn't), enabling this speedhack will DEFINITELY cause a client to reliably go further and further out of sync. (You could also speed up your copy of the game and get ahead of the host this way.)

                                  On the other hand, if the host were sending "The time is" packets to the clients and they were updating based on that, then a slowed-down game should still count time at normal speed. (Alternatively, if you slow down the host, then the clients should also be counting at much slower speed than normal.)

                                  Hope this helps. And Chucklefish, if you're reading, please acknowledge. Thanks.
                                   
                                  • Maxjanus

                                    Maxjanus Space Hobo

                                    Possible fix for some Desync issues found:
                                    As read on reddit the desync might be caused by defect items. In some cases it were torches. I could eliminate most desync by destroying all torches and removing other lightsources (especially in the spawn area maybe?). After removing all torches and the big stove for 3000 gold in the other players cabin the desync right from joining the game disappeared. And all later desync is removed to a playable level. After passing a loading zone the other players clock is accelerated to remove any desync for some time again.

                                    Hope this helps many people. However some seem to have desync right from the get go, so that probably does not work for all.

                                    Hope that fixes the error for some of you!
                                     
                                    • timelessraccoon

                                      timelessraccoon Intergalactic Tourist

                                      Only time ive encounted desync problem is with my friend who plays with a mac laptop. i was host with a gaming pc, other friend with pc did not have desync problem just mac friend.
                                       
                                      • Borschik

                                        Borschik Tentacle Wrangler

                                        Thank you, that fixed desyncs!
                                        I destroyed torches in the farm and desyncs stopped. Braziers and stoves in the house were still present.
                                         
                                          Maxjanus likes this.
                                        • EssemEcks

                                          EssemEcks Yeah, You!

                                          We're desyncing on day one, so it's not necessarily a matter of what items are on the farm, etc. It's happening inconsistently, though. We can restart the server after a desync, have our players do the same things, and get through the whole day without desyncing, so it doesn't seem to be tied to a particular action or actions.
                                           

                                          Share This Page