Resource Keys
Resource keys are one of the most important concepts in Sims 4 modding. Luckily, they’re also quite straight forward. Let’s go into painful detail anyway!
Unique References
Section titled “Unique References”Resource keys are comprised of 3 numbers, type (int), group (int), and instance (long).
Type- Similar to a file type.Group- Depends on resource, often unused and set to 0.Instance- A unique ID
When combined, these three fields are known as a Resource Key and act as a unique identifier for a resource. When writing a key, it is written using hex in the format Type:Group:Instance.
0x00B2D882:0x00000000:0x0AD03055DAB19FC70x015A1849:0x00852CE1:0xC813FB9262F7D81D
This works just like a file type, but is specific to Sims 4. Some examples:
0x220557DA- String Table0x545AC67A- SimData0x034AEECB- CAS Part
The meaning of the group field depends on the resource and may be entirely unused. For example, some thumbnails use it to indicate size (small, medium, or large). Tuning XML uses it to indicate DLC requirements. SimData uses it to indicates the tuning type that it encodes.
Instance
Section titled “Instance”An instance is used to reference a unique object in game. The same instance is sometimes reused to times to link multiple resources to the same object.
For example, CC objects will have a Catalog Object and an Object Definition resource with matching instances. A Tuning XML resource will often have a matching SimData resource that encodes some fields a 2nd time in binary for performance.
You can override game data by using an existing instance, or create new data by using a new unique instance. Unique instances are generated using FNV hashing, which will be discussed later.