In the latest version of ShieldBattery, we've identified and fixed the bug that has been causing desyncs for observers. Since not every tournament is played through ShieldBattery, I thought I'd explain what the underlying cause is and how you can avoid triggering it in games you are observing.
tl;dr: How you can avoid triggering a desync as an observer
Observe games through ShieldBattery. We've fixed the bug so it won't occur in any games there.
Don't change the player vision settings once a unit requiring detection is in the game (includes both stealth and burrowed units)
Example of this occurring:
(starts around 44:11 in case the embed doesn't get the time)
What's going on
In StarCraft, detection is not removed immediately when the unit/building providing it goes away. You can see this pretty clearly if you kill a detector, there will be brief period where cloaked units can still be seen. When Blizzard added the observer mode, they mostly reused existing game logic to implement the various features, including switching between different player's vision. At some point they decided that the existing logic around stealth units (that detection would be applied after a delay) was unacceptable for observer mode: they wanted switching to a player's vision to apply the detection status immediately.
So, Blizzard wrote code to call a function to update the sprites for those units immediately, thinking it was safe. *But* that code actually calls through to update the "real" detection status for this unit as well (a value used by the game for simulating actual game logic). If this value differs from the values the actual players have, it risks causing a desync between the players and the observer.
Desyncs are often very subtle, e.g. they may just result in a different amount of random numbers being generated during a particular turn. But these things quickly add up over time: one extra random number during a turn might make a unit miss on one person's game when they hit on everyone else's, which then results in a unit dying when it lived in the "real" game, and then on and on until you get to extremely observable effects: tons of idle workers, units running to their death with no micro, etc.
So in the linked VOD above, the observer changes player visions around 44:27, when a DT is on the field. This triggers this desync, which the broadcast crew + Tastosis do not notice for about 2 minutes (although they are very confused!), which can show you how subtle this is.
On ShieldBattery, we've fixed this by preventing changes to the unit detection status outside of a particular code path, so if you're playing/observing games there, everything will fine. If you're playing games on LAN or Bnet, avoiding changing the player vision once any stealthed units are out should avoid the desync as well.
@ZZZero.O I do not think all the desyncs could have been avoided. Correct me if I am wrong, Tec, but he found one of the reasons why this happens. I have noticed that sometimes replays that are saved as LastRep.rep are desynced every time you watch them, but if you find the "auto-saved" replay it renders just fine. So the vision bug is one of the reasons for desync but I do not think all. Of course, we are talking replays vs live games but still it happens for a variety of reasons. Additionally, from watching the BSL casts, I have noticed that desyncs are more likely to occur if the latency between the players is not very good, i.e., when players from two continents play more desyncs occur compared to two opponents located geographically closer.
On February 09 2022 03:18 IntoTheWow wrote: tec27, the one true king
Credit where it's due, neive is the one who found this for us and developed a fix (and also developed our fix for the floating SCV glitch and various other exploits that still work on Bnet). He just doesn't post on TL and I thought this would be helpful for the community in general
On February 09 2022 21:51 y2kid wrote: @ZZZero.O I do not think all the desyncs could have been avoided. Correct me if I am wrong, Tec, but he found one of the reasons why this happens. I have noticed that sometimes replays that are saved as LastRep.rep are desynced every time you watch them, but if you find the "auto-saved" replay it renders just fine. So the vision bug is one of the reasons for desync but I do not think all. Of course, we are talking replays vs live games but still it happens for a variety of reasons. Additionally, from watching the BSL casts, I have noticed that desyncs are more likely to occur if the latency between the players is not very good, i.e., when players from two continents play more desyncs occur compared to two opponents located geographically closer.
Yeah, replay desyncs are (mostly) a separate issue, and have been around since before SC:R and this change. If the same code is used while watching replays when changing player vision (I'm honestly not sure if it is or not, given that the UIs are implemented differently) this could have caused the same issues there, but there are also other cases where replays desync and I'm not entirely sure what the underlying cause is there.