All programs, great and small, take advantage of built-in data types. Data types are specialized types of numbers that have meaning to the compiler of a program. Examples of data types are int, long, short, and double. These data types are used by programs to perform the mathematical operations they need to perform in order to run. Each data type has special properties: sign, size, range, and precision.
When a program is compiled, information regarding data types is removed, and instead the compiler simply writes the instructions into the final result that will automatically use the correct operations to perform the correct math with the correct types of data.
The following chart provides a comprehensive list of common data types used in games.
Data Type
Alias
Sign
Size
Range
Precision
Extra
1 bit
1 bit
0 to 1
Whole Numbers
The smallest of small types, single bits can only be 0 or 1. All data types are created by putting multiple bits together.
A bit in itself is not actually a data type.
2 bits
2 bits
0 to 3
Whole Numbers
As a form of compression, games may store index-based tile information in bits. 2 bits can only represent numbers from 0 to 3, so they aren’t common.
4 bits
4 bits
0 to 15
Whole Numbers
Dividing a byte in half allows games to store two numbers in a single byte, both ranging from 0 to 15.
char
Signed
1 byte (8 bits)
-128 to 127
Whole Numbers
The smallest data type, chars and bytes are often used to contain data in lists, such as strings.
byte
unsigned char
Unsigned
1 byte (8 bits)
0 to 255
Whole Numbers
short
Signed
2 bytes (16 bits)
-32,768 to 32,767
Whole Numbers
Long ago these were the standard types on Windows® platforms. Old games still use these, and some other scanners may call these words.
Modern programs use these to store Unicode strings.
unsigned short
word
Unsigned
2 bytes (16 bits)
0 to 65,535
Whole Numbers
long
Signed
4 bytes (32 bits)
-2,147,483,648 to 2,147,483,647
Whole Numbers
On 32-bit Windows® platforms, these are the standard type. This type is most common in all modern games. As a relic of the past, these are sometimes called dwords, or double words.
unsigned long
dword
Unsigned
4 bytes (32 bits)
0 to 4,294,967,295
Whole Numbers
int
Signed
Variable, but 4 bytes (32 bits) in MHS
-2,147,483,648 to 2,147,483,647
Whole Numbers
This type changes on a per-language basis, though the most common form is 4 bytes. MHS, therefore, treats this as 4 bytes, though only supports the signed version because int is exactly the same as long.
unsigned int
Unsigned
Variable, but 4 bytes (32 bits) in MHS
0 to 4,294,967,295
Whole Numbers
64-bit integer
__int64
Signed
8 bytes (64 bits)
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Whole Numbers
64-bit Windows® provides more support for these than 32-bit Windows®, however they are used in 32-bit Windows® as well.
These are very rare and may never be encountered in game hacking.
These are sometimes called qwords, or quadruple words.
unsigned 64-bit integer
unsigned __int64, qword
Unsigned
8 bytes (64 bits)
0 to 18,446,744,073,709,551,615
Whole Numbers
float
4 bytes (32 bits)
(+/-)3.4E+38
Floating-point Numbers
Floating-point types are used in all 3-D games, though float is much more common because its accuracy is sufficient, yet it is smaller and faster than doubles.