The Sims™ Technical Aspects

TTAB Resource Format


The following information is not based on any proprietary knowledge or restricted documentation—it was entirely derived from observation, experiment, and public information, thus it may be inaccurate or incomplete.

Analyzed by Greg Noel.  My thanks to Peter Gould for making endless modifications to test objects and reporting how the hex dump changed. 

Calling this resource a "tree table" is a bit of a misnomer.  The name comes from the tree that is generated when creating the pie menus, but it's more accurate to call it an interaction list, since what it does is generate a list of possible interactions and provide a way of scoring them to see how advantageous they would be. 

For example, a typical TTAB for a bookcase would define entries for "Study Cooking," "Study Mechanical," "Read a Book," and "Study for School." It would have the information that the first two were only for adults and the last only for children.  It would further state that reading a book was fun, particularly for serious Sims.  Moreover, the entries would say that the Sim had to be fairly close to the bookcase for the interaction to be considered, as well as other information. 

In essence, the game considers each possible interaction and selects the one that provides the most immediate satisfaction for the Sim.  It's a little more complex than that (for example, there's some randomization so that actions aren't completely predictable) but it's the TTAB entries are what offers the Sim its choice of actions. 

In the description below, all numbers are little-endian unless otherwise specified. 

TTAB layout
Offset Size Value
0 2 Count (N) of interactions
2 2 Version
opt 1 Compression code
4 or 5 var TTAB core&motives #1
var var . . .
var var TTAB core&motives #N

The TTAB information consists of a four-byte header that tells how many entries there are and the version information. 

The count is two bytes.  The observed range is from zero to 65.  (Empty interaction lists often occur on temporary objects that are created for some short-term reason and which are deleted when their purpose is done.)

The version is two bytes.  The highest known version is 9, which is probably the current one.  The earliest version found is version 2 and it still works in the game; presumably all intermediate versions work as well. 

The first byte of version 9 content is a compression code; see the description of the field encoding algorithm for details.  It always contains the value one. 

Following the header, there is a set of interactions.  The count field says how many interactions there are.  Each interaction contains a core portion followed by table of sixteen motive entries.  These elements are described below. 

Core layout

The content and layout of the core have changed significantly over a number of versions.  Fields have been added, the width of the fields has changed, and the capabilities supported have expanded.  In one light, looking at the core layout offers an interesting historical perspective on how the game evolved during development. 

In this table, the initial size of the field is listed first.  If the field was added at some point, the initial size is given as zero.  If the field changed sizes during its lifetime, the sizes are separated by a slash.  The second column indicates which set of field widths is used to encode the value when using the field encoding scheme. 

TTAB core
Width Field Value
2 S Action function
2 S Guard function
2/4 L Motive entries
2/0 - 0xA3A3 (skip)
0/2/4 L Flags
0/4 L String table index
0/4 L Attenuation code
4 L Attenuation value
0/4 L Autonomy
0/4 L Index for joining?

Version 2 is the first version for which we have any samples.  The version 2 core consists of four two-byte integers and a four-byte float.  The four integers are the action and guard functions, a field containing sixteen, and a skip field containing 0xA3A3. 

Version 3 replaced the skip field with a flag field. 

We have no samples of version 4, so we don't know what changes were made there. 

By version 5, the sixteen field and the flags field had expanded to four bytes; and the string table index, the autonomy, and the join index had been added. 

We have no (non-null) samples of version 6, so we don't know what changes were made there.  (The only version six sample we found was for a temporary object that had no interactions, so it only consisted of a header.)

By version 7, the attenuation code had been added.  (Each motive had also expanded to three fields, see below.) We only have one version 7 sample and it only has one interaction entry so exactly what changes were made during this sequence are not completely clear. 

Version 8 is seemingly unchanged; it appears to be exactly the same format as version 7. 

Version 9 converted to the field encoding algorithm but otherwise has exactly the same fields as version 8.  Since most of the motive entries are usually zero and the algorithm encodes a zero in a single bit, this saves a lot of space in the resources. 

For version 9, there are two sets of encoding widths in use.  One set of values is encoded with widths of 5, 8, 13, and 16 bits (including sign).  The other set of values is encoded with field widths of 6, 11, 21, and 32 bits (including sign).  We will term these the short (S) and long (L) encodings, respectively.  Fields that were two bytes in version 8 use the short encoding and fields that were four bytes use the long encoding.  Note that the encoding can shift in mid-byte. 

Core values

The action function is the BHAV subroutine that performs the described interaction. 

If non-zero, the guard function is executed when the interaction is evaluated.  Presumably, if it returns false, the action is excluded from consideration.  It is not known if a zero value is interpreted as true or false. 

The number of motive entries is sixteen. Always.  Even if the trailing motive entries are all zero, this value is sixteen and all sixteen motive entries are present.  It is not known if other values would be accepted and work as expected. 

The earliest version has a field that is always 0xA3A3.  This is the value often used in the game for space to be skipped.  This field was later dropped. 

The flags field replaced the skip field.  Some of the flags are known; some are guesses:

Bit Meaning Bit Meaning
0 Accessible to visitor 6 Not accessible to adult
1 Joinable? 7 Debugging menu
2 Run immediately? 8 Priority
3 Allow consecutive 9 Enable for cats [Unleashed]
4 Not accessible to child 10 Enable for dogs [Unleashed]
5 (Not?) accessible to demo child?

The fields not marked with a question mark have been confirmed by setting and clearing them and seeing what MenuEditor reported.  Note that the two flags for availability to child and adult have the reverse sense from how they are reported; it's a good guess that all objects were originally available to everyone and these flags appeared when specialized objects were added. 

After assigning the flags that could be confirmed, there were four flags used in objects that had not been assigned.  The debug flag, the run immediately flag, and the demo children flag are all based on an Edith screenshot showing its menu editor, which has those names as options under a "flags" category.  The screenshot also shows a checkbox for "can be joined" along with an "index for joining" value under a separate "joining" category.  Each use of the unassigned flags was inspected, with these results:

The fact that the flags' usage aligns nicely with the meaning suggested by the screenshot, each supporting the other, means we can have a great deal of confidence that the flag assignments are correct. 

The string table index is the number of the string within the associated TTAs resource.  The selected string is the text to use in the menu.  Before this field was added, interactions were apparently one-to-one with the string table entries; this field gives the ability to shuffle the menus without having to shuffle all the translated strings. 

An object is said to broadcast an advertisement for each interaction.  This advertisement can fade with distance.  If non-zero, the attenuation code specifies a standard value for how quickly the advertisement will fade.  The four codes 1..4 are used for none, low, moderate, and high.  If the code is zero, a custom float value is taken from a second field.  It is unknown what values the game uses for the four codes, nor what the expected range of the custom value can be.  However, values of 0, 0.02, 0.1, and 0.2 are common (0.02 is by far the most common), so they may correspond to the standard values.  Many of the float values with non-zero codes are clearly bogus (the custom value for one of the standard dishwashers spells "vox_" when interpreted as ASCII); probably at some point the value was not initialized when creating new objects, and the garbage value stuck. 

Autonomy controls which actions a Sim will chose on its own; it's a settable game option.  All standard objects have an autonomy of either 50 or 100. 

The "index for joining" is a field on the Edith screenshot described above.  In the screenshot, the field has the value -1.  That's the most common value of this field (and it's the only field left) so that's very likely what this field is.  What it does is unknown, except that if this value is not -1, the menu entry is for starting some joinable group activity (such as "play" pool or "get in" the hot tub).  This field is strongly correlated with the "joinable" flag; whenever the flag is set, the field is not -1. 

Since the flag is very early (the second one) and the field is very late (the last one).  it could be that the field obsoletes the flag.  If we speculate that the purpose of the flag is to provide separation for join groups (but why?) then it could be that the flag has been carried over as field values have been inserted.  On the other hand, if the game can be confused by similar objects that can be joined, it would explain why a second hot tub is ignored. 

Motive layout

There are sixteen motive entries in each interaction entry.  Nine have been identified.  One may be used internally.  The others are probably unused. 

The identified entries match the order given in Behavior.iff STR# 134 titled "motive strings." Index 3 is mood, index 5 is energy, index 6 is comfort, index 7 is hunger, index 8 is hygiene, index 9 is bladder, index 13 is room, index 14 is social, and index 15 is fun.  Index 11 is identified as "sleep state" and may be used by the game for its own purposes.  The other indexes (0, 1, 2, 4, 10, and 12) are listed as unused and probably are motives that didn't make it into the final game. 

In any interaction, more than one motive may contain values.  It is very likely that these entries are additive, so that, for example, the strong positive energy and fun values will normally offset the negative bladder value advertised by the espresso machine. 

TTAB motive
Width Field Value
0/2 S Motive minimum
2 S Motive delta
0/2 S Motive character type

A motive modifier started out as a single two-byte value.  In either version 6 or version 7, the modifier was changed to three values.  The most logical assumption is that the single value was the delta (and the other values treated as zero), but this assumption could be wrong. 

When field encoding was introduced in version 9, these values used the short encoding. 

Motive values

The minimum value is usually presented as the lower end of a range, with the upper end as (unknown+delta), but there's no explanation of what it really does.  It's not known if this minimum is a promise that it will lift the motive to at least this level, or if it's a threshold with the meaning that the motive must be below it for this advertisement to be applied or if it has some other effect. 

The delta value is how much the object claims this interaction will change the given motive and it can be negative to discourage use when some motive is high.  (Note that this claim is not a contract; many objects lie or have unadvertised side-effects.) In theory, this value should be limited to -100..100, but there are a number of game objects (such as beds, the Pepsi machine, stereos, the espresso machine) that use higher values as a come-on.  The highest observed value is 220, the smallest -20. 

If the character type is non-zero, the motive strength is increased based upon how strongly the Sim has that characteristic.  The identified codes match the codes given in Behavior.iff STR# 232 titled "personality ads." The following table is based on that information:

#Meaning #Meaning #Meaning #Meaning
1Nice 7Playful 13Cleaning skill (old?) 18Music skill (old)
2Grouchy 8Serious 14Cooking skill 19Creative skill
3Active 9Outgoing 15Social skill (charisma) 20Literacy skill (old)
4Lazy 10Shy 16Repair skill (mechanical) 21Physical skill (body)
5Generous 11Neat 17Gardening skill (old) 22Logic skill
6Selfish 12Sloppy

Each personal attribute and its complement is available, as is each skill a person has.  Note that in addition to the five pairs of characteristics visible in the game there is a generous/selfish pair.  Moreover, there are three skills identified as old; it's not clear if cleaning should be identified as old as well.  Gameplay suggests that generous/selfish is set randomly when the character is created and cannot be affected after that.  The old skills may be unimplemented, although a few third-party floral objects advertise for the gardening skill. 


Reminder: This information is not based on any proprietary knowledge or restricted documentation—it was entirely derived from observation, experiment, and public information, thus it may be inaccurate or incomplete.

Valid XHTML 1.1! Valid CSS!
Copyright © 2001-2008 Dave Baum and Greg Noel. All rights reserved.
The Sims™ is a trademark of Maxis and Electronic Arts.
This page was last modified Thursday, 25-Mar-2004 12:53:23 UTC.
Made on a Mac
SourceForge