Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

New Creator Theme: Elders! - posted on 1st Sep 2018 at 11:43 AM
Replies: 3 (Who?), Viewed: 282 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
Theorist
#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?
Theorist
#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:
<I c="Objective" i="objective" m="event_testing.objective_tuning" n="Max_Criminal" s="24718">


i (Instance Type) = "objective", so to find the proper .tdesc file you would look in the Objectives folder of the TDESCs you downloaded

c (Class) = "Objective", so inside that Objectives folder, look in the Descriptions folder and reference the file named Objective.tdesc

As another example, to pick one at random that doesn't use identical i and c values, consider 24581, Loot_Buff_ToyingAround, the <I> line:
Code:
<I c="LootActions" i="action" m="interactions.utils.loot" n="Loot_Buff_ToyingAround" s="24581">


i = "action", so we look in the Actions folder of the TDESCs

c = "LootActions", so inside the Descriptions subfolder you would look at the LootActions.tdesc file.

Hope I followed your question right this time and that this helps!

Btw, in case you are wondering, the m attribute identifies the Python script module that contains the class definition for this type of XML resource.
Back to top