Packed GUID

From wowdev
Revision as of 23:27, 26 June 2021 by Deadbeef (talk | contribs) (Created from text on SMSG_UPDATE_OBJECT page "A note about object GUIDs" section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In a lot of World Packets (but unfortunately, not all of them, albeit almost), Blizzard sends object GUIDs in a "packed" form. Seeing as GUIDs are uint64, they chose to pack information so that only the bytes that are set are sent. They first send an uint8 where every bit defines whether or not the corresponding byte is sent. This field is commonly called a mask. Then all the bytes are sent in that order.

Assuming the mask is 0b01101001, then they will send 0-th, 3-rd, 5-th and 6-th bytes of the guid, in that order, and only those.

It is worth noting that at some point (WoD or MoP, i'm not sure - Warpten), they decided to make GUIDs 128 bits. They still pack them, except that this time, they send two masks before the actual bytes: the first one for the GUID lopart, and the second one for the GUID hipart.