Replies: 3 (Who?), Viewed: 2009 times.
Test Subject
Original Poster
#1 Old 13th Sep 2018 at 6:04 PM
hashing algorithm for tdesc files
How does Sims 4 hash its .tdesc files for numeric reference (e.g. 24718 = 'objective_tuning/Max_Criminal')?

I'm just getting started modding and am starting out by reading through various files to figure out how everything is organized. I'm using python scripts to put together a folder with some scripted search modules for navigating the game's .tdesc files and want to find a way to quickly find what file a number refers to.

If this question has already been asked could you please point me to that thread?

Thanks!
Advertisement
Alchemist
#2 Old 13th Sep 2018 at 10:39 PM
The XML resources that are part of the game are generally not numbered with a hash for the instance ID. Those numbers are generated by the EA content creation tools and is why many of them are in numerical order. When creating new XML for a mod, the best practice is to use your resource name (which should include an author name to help guarantee uniqueness) to generate an FNV-64 hash with the highest bit set. EA considers anything with the high-bit not set to be reserved for their own use. This leaves us only 9,223,372,036,854,775,807 ID numbers to use for modding, but that should be fairly adequate

If you are using my XML Extractor to generate your XML files from the game files then you can use the included File Finder to search for what an ID represents, just type in the instance number in hex or decimal and it will show all matches. I would assume Sims 4 Studio has a similar feature as well.

The TDESC files themselves are separate from those XML resources and are used to describe what the various tuning elements mean. You can download the latest TDESC files from the Mods & CC Technical Discussions forum at EA. I have also written a tool to parse these files into an easy to read format and that's available from this thread in the Modding Tools forum here.
Test Subject
Original Poster
#3 Old 14th Sep 2018 at 12:02 AM Last edited by nixylvarie : 14th Sep 2018 at 2:44 AM.
Quote:
Originally Posted by scumbumbo
The XML resources that are part of the game are generally not numbered with a hash for the instance ID. Those numbers are generated by the EA content creation tools and is why many of them are in numerical order. When creating new XML for a mod, the best practice is to use your resource name (which should include an author name to help guarantee uniqueness) to generate an FNV-64 hash with the highest bit set. EA considers anything with the high-bit not set to be reserved for their own use. This leaves us only 9,223,372,036,854,775,807 ID numbers to use for modding, but that should be fairly adequate

If you are using my XML Extractor to generate your XML files from the game files then you can use the included File Finder to search for what an ID represents, just type in the instance number in hex or decimal and it will show all matches. I would assume Sims 4 Studio has a similar feature as well.

The TDESC files themselves are separate from those XML resources and are used to describe what the various tuning elements mean. You can download the latest TDESC files from the Mods & CC Technical Discussions forum at EA. I have also written a tool to parse these files into an easy to read format and that's available from this thread in the Modding Tools forum here.


The XML files look like they have abbreviated versions of the tag names. How can I find which long-version tag name they correspond to?
Alchemist
#4 Old 14th Sep 2018 at 6:07 AM
Quote:
Originally Posted by nixylvarie
The XML files look like they have abbreviated versions of the tag names. How can I find which long-version tag name they correspond to?
Hmm, okay I'm not entirely sure I'm following the question here, but I think what you're asking is how to tell which .tdesc file describes the XML entries for a specific XML resource? If so, then taking for example the XML resource you mentioned earlier, 24718 = 'objective_tuning/Max_Criminal', if you look at the top of that XML file you will see the <I> line:
Code:
-|||
Back to top