SCRMaps
/
Sign in

Desync, and the local player

Drive a change everyone shares from a condition only one machine can see, and everyone else drops.

7 min read

Multiplayer StarCraft works by every machine computing the same game separately. Only input is sent; everything else is assumed to come out identical everywhere. The moment one machine computes something different the games have diverged, and StarCraft drops whoever diverged.

In an EUD map the reason this bites is simple: some values are the same for everybody, and some exist only on this machine.

Shared and not shared
공유 / sharedUnits, resources, death counts, everything on the map. Every machine holds the same value.
로컬 / localMouse position, screen position, key presses, the selected unit, and who you are. Different on every machine.

Never fire a shared action from a local condition. This is item #13 on the crash list and it is the most common reason an EUD map drops. A condition only your machine can see - a key is down, the mouse is here - driving a unit creation or a resource grant means it happens on your machine alone, and everyone else drops.

IsUserCP() sits exactly on that line. It asks whether the player currently being processed is the one sitting at this machine, so it is true for exactly one slot per machine.

// 안전합니다: 로컬 조건, 로컬 효과
if (IsUserCP()) {
    setcurpl(getuserplayerid());
    DisplayText("당신에게만 보이는 글");
}

// 게임을 드랍시킵니다: 로컬 조건, 공유 효과
if (IsUserCP()) {
    CreateUnit(1, "Terran Marine", loc, CurrentPlayer);  // 절대 금지
}
Putting text on screen is local. Creating a unit is shared.

A real case: in Super Turret Defense a block that updated shared game state sat inside if (IsUserCP()), so it ran for a different single slot on each machine. Every computer computed something different and the whole game dropped. The code looked fine and worked perfectly in a solo test - because when you are alone, every slot is your slot.

You cannot find a desync alone. With one player there is nobody to diverge from. Any map that touches a local value has to be tested with at least two people.

Crash list item #13
Sign in to track your progress