Skip to content

Data Types

Computers store information in a standard way using data types. For example, EA releases .tdesc XML files that define tuning structure using data types:

Tuning Types

Here we can see references to the types bool, Pack, ResourceKey and str.

Primitive data types store single pieces of information, are used as the building blocks for all other data types.

TypeDataExamples
Integer (int), Short, LongWhole Numbers0, 54, -123
Float, DoubleFractions12, 3.14159, -2.5
Boolean (bool)True/FalseTrue, False
String (str)TextHello, World!

Because numbers are infinite, they have multiple data types for different max ranges.

Data Structures store multiple pieces of information together, either primitive data types or other data structures.

A list of items that can be referenced by a numbered index, typically starting at 0.

fruits = ["apple", "orange", "pair"]
fruits[0] is "apple"

Maps a key to a value.

Person1 = {
first_name = "John"
last_name = "Smith"
age = 45
}
Person1["first_name"] is "John"

As a practical example, here’s the object structure for a Sims 4 Resource Key:

Resource_Key {
type: Int
group: Int
instance: Long
}

Enums are a special primitive data type that stores a list of possible options.

A good example is Sims 4 Ages such as Teen and Adult. You could store them as strings, or you could store them as numbers. Both methods have pros and cons.

Enums are essentially both. Here’s the actual Ages enum definition from Sims 4:

enum Ages{
BABY = 1,
TODDLER = 2,
CHILD = 4,
TEEN = 8,
YOUNG_ADULT = 16,
ADULT = 32,
ELDER = 64,
INFANT = 128,
}
// Example Usage:
current_age = Ages.ADULT

Thus, enums act like predefined labels, but are stored as numbers internally. In XML tuning, enums are written using their label, but in SimData are written using their number.