A brief overview of GUIDs for those that are only just discovering them.
What is a GUID? It is a Globally Unique IDentifier that is guaranteed to be unique for its usage. If you run Microsoft Windows, Linux or Mac OS X, you may have encountered GUIDs before when looking through the registry, installing device drivers, or accessing web services. GUIDs in an oprating system are used to identify device drivers, applications, users, physical hardware devices such as motherboards and graphics cards, even the keyboard you are typing on.
On Microsoft Windows GUIDs are 16 bytes long, and are based on hardware characteristics of the computer that is used to generate the GUID, e.g. your computer, the network address, time of day, and a random number. The chance of a collision, i.e. you and I generating two GUIDs that are identical, is miniscule. Really miniscule. Listen, you might think the odds of you ever getting laid are exceptionally small but that’s nothing compared to... And son on.
In the World of Warcraft game, GUIDs are 8 bytes long, and because they only need to be unique within the context of the game, 8 bytes is more than enough. What algorithm is employed to generate the GUIDs is unknown, but it is most likely a similar technique to how the game server operating system does it, or it may even use the host operating system GUID generation system.
How are GUIDs used within World of Warcraft? Every object you interact with, from the totem that a shaman drops on the ground, to the monster you just killed, to your player character, to the chair your player character can sit on, and yes, even that vein of ore you just mined, all of them have a unique GUID.
GUIDs are unique, never re-used (as far as anyone knows) and identify every object within the game world. When you kill a mob and the corpse finally disappears, the GUID associated with it is thrown away, never to be used again. A short while later, when the monster in the area re-spawns, it might look like the same monster, but it is actually a completely new monster, with a completely new GUID.
GUIDs are unique to a game server, and may even be unique across all game servers, or all game servers within a geographical region. However, GUIDs are not unique to a particular game client. If you run two game clients on the same game server, e.g. Darkiron, and both player characters on two different computers target the same monster, both game clients will report the same GUID for the same monster. This is actually quite useful if you are writing a party bot or multiboxing aid.
Are GUIDs persistent? Some GUIDs are, some GUIDs are not. GUIDs not only uniquely identify all game objects within the game world but many of them also persist across server restarts because they are stored in the SQL database. Much of the game world, i.e. anything that is transitory such as monsters and NPCs,,i.e. a “Unit”, ore veins, and non-bound world items, i.e. stuff you aren’t carrying, does not appear to be persistent in that it is not serialized back to the database (ever had a dungeon instance crash while you are in it? Many parts of course, actually are, your player character, items in your inventory, your backpacks, your bank, your guild vault, a daily dungeon or time-locked RAID dungeon and many other things too.
As far as I can ascertain, the items you carry on your character are uniquely your items, each with its own GUID. It may look like you have the exact same sword as another player, but both swords have a unique identifier that marks it as two separate instances of the same game object.
Side Note: As a side-note, I do not know if general world objects are persisted in the SQL database or regenerated every time the game server is restarted. This could be verified by dumping out all of the GUIDs of objects that are not players that are around your player character just before a game server restart, and then doing the same thing again once the game server is back up and comparing the two lists. This exercise is purely an academic pursuit as it would have no bearing on developing an effective bot nor give you any in-game advantage.
Hunting the GUID. If you know the GUID of an object, you can search the World of Warcraft, game client, memory space for those 8-bytes. If you grab the GUID of your player character and store it somewhere safe, when a new patch is released, it is trivial to find the player’s local GUID again, just plug in your known GUID to a memory search routine and hunt it down.
Multiboxing GUIDs: Multibox? You can log in a character on two separate accounts, scan the memory space of one game client for the GUIDs of both characters, from that you receive the LocalPlayer GUID, and consequently, the local player game object structure, and you receive an entry in to the object manager linked list.
Inferring Object Linked List Structure by Triangulating on Three GUIDs. Obviously, if you have three or more accounts you can scan one game client memory space for as many player character GUIDs as you have available to log in simultaneously. Searching for the multiple GUIDs and calculating the distance between the GUIDs in bytes will give you the offsets necessary to calculate how far apart in memory each game object is. You can use the same technique for determining the memory address of the player name cache.
Personal Anecdote. When I first started developing an out-of-process memory-reading application for World of Warcraft this was the first technique I used until I found enough information through the work of Apoc and other developers on this forum to actually figure out how the memory structures of World of Warcraft were laid out.
These short GUIDs are sufficient to uniquely identify every instance of every object in the game world and each time a new game object is created, a new GUID is created to go along with it. When you mine an ore vein, the GUID representing that vein is “used up” and when the vein spawns again in the exact same spot, that new vein will have a new GUID to go along with it, even though it looks like the exact same ore vein.