Skip to content
Stijn edited this page Sep 5, 2024 · 13 revisions

This is a list of things that can cause a desync in 1.32 and later. These are not caused by HiveWE, but having a list is handy.

General

  1. Code in GetLocalPlayer() blocks will cause desyncs if it makes changes that should have happened on both player clients at the same time. The following will cause a desync because the unit is deleted on only one client.
if (GetTriggeringPlayer() == GetLocalPlayer) then
    KillUnit(GetTriggeringUnit())
endif

But the following will not because a UI frame being visible or not is not something that needs to be synchronised between players.

if (GetTriggeringPlayer() == GetLocalPlayer) then
    HideFrame(SomeFrameID)
endif
  1. Using GetLocalZ() for things that need to be synced between clients (e.g. killing a unit) will cause desyncs as there are height differences between Classic and Reforged graphics.
  2. The CreepCampPathingCellDistance gameplay constant will desync if players don't restart their game before playing your map.
  3. Frames are cached between maps, so if you create a frame before loading your .toc it can create the frame for some people but not others.
  4. (Unconfirmed) local unitID = GetHandleId(unit) is playing with fire, as this leads to desyncs in Lua (it definitely has different values between players, this then may have a cascading effect on what the GC collects)
  5. GetRandomInt/Real/math.random in a GetLocalPlayer() block will desync because the random generation is no longer in sync between players.
  6. Calling ForForce or ForGroup inside a GetLocalPlayer() block guarantees desync, Select group for player GUI action is such example

Lua specific

  1. Creating objects outside of the main function in Lua is prone to desyncs. To lazily solve this I moved TSTL's module creation inside of the main function.
  2. Using StartTimerBJ and bj_lastStartedTimer will cause desyncs. This also means that the GUI Countdown Timer - Start Timer will desync. Use TimerStart() in a custom script block instead.
  3. Iterating produces pairs but the order of iteration is not guaranteed so can differ per player.
Clone this wiki locally