Hint: Although this document is 100% HTML 3.2, it uses nested tables rather heavily. If your browser cannot display it properly, you're probably better off viewing it as plain text, especially if you have a way to filter out all the HTML markup.

TTD savegame internals

This file documents many things I know about the structure of Transport Tycoon Deluxe (TTD) savegame files. In fact, my goal is to make this file as complete and accurate reference of TTD savegame structure as possible, for as long as I can maintain it. You can rely on the information you find here :-)

TTDPatch extensions up to version 2.0 are also documented, but often in less detail, and since TTDPatch is under continuous development, the list is likely to be incomplete the moment you read it. For an up-to-date reference, the best you can do is probably getting the TTDPatch source code (also available at my TTDPatch site) and browse the assembly files (*.asm and *.ah).

If you notice any errors, or have suggestions regarding this document, feel free to e-mail me about it.

The original Transport Tycoon (TTO) uses a similar savegame format, but so far I have little information concerning the exact structure of uncompressed TTO savegames (see "Compressed vs. uncompressed" below).

The basics

I assume that you, the reader, are familiar with basic concepts of savegame editing; if you're not, there are plenty of tutorials on the Web. You should have a decent hex editor, too, but you probably know that already. (For Windows, a good one is frhed (Free Hex Editor). You can get it from this site.)

Conventions

Unless stated otherwise, a plain number with no prefix is assumed to be in the hexadecimal notation, except for bit numbers, which are in the decimal notation. A plain number prefixed with a plus (+) or minus (-) sign is in the decimal notation. Numbers with a fractional part, percentages and dates are also in decimal by default.

To further disambiguate between the decimal and hexadecimal notation, hexadecimal is typically marked by the use of a monospaced font, like this: 1F, and/or the 0x prefix, like this: 0x1F.

In fragments marked as "C notation", numbers are in the notation used in the C language (i.e. 0x prefix means hexadecimal, 0 prefix means octal, otherwise it's decimal); monospaced font has no significance there. Sorry if it gets confusing, it's intuitive enough to me :-)

Variable sizes are indicated with the following symbols: B - byte, W - word (16-bit), L - 'long' word (32-bit; the standard term for the x86 architecture is 'doubleword', but B and D are visually not enough distinct for my taste). B[2] means two bytes; a notation like [14][1E] means an array of 0x1E (or +30) structures, each 0x14 (or +20) bytes long. Words and doublewords are stored in the 'little-endian' convention, with the least significant byte first, as usual on the x86 processor architecture.

Compressed vs. uncompressed

All known versions of Transport Tycoon save and load compressed savegames. The format of a compressed savegame (a file with one of the following extensions: .SV0, .SV1, .SV2, .SS0, .SS1) is as follows:

SizeMeaning
TTO: +39 bytes   
TTD: +47 bytes
Title of the game. A string of characters, terminated with a NUL unless they take up the entire title space.
W Title checksum. This is calculated by adding up all bytes of the title field, rotating the (16-bit) value 1 bit to the left after each addition, then EXORing the resulting value with 0xAAAA.
variable The actual data, compressed with a variant of run-length encoding (RLE) scheme. A string of chunks, each consisting of a leading code byte (the value of which is denoted as c here) followed by one byte if c is negative, otherwise by c+1 bytes. The uncompressed data consist of:
  • if c is nonnegative: the rest of the chunk, i.e. the following (c + 1) bytes;
  • if c is negative: the other byte of the chunk repeated (-c + 1) times.
L File checksum, calculated from all the preceding bytes of the file (including the title and the title checksum fields). The file checksum is always at the end of the file.

The file checksum calculation starts with checksum equal to 0. Each byte is added to the low 8 bits of the checksum; after each addition, the (32-bit) checksum is rotated 3 bits to the left. Finally, the game format version (+105128 for TTO, +201100 for TTD) is added to the checksum.

File checksum is broken in games saved by the Windows version of TTD. This is fixed in TTDPatch 1.8 and later if 'generalfixes' or 'win2k' switch is on.

Title screen demonstration savegames (the TITLE.DAT files) use the same format, except that at the end of the file checksum calculation, the game format version is subtracted from the checksum, instead of being added to it.

To uncompress a savegame, use SV1Codec. SV1Codec produces uncompressed savegames (a.k.a. 'big' files) with a .big extension by default.


Note: All information below applies to uncompressed savegames.


Coordinate systems

Of various coordinate systems used in TTD, the three listed below appear in savegames. In each of those, the north (top) corner of the map is the 'zero' of the coordinate system.

Tile coordinates

Also called X offset and Y offset in this document, these are most common and are used when it's only necessary to know the location of a tile (square, in TTD terms). The X coordinate grows from north to west, while the Y coordinate grows from north to east; a tile is the unit.

For a tile at the coordinates (X,Y), its array index (that is, the index into any of the landscape arrays) is (0x100 * Y) + X. For example, the array index of a tile located at (X=0x17, Y=0x23) is 2317; therefore, data for this tile may be found at the offset 2317 from the beginning of an array of bytes (like the 'L1' array), or 462E (which is 2*0x2317) from the beginning of an array of words (like the 'L3' array). The array index of the tile at the north corner of the landscape is (obviously) 0000, at the left (west) corner it's 00FF, at the right (east) corner it's FF00, and at the bottom (south) corner tile it's, of course, FFFF. Note that the east, west and south corner tiles are empty -- they are a part of an invisible one-tile border at the bottom edges of the map. (See the description of Class 7 for more information.)

When an array index of a tile is stored in a word, the first byte contains the X offset and the second byte contains the Y offset. This form of storing tile coordinates is referred to as the XY index (or simply XY) of a tile.

Precise coordinates

'Precise' coordinates, also referred to as X location and Y location (not to be confused with data locations, i.e. offsets from the beginning of the uncompressed savegame) in this document, are used when it's necessary to know the location of an object (e.g. a vehicle) on the landscape with a finer resolution than an XY index provides. The system is the same as tile coordinates, except that a tile is 16 units long in both directions. Therefore, in order to convert from precise coordinates to tile coordinates one has to just shift both values 4 bits to the right, discarding the low-order bits.

To describe the location of a vehicle in full, a third coordinate (the Z location, or altitude) is needed as well. One height level equals 8 units of altitude.

Pixel coordinates

To speed up the display of things, TTD employs the concept of absolute pixel coordinates. These are calculated from the precise coordinates (X,Y,Z) as follows:

pixel_X = 2*(Y - X)
pixel_Y = Y + X - Z

Note that the mapping of these coordinates into screen coordinates is affected by such things as view window or zoom level.

Simulation engine basics

All simulation processing in TTD is synchronous. The basic unit of time, one tick, is approximately +27 milliseconds long (though it may be more on a slow machine). A day in the TTD world is about +74 (precisely 0x10000/0x375, see the description of the location 00002 below) ticks long.

Data layout

An uncompressed savegame is basically a dump of all the parts of TTD memory required to restore the full state of the game. (In the Windows version of TTD pointers are translated before saving to keep the format compatible.)

Note: The layout is not fully known, so there are holes between data locations. Always refer to the size of a variable, structure or array to determine where it ends.

LocationSizeMeaning
00000    W Date in days since 1920-01-01
00002 W 'Fractional part' of the date. On each tick, 0x375 is added to this field; when it overflows, the date is incremented.
00004 [14][1E] Array of text effects, i.e. the rising cost/income signs. +30 entries, the structure of each entry is as follows:
    
OffsetSizeMeaning
00       W           Text ID to display (0801 for cost, 0803 for income), or FFFF in case of an empty slot (i.e. an unused entry).
Note: At the intermediate zoom level, TTD uses text ID equal to this field minus one.
02 W[4] Current position and size of the text. 4 absolute pixel coordinates, in the following order: left, right, top, bottom. The top and bottom coordinates are decremented on each tick.
0A W Expiration counter. On each tick, TTD subtracts 8 from this field; when it wraps around at zero the text effect is deleted from the array (by setting the word at 00 to FFFF). The initial value is 250.
0C [8] Text reference stack, the exact format depends on the text ID. For the cost/income signs, the first doubleword contains the amount to display, in British pounds.
0025C L[2] Random number generator's seed
00264 [5E][46] Town array (+70 entries, which defines the maximum number of towns possible). Locations within each entry follow:
    
OffsetSizeMeaning
00       W           XY of the town, 00 if an empty slot
02 W Population
04 W Town name (text ID)
06 L Town name parts (for randomly-generated names), bitcoded (no exact information yet)
0A B Countdown to a town expansion attempt. If bit 0 of the flags at 12 is set, then every +70 ticks if this counter is nonzero it is decremented, if it's zero an attempt to expand the town is taken.
0B B Index of the town in alphabetic ordering
0C W[2] X and Y position of the town name in absolute pixel coordinates
10 B Width of the town name in pixels, normal font
11 B Width of the town name in pixels, small font
12 W
bit 0 set:town can expand (updated monthly)
bit 1 set:town has a church
bit 2 set:town has a stadium
14 W[5] Squares of radii of 5 town zones. The first zone is where station activity contributes to growth of the town, other zones determine where roads are paved or have trees or streetlights. Most types of town buildings have restrictions as to which zones they may be built in. Zone radii are based on the total number of buildings in town. There's no point in changing them, as they're frequently updated by TTD.
1E W[8] Local Authority ratings for each company:
-1000..-400Appalling
-399..-200Very Poor
-199..0Poor
1..+200Mediocre
+201..+400Good
+401..+600Very Good
+601..+800Excellent
+801..+1000Outstanding
2E L Bit map of companies that do have a Local Authority rating.
[TTDPatch] Since only the lowest byte is actually used, older TTDPatch versions used the rest to store the information about a failed bribe attempt. Since TTDPatch 1.9.1 alpha 43.1 experimental, this information is stored in the extended town data in the extra chunks.
32 L Bit map of companies that have a statue in this town
36 W Number of buildings
(Note: this value may be higher than the actual number of buildings due to a bug in TTD, fixable via TTDPatch since 1.9.1 alpha 25)
39 B Town expansion inverse rate. If a town expansion attempt succeeds, the counter at 0A is set to this value.
3A W Maximum number of passengers that could be transported so far this month
3C W Maximum number of bags of mail that could be transported so far this month
3E W Actual number of passengers transported so far this month
40 W Actual number of bags of mail transported so far this month
42 W Maximum number of passengers that could be transported last month
44 W Maximum number of bags of mail that could be transported last month
46 W Actual number of passengers transported last month
48 W Actual number of bags of mail transported last month
4A B Fraction of passengers transported last month (FF means 100%)
4B B Fraction of mail transported last month (FF means 100%)
4C W Units of food (fizzy drinks in toyland) delivered to this town so far this month
4E W Units of water delivered to this town so far this month
(Note: in climates other than sub-tropical this is a bogus counter; it counts steel, paper, or bubbles)
50 W Units of food (fizzy drinks in toyland) delivered to this town last month
52 W Units of water delivered to this town last month (see the note under field 4E)
54 B If nonzero, road works are active in this town and will stop after this many months
55 B If nonzero, a building fund is active in this town and will expire after this many months
01C18 W[1388] A heap of schedule strings. Each schedule string consists of word-sized orders and is terminated with a zero word. For the meaning of bit fields in an order, consult the vehicle structure field 0A. Note that only type 1 orders are allowed in a schedule (TTDPatch allows type 2 as well). If a station or depot is deleted permanently, all orders that refer to it are reset to 0100.
04328 W[100] A list of XY indices of tiles on which some animation is taking place. 0000 indicates the end of list if the space is not full.
04528 L Pointer to the free space at the end of the schedule strings heap.
0452C [6][FF] Depot array (+255 entries), the structure of each entry is as follows:
    
OffsetSizeMeaning
00       W           XY of the depot, 00 if an empty slot
02 L Pointer to the town the depot is associated with
04B26 L Pointer to an entry in the town array that will be subject to periodic town processing on the next tick. After that processing, this pointer will point at the next entry in the town array (or at the first one if it previously pointed at the last one), thus towns' periodic processing is done in a round-robin fashion, with the full cycle taking +70 ticks.
04B2A W Incremented on every tick of the ~3.3ms system timer when the game is running, this counter is used to animate the palette.
04B2C W Landscape code, generated from the current time when a new game is created or the scenario editor is started.
04B2E W Decremented on every tick, when wraps around at zero the 'age' field of all cargo in vehicles is incremented, then this counter is reset to B8.
04B30 W Incremented on every tick, this counter is used to time various animations.
04B32 W XY index of the next tile to be processed by the periodic tile processing routine (which processes 256 tiles on each tick).
Locations 4B34..4C5A are various base costs subject to inflation. The notation L+W indicates that there is a 32-bit integer part followed by a 16-bit fractional part. The currency unit is a British pound.
04B34 L+W The base for various cost calculations, among others the property maintenance costs.
04B3A L+W The cost of building a piece of track
04B40 L+W The cost of building a piece of road
04B46 L+W The cost of placing signals
04B4C L+W The base unit cost of bridge building. The actual cost of building a bridge is a product of:
  • this value,
  • a function of bridge length,
  • a function of bridge type.
04B52 L+W The cost of building a railway depot
04B58 L+W The cost of building a road depot
04B5E L+W The cost of building a ship depot
04B64 L+W The base unit cost of tunnel building
04B6A L+W The cost of building a piece of platform at a railway station
04B70 L+W The additional cost of building each one platform at a railway station
04B76 L+W The cost of building one tile of airport or heliport
04B7C L+W The cost of building a bus station
04B82 L+W The cost of building a lorry loading area
04B88 L+W The cost of building a dock
04B8E L+W The base cost of a new rail engine
04B94 L+W The base cost of a new wagon
04B9A L+W The base cost of a new aircraft
04BA0 L+W The base cost of a new road vehicle
04BA6 L+W The base cost of a new ship
04BAC L+W The cost of planting a tree
04BB2 L+W The cost of raising or lowering one point of the landscape
04BB8 L+W The cost of clearing a tile of grass
04BBE L+W The cost of clearing a tile of rough land
04BC4 L+W The cost of clearing a tile of rocks
04BCA L+W The cost of clearing a tile of fields
04BD0 L+W The cost of removing one tree
04BD6 L+W The (usually negative) cost of removing a piece of track
04BDC L+W The cost of removing signals
04BE2 L+W The cost of removing a tile of bridge
04BE8 L+W The cost of removing a railway depot
04BEE L+W The cost of removing a road depot
04BF4 L+W The cost of removing a ship depot
04BFA L+W The unit cost of removing a tunnel
04C00 L+W The cost of clearing a tile of water
04C06 L+W The cost of removing one tile of railway station
04C0C L+W The cost of removing one tile of airport or heliport
04C12 L+W The cost of removing a bus station
04C18 L+W The cost of removing a lorry loading area
04C1E L+W The cost of removing a dock
04C24 L+W The base cost of removing a town building
04C2A L+W The cost of removing a piece of road
04C30 L+W The base running cost of steam engines
04C36 L+W The base running cost of diesel engines
04C3C L+W The base running cost of electric engines
04C42 L+W The base running cost of aircraft
04C48 L+W The base running cost of road vehicles
04C4E L+W The base running cost of ships
04C54 L+W The base cost for funding Local Authority actions and new industries
04C5A [8][C] Delivery payment factors for all +12 types of cargo. Each factor consists of a doubleword integer part, a word fractional part, and an unused 'filler' word.
04CBA B[10000] The 'L1' landscape array. For landscape classes other than 3, 7 and 8, it holds the owner of a tile. See the section "Landscape" for details.
14CBA B[10000] The 'L2' landscape array. The meaning depends on the class and type of a particular tile. See the section "Landscape" for details.
24CBA W[10000] The 'L3' landscape array. The meaning depends on the class and type of a particular tile. See the section "Landscape" for details.

TTDPatch saves some of its special data in this array, mostly at the end, in entries corresponding to the class 7 tiles that form the invisible border at the southeastern edge of the map (these bytes are initialized to zero by TTD and normally not changeable).

TTDPatch versions up to 2.0 beta 5 also stored data at the beginning of this array. Since those locations (corresponding to the northwestern edge tiles, which normally hold water in TTD) were proven to be unsafe (they can be overwritten in TTD), after 2.0 beta 5 some of the TTDPatch data have been relocated. The formats of the special data before and after the relocation are referred to as the 'old' and 'new' format, respectively.

The following table lists all the special locations defined by versions of TTDPatch up to 2.0. Locations described as "relocated" are from the old format. The addresses in the left column are offsets from the beginning of the file, not from the beginning of the 'L3' array.

  
TTDPatch special data in the L3 array
LocationSizeMeaning
24CBA    B           Vehicle array multiplier, equal to the setting of TTDPatch's 'morevehicles' switch, except that 00 is interpreted as 1 (the standard TTD format) and 01 is interpreted as 2.
24CBC W (relocated to 44CB8)
24CBE L (relocated to 44AC0)
24CC2 B (relocated to 44ACE)
24CC3 B (relocated to 44ACF)
24CC4 W (relocated to 44ACC)
24CC6 L (relocated to 44AC8)
24CCA B (relocated to 44ABF)
44ABA B Index of the last removed depot (used when 'gotodepot' is on, to make it possible to move a depot without messing up all schedules that contain an order referencing that depot)
44ABB B Vehicle class associated with the last removed depot, or 00 if the last removed depot information is not valid
44ABC W XY of the last removed depot
44ABE B Last railway class selected in the construction menu (0..2)
44ABF B Actual currency used when the 'morecurrencies' option is active, plus 1 (00 if not valid; in the old format at 24CCA)
44AC0 L[2] Bit map of sign cheats used in this game (in the old format at 24CBE)
44AC8 L Day offset, i.e. number of days 'pushed back' to keep the main date below year +2071 (in the old format at 24CC6)
44ACC W Year offset above +2070 if the 'eternalgame' option is used (in the old format at 24CC4)
44ACE B Original company of player 1, used for temporary management of other companies (in the old format at 24CC2)
44ACF B Original company of player 2, used for temporary management of other companies (in the old format at 24CC3)
44BBA B[4] (Reserved for TTDX Editor, not used by TTDPatch)
44CB4 B[4] If this field contains the byte string 54 54 44 70 (which is "TTDp" in ASCII), the savegame uses the new TTDPatch special data format.
44CB8 W Number of the extra chunks at the end of the savegame (in the old format at 24CBC)

- End of TTDPatch special data in the L3 array -

44CBA [4000] The map of rainforest/desert areas. Consists of 10000 2-bit entries (one for each tile); within a byte, the entries are allocated from the least to the most significant bits. The value of each entry means: 0 - normal area, 1 - desert area, 2 - rainforest area.
48CBA [8E][FA] Station array (+250 entries), locations within each entry follow:
    
OffsetSizeMeaning
00       W           XY of the station's origin, 00 if an empty slot
02 L Pointer to the town the station is associated with
06 W XY of the bus station, 00 if not present
08 W XY of the lorry loading area, 00 if not present
0A W XY of the north corner of the railway station, 00 if not present
0C W XY of the north corner of the airport/heliport, 00 if not present
0E W XY of the dock (the land part), 00 if not present
10 B Bits 0..2: number of tracks; bits 3..5: length of the railway station
11 B Index of the station in alphabetic ordering
12 B Width of the station name in pixels, normal font
13 B Width of the station name in pixels, small font
14 W Station name (text ID)
16 W[2] X and Y position of the station name in absolute pixel coordinates
1A W Station flags:
bit 0 set:all facilities of the station have been removed (i.e. the station is a 'grey sign' only)
bit 1 set:first train has already arrived at the station
bit 2 set:first bus has already arrived at the station
bit 3 set:first lorry has already arrived at the station
bit 4 set:first aircraft has already arrived at the station
bit 5 set:first ship has already arrived at the station
bit 6 set:station is a waypoint, i.e. does not catch cargo produced nearby (also ships don't stop there)
1C [8][C] Cargo information. +12 structures, one for each cargo type, as follows:
Offset Size Meaning
0 W
Bits 0..11:the amount of this cargo type at the station (maximum FFF)
Bits 12..15:total acceptance of this cargo type within the station's catchment area, in 1/8 units (so if the most significant bit is set the station accepts this cargo type), limited from above to F; updated periodically
2 B Time since this cargo type was last picked up from this station, in +185 ticks (~2.5 days) units
3 B Transport rating of this cargo type:
00 .. 1F  Appalling
20 .. 3F  Very Poor
40 .. 5F  Poor
60 .. 7F  Mediocre
80 .. 9F  Good
A0 .. BF  Very Good
C0 .. DF  Excellent
E0 .. FF  Outstanding
(value * 101.0) / 256.0 gives the rating in percent.
4 B Source of cargo (station index); if FF then this cargo type has not been rated yet at this station
5 B Time en-route, in +185 ticks (~2.5 days) units
6 B Maximum speed of the last vehicle that picked up this cargo type, as in the vehicle structure field 18 (halved if it was a road vehicle; limited from above to FF)
7 B Age of the last vehicle that picked up this cargo type (actually, difference between the year the vehicle had been built and the year the cargo was picked up)
The order of cargo types is:
Type Climate
Temperate  Sub-arctic Sub-tropical Toyland 
0 Passengers Passengers Passengers  Passengers 
1 Coal  Coal  Rubber  Sugar 
2 Mail  Mail  Mail  Mail 
3 Oil  Oil  Oil  Toys 
4 Livestock  Livestock  Fruit  Batteries 
5 Goods  Goods  Goods  Sweets (Candy)
6 Grain  Wheat  Maize  Toffee 
7 Wood  Wood  Wood  Cola 
8 Iron Ore Copper Ore Candyfloss (Cotton Candy)
9 Steel  Paper  Water  Bubbles 
A Valuables  Gold  Diamonds  Plastic 
B Food  Food  Fizzy Drinks
7C B Time since the last cargo load operation at this station, in +185 ticks (~2.5 days) units
7D B Time since the last cargo unload operation at this station, in +185 ticks (~2.5 days) units
7E B If bit 0 of the field 1A is clear, this field is incremented on every tick; when it reaches B9 it is reset to zero and the station cargo information is updated.
If bit 0 of the field 1A is set, this field is incremented every +250 ticks (see the variable at 770FA); when it reaches 08 the station is deleted permanently.
7F B Owner of the station
80 B A bit map of station components, bit set = facility present:
bit 0:railway station
bit 1:lorry loading area
bit 2:bus station
bit 3:airport or heliport
bit 4:dock
81 B Type of the airport, if any: 0 - small airport, 1 - large airport, 2 - heliport, 3 - oil rig
82 B Status of the lorry loading area:
bit 0 set:bay 1 free
bit 1 set:bay 2 free
bit 7 set:busy
83 B Status of the bus station, see field 82
84 B If nonzero, the station does not catch any cargo (due to exclusive transport rights having been bought in the area); the value is the number of months left for this effect to expire
86 W Status of the airport:
bit 0: set if pad 1 occupied
bit 1: set if pad 2 occupied
bit 2: set if pad 3 occupied (always set for small airports)
bit 6: set for heliports
bit 7: set if airport busy
bit 8: set for large airports
bit 9: (large airports only) set if out way busy
bit 10: (large airports only) set if in way busy
bit 11: (large airports only) set if runway busy
88 W Index of the last vehicle that visited this station
51766 [36][5A] Industry array (+90 entries), locations within each entry follow:
    
OffsetSizeMeaning
00       W           XY of the north corner of the industry, 00 if an empty slot
02 L Pointer to the town the industry is associated with
06 W XY dimensions of the industry
08 B[2] Types of cargo produced (-1 if N/A)
0A W[2] Amounts of cargo waiting to be distributed to nearby stations
0E B[2] Production rates (applies only to primary industries)
10 B[3] Types of cargo accepted (-1 if N/A)
13 B Production multiplier, always either 00 (which means the industry has announced imminent closure) or an integer power of 2. 10 is the default, 04 is the minimum, 80 is the maximum.
14 W[2] Amounts of cargo produced so far this month
18 W[2] Amounts of cargo transported so far this month
1C B[2] Fractions of cargo transported last month (FF means 100%)
1E W[2] Amounts of cargo produced last month
22 W[2] Amounts of cargo transported last month
26 B Industry type:
00  Coal mine
01  Power station
02  Sawmill
03  Forest
04  Oil refinery
05  Oil rig
06  Factory (temperate climate)
07  Printing works
08  Steel mill
09  Farm (temperate or sub-arctic)
0A  Copper ore mine
0B  Oil wells
0C  Bank (temperate)
0D  Food processing plant
0E  Paper mill
0F  Gold mine
10  Bank (sub-tropical or sub-arctic)
11  Diamond mine
12  Iron ore mine
13  Fruit plantation
14  Rubber plantation
15  Water supply
16  Water tower
17  Factory (sub-tropical)
18  Farm (sub-tropical)
19  Lumber mill
1A  Candyfloss forest
1B  Sweet factory
1C  Battery farm
1D  Cola wells
1E  Toy shop
1F  Toy factory
20  Plastic fountains
21  Fizzy drink factory
22  Bubble generator
23  Toffee quarry
24  Sugar mine
27 B Owner of the industry (apparently always 10)
28 B Colour of industry buildings that support variable colouring scheme
29 B The last year anything was produced (base +1920)
2A W Production counter, decremented on every tick, used for timing of primary industry production
2C B Set to 01 if the industry has accepted some cargo and produced something from it recently; in all other cases it's 00. Used for toy factory animations.
52A62 [3B2][8] Company array (8 entries), locations within each entry follow:
    
OffsetSizeMeaning
000      W           Company name (text ID), 00 if an empty slot
002 L Company name parts (for AI's randomly-generated names), bitcoded (no exact information yet)
006 L Manager's face, bitcoded (no exact information yet)
00A W Manager's name (text ID)
00C L Manager's name parts (for AI's randomly-generated names), bitcoded (no exact information yet)
010 L Current company's cash
014 L Current company's loan
018 B Company's colour scheme
019 B Fractional part of the current company's cash, used to increase the accuracy of vehicle running costs
01A B Number of quarters the company has been in debt
01B B AI companies: nonzero if the company is in trouble and seeking a take-over
Player companies: nonzero if the company has gone bankrupt
01C L Amount required to take over the company (if it is seeking a take-over)
020 W If field 01B is nonzero, 8 is subtracted each 8 ticks, and when the value becomes zero or negative, one of the following happens:
  • for AI companies: if field 01B is less than FE, a take-over proposal is issued to another company (field 01B determines which one; the algorithm is similar to exclusive vehicle testing offers)
  • for Player 1: game over
022 L Bit map of cargo types delivered in the current quarter
026 L[D][3] Three tables of expenses (negative values mean income), for this year, last year and a year before the last:
  Offset Type of expenses
00Construction
04New vehicles
08Train running costs
0CRoad vehicle running costs
10Aircraft running costs
14Ship running costs
18Property maintenance
1CTrain income
20Road vehicles income
24Aircraft income
28Ship income
2CLoan interest
30Other
0C2 L[5][19] Company's performance data for the current quarter and the previous 24 quarters:
  Offset Data
00Income
04Total of all vehicle running costs, property maintenance and loan interest. The operating profit is half of the sum of this value and income, with negative sign.
08Units of cargo delivered
0CPerformance score
10Company value
2B6 W The year the company was inaugurated (full value, not base-1920)
2B8 W XY index of the tile where this company did its most recent action
2BA B Number of previous quarters for which the company's performance data are valid
2BB B Current action of the AI company (valid values range from 00 to 17)
326 B Cargo type of the service the AI is currently building
3A1 B If nonzero, no vehicle testing exclusive offers are issued to this company for this number of quarters
3A3 B Number of railway types accessible to this company (1 - only conventional railway, 2 - railway and monorail, 3 - all)
3A4 W XY of the company headquarters, FFFF if not built
3A6 B[4] Indices of companies owning the four shares, FF if none
547F2 [80][352*x] Vehicle array (normally +850 entries; in TTDPatch, depends on the setting of the 'morevehicles' switch, shown as 'x' in the size column on the left; see also TTDPatch data in the L3 array.). Locations within each entry follow:
    
OffsetSizeMeaning
00       B           Class of the vehicle:
00  Empty slot
10  Railway vehicle
11  Road vehicle
12  Ship
13  Aircraft
14  Pseudo-vehicle (a special effect)
15  Special vehicle (disaster-related)
01 B Subclass of the vehicle:
  • Railway vehicles:
    00  Leading engine of a train
    02  Wagon or additional engine
    04  First in a wagon chain (in depot)
  • For road vehicles and ships, seems to be always 0
  • Aircraft:
    00  Helicopter
    02  Airplane
    04  Shadow (doubles as the mail compartment)
    06  Rotor
  • Pseudo-vehicles:
    00  Smoke from power station chimney
    02  Smoke puff from a steam engine
    04  Smoke puff from a diesel engine
    06  Spark from an electric engine
    08  Smoke puff from a broken down aircraft or copper ore mine chimney
    0A  Large fireball
    0C  Smoke from a broken down vehicle (other than aircraft)
    0E  Small fireball
    10  Road works vehicle (a yellow bulldozer)
    12  Bubble (from a bubble generator in toyland)
  • Special vehicles:
    00  Zeppelin
    01  Zeppelin's shadow
    02  Small UFO
    03  Small UFO's shadow
    04  Military airplane
    05  Military airplane's shadow
    06  Military helicopter
    07  Military helicopter's shadow
    08  Military helicopter's rotor
    09  Large UFO
    0A  Large UFO's shadow
    0B  X-COM aircraft
    0C  X-COM aircraft's shadow
    0D  Small submarine
    0E  Large submarine
02 W Index of the next in a list of vehicles sharing a bounding block (see location 72F72), FFFF if none
04 W Index of this vehicle in the vehicle array
06 L Pointer to the schedule string (see location 01C18), FFFFFFFF if N/A
0A W The currently active order. Bits 0..4 determine the type of the order:
00  No orders
01  Go to station: station index in the upper byte;
bit 5 set = unload;
bit 6 set = full load;
bit 7 set = non-stop
02  Go to depot: depot index in the upper byte;
bit 6 set = manually sent;
bit 7 always set;
[TTDPatch] bit 5 set = scheduled; then: bit 6 set = only after the servicing interval has expired
03  Loading/unloading;
bit 6 set = full load;
bit 7 set = scheduled
04  Finished loading/unloading; all the other bits are 0 (apparently not used for aircraft)
0C B Number of orders in the schedule
0D B Index of the current order in the schedule
0E W Target of the vehicle:
for rail vehicles, road vehicles and ships: the XY of the current target, FFFF if none
for aircraft seems to be unused
10 W Time (in ticks) remaining to complete the current load/unload operation;
also used for class-specific purposes
12 W Date of the last service (in days since 1920-1-1)
14 W Servicing interval in days
16 B Index of the last station visited, FF if N/A
17 B Cycle counter, incremented every time the vehicle is processed (aircraft are processed 6 times per tick, other vehicles are processed once per tick)
18 W Maximum speed of the vehicle. The unit is:
  • for trains: mph/1.6 (note: this is almost, but not quite, km/h)
  • for road vehicles and ships: mph/3.2
  • for aircraft: mph*8
1A W The X location
1C W The Y location
1E B The Z location (altitude)
1F B Direction: 00=N, 01=NE, 02=E, 03=SE, 04=S, 05=SW, 06=W, 07=NW
20 B Signed value added to the X location to obtain the base X of the vehicle's bounding box
21 B Signed value added to the Y location to obtain the base Y of the vehicle's bounding box
22 B[3] X, Y and Z extents of the vehicle's bounding box (the notional three-dimensional box around the vehicle in the landscape)
25 B Owner of the vehicle
26 W XY index of the vehicle's location
28 W Current sprite
2A W[4] Vehicle's sprite box. 4 absolute pixel coordinates, in the following order: left, right, top, bottom.
Warning: Don't mess with these values unless you really know what you're doing. See also the location 72F72.
32 W
bit 0 set:invisible (in tunnel or depot)
bit 1 set:stopped
bit 3 set:has owner's colour scheme
bit 5 set:transparent
bit 7 set:crashed
34 W Current speed, see field 18 for the unit (exception: for aircraft not in flight TTDPatch takes mph/0.8 as the unit, although it's for the display only)
36 B Fractional part of the current speed
37 B Acceleration
Note: Except for aircraft, there's little point in changing this value as it is either unused or updated frequently.
38 B On each round of vehicle processing, if the vehicle is not stopped, the low byte of current speed (or 3/4 of the current speed, if bit 0 of vehicle direction is clear) is subtracted from this field; if the result overflows the vehicle is to move by 1 unit of location (for trains, the vehicle additionally is to move by the number of units equal to the high byte of the current speed)
39 B Cargo type
3A W Cargo capacity
3C W Current cargo load
3E B Source of the current cargo, if any (station index)
3F B Cargo transit time, in +185 ticks (~2.5 days) units
40 W Age of the vehicle in days
42 W Maximum age of the vehicle in days
44 B Year the vehicle was built (00 means +1920)
45 B Ordinal number of train, road vehicle, ship or aircraft as shown in the vehicle list
46 W Vehicle type ID
48 B Class-specific offset to a sprite set for this vehicle
49 B Incremented daily, when the low 3 bits are zero (i.e. every 8 days) vehicle's value is reduced by 1/256
4A B Number of breakdowns since the last service
4B B 1 when broken down; >1 when breaking down (a countdown value)
4C B Time (in ticks) until the end of a breakdown
4D B Breakdown threshold. Incremented daily unless the vehicle is stopped, moving very slowly (i.e. field 34 is less than 5), or broken down; occasionally 19 is added as well; the top limit is always FF. When it reaches some value that depends on the current reliability, vehicle class and the 'breakdowns' difficulty setting, a breakdown is initiated and this field is reset to 0.
4E W Current reliability, FFFF means 100%
50 W The rate at which the reliability decreases (value subtracted each day from the current reliability)
52 L Profit this year
56 L Profit last year
5A W Index of the next vehicle in the consist, FFFF if none
5C L Current value of the vehicle
60 W Name of the vehicle (text ID). Default names (with <number> stored in field 45) are:
  • 8864 = Train <number>
  • 902B = Road Vehicle <number>
  • 9830 = Ship <number>
  • A02F = Aircraft <number>
62 B Current vehicle's movement state, class-specific:
  • trains and ships:
    bits 0..5 correspond to track layout in L5 entries for regular track, see Class 1 (only one bit can be set at a time);
    40 - in tunnel, 80 - in depot
  • road vehicles:
    • 00..0F: direction of travel:
      00: NE
      01: SE
      02: SE, turning left
      03: NE, turning right
      04: SE, turning right
      05: SW, turning left
      06: NE, turning back
      07: SE, turning back
      08: SW
      09: NW
      0A: SW, turning right
      0B: NW, turning left
      0C: NE, turning left
      0D: NW, turning right
      0E: SW, turning back
      0F: NW, turning back
    • 20..2F: in a station
      bits 3..0 = sum of direction of travel at entrance (possible values are 00, 01, 08 and 09, see above) and number of the bay the vehicle is using (00 = bay 1, 02 = bay 2)
    • FE: in depot
    • FF: in tunnel
  • aircraft: [note: the exact semantics are still somewhat uncertain]
    00: entering hangar
    01: going to hangar entrance point
    02..04: going to pad 1..3, respectively
    05: going to pad 2 / pad 3 common entry point
    06: going to pad 2 / pad 3 / hangar common entry point (large airports only)
    07: going to airport's junction point (this is the location where helicopters land and take off)
    08: leaving runway
    09: going to the in way
    0A: entering runway
    0B: going to the out way
    0C: airplane waiting for take-off clearance (?)
    0D: airplane taking off
    0E: airplane preparing to take-off
    0F: airplane climbing after take-off
    10..14: in flight
    10 - final approach before landing or going for another round
    12 - heading for tower contact point (where airplanes initiate their approach)
    14 - heading for the final approach entry point
    15: airplane landing (descent)
    16: airplane braking after touchdown
    17: helicopter taking off from airport
    18: helicopter preparing to land at airport
    19: helicopter landing at airport
    1A: helicopter taking off from heliport
    1B: helicopter preparing to land at heliport
    1C: helicopter landing at heliport
63 B For aircraft: the airport to which the current movement action refers
64 W For road vehicles: if the vehicle is blocked by another one, counts for how long; override when >05C8(?)
66 B For rail vehicles: railway type: 0 - 'conventional' railroad, 1 - monorail, 2 - maglev
For road vehicles: normally 00, set to 10 when overtaking another road vehicle
For aircraft: current movement action:
00: in hangar
01..03: on pad 1..3, respectively
04..06: leaving hangar and heading for pad 1..3, respectively
07..09: landing and heading for pad 1..3, respectively
0A..0C: leaving pad 1..3, respectively, and heading for hangar
0D..0F: leaving pad 1..3, respectively, and taking off
10: leaving hangar and taking off
11: landing and heading for hangar
12: in flight
67 B For road vehicles: overtaking progress counter. Incremented with every vehicle's movement step while field 66 is nonzero; the initial value is 11 if the vehicle being overtaken is stopped (i.e. its field 34 is zero or field 32 bit 1 is set), otherwise 00; when this value reaches 23, field 66 is cleared (overtaking progress may start again immediately if the conditions for overtaking are fulfilled).
68 W For road vehicles: (?) used to count the 'progress' of vehicle's crash; incremented on every tick if nonzero; when reaches 08AC the vehicle is deleted
6A B ? (nonzero = road vehicle collision detection disabled; decremented every tick until zero) [more info needed]
73 B [TTDPatch] how much shorter the wagon is
74 L [TTDPatch] real train power (taking multiple engines into account)
78 W [TTDPatch] With realistic acceleration: negated total weight of the vehicle, including cargo; without realistic acceleration: full acceleration value
7A B [TTDPatch] random bits, changed according to new sprite data
7B B [TTDPatch] which random triggers occurred so far, bitcoded
7C W [TTDPatch] Index of the 'engine' (i.e. the first vehicle) of the consist
7E B [TTDPatch] Flags used for gradual loading
7F B [TTDPatch] Last speed shown in the vehicle window status bar

Since the vehicle array has variable length, all the following data have variable locations. The "+X" suffix indicates that the location is given assuming the standard size of the vehicle array; if x is the vehicle array multiplier, then X = ((x-1)*0x1A900).

6F0F2+X B[20][1F4] Array of custom strings. Each string takes up exactly +32 bytes, including the terminating zero byte and possible trailing garbage.
72F72+X W[1000] Array of lists of vehicles in bounding blocks. Each entry is an index of the first vehicle in a list, or FFFF if there are no vehicles in this block.

Don't mess with this array unless you really know what you're doing. If you create an inconsistent state TTD is very likely to crash sooner or later.

If X1 and Y1 are left and top pixel coordinates of a vehicle's sprite box, that vehicle belongs to a bounding block, the offset of which in this array is (C notation)

((X1 & 0x1F80) << 6) | ((Y1 & 0xFC0) >> 1)

(that is, sprite boxes with the same values in bits 12..7 of X1 and bits 11..6 of Y1 belong to the same bounding block). Vehicles in a bounding block form a list linked via the vehicle structure field 02. This feature speeds up screen updates and collision detection.

74F72+X [E][28] Array of signs (+40 entries), locations within each entry follow:
    
OffsetSizeMeaning
0        W           Sign text (text ID), 00 if an empty slot
2 W The X location
4 W The Y location
6 B The Z location
8 B Width of the sign text in pixels, normal font
9 B Width of the sign text in pixels, small font
A W[2] X and Y pixel coordinates of the sign
751A2+X [1C][100] Array of vehicle types (+256 entries), locations within each entry follow:
    
OffsetSizeMeaning
00       W           Bit map of companies that can buy vehicles of this type
02 W Date of the introduction
04 W Age of this vehicle type (months since the introduction)
06 W Reliability of new vehicles of this type
08 W The rate at which the reliability decreases (see the vehicle structure field 50)
0A W Initial reliability after the introduction
0C W Maximum reliability
0E W Final reliability
10 W Duration of phase 1 in months. In this phase, vehicle type's reliability rises from the initial to the maximum value.
12 W Duration of phase 2 in months. In this phase, vehicle type's reliability stays at the maximum value.
14 W Duration of phase 3 in months. In this phase, vehicle type's reliability drops from the maximum to the final value, then the vehicle disappears from the market.
16 B Life span of vehicles of this type in years
17 B
bit 0 set:is or was available on the market
bit 1 set:in testing phase (may be available exclusively to one company)
bit 2 set:exclusive testing offer for a human player active
18 B FF: Vehicle type exclusively available to one company, or the offer expired because no company qualified.
Nonzero and not FF: If field 17 bit 1 is set and bit 2 is clear, after the end of the day this vehicle type is offered to this company, in highest performance first order, excluding companies that have a nonzero value in their field 3A1. If it is a human player's company, bit 2 in the field 17 above is set and an offer window appears. If it is an AI company and it's low on cash, this field is incremented so that the next company is checked the next day; otherwise, this vehicle type is made exclusively available to this company.
19 B Number of days for the exclusive testing offer issued to a player to expire
1A B Railway type: 0 - 'conventional' railroad, 1 - monorail, 2 - maglev (must be 0 for non-railway vehicle types)
76DA2+X W Index of the next vehicle array entry to be processed by the daily vehicle processing routine (which processes +12*x vehicles on each tick).
76DA4+X [4][8] Array of subsidies (8 entries), the structure of each entry is as follows:
    
OffsetSizeMeaning
0        B           Cargo type, FF if an empty slot
1 B 0 through +11: subsidy offer, has been active for this many months
+12 through +23: service already subsidised; number of months since it has been awarded plus +12
2 B Cargo source:
subsidy offers: town index if cargo type is 0 (passengers) or 2 (mail), industry index otherwise
subsidized services: station index
3 B Cargo destination:
subsidy offers: town index if cargo type is 0 (passengers), 2 (mail), 5 (goods or sweets) or +11 (food or fizzy drinks), industry index otherwise
subsidized services: station index
76DC4+X W Ticks remaining to the next attempt at launching a new AI company
76DC6+X W[2] Pixel X and Y coordinates of the left top corner of the main view
76DCA+X W Zoom level of the main view: 0 = normal, 1 = intermediate, 2 = most zoomed out
76DCC+X L Maximum permitted loan size (in British pounds). Always an integer multiple of +50000; changes with inflation.
76DD0+X L 'Internal' value of the maximum permitted loan size, used to update the actual value (see above) according to the inflation
76DD4+X W Recession counter, decremented monthly. If less than or equal to 0 a world recession is in effect; when reaches -12 (FFF4) the recession is over and this counter is reset to a random value between 138 and 237.
76DD6+X W Days to the next disaster
76DD8+X W[C] Names (text IDs) of cargo types
76DF0+X W[C] Names (text IDs) of units of cargo
76E08+X W[C] Text IDs for 1 unit of cargo
76E20+X W[C] Text IDs for more than 1 unit of cargo
76E38+X W[C] Text IDs for cargo type name abbreviations
76E50+X W[C] Cargo type icons (displayed in station windows)
76E68+X W[100] Names (text IDs) of all the +256 vehicle types
77068+X [90] Table of vehicles the AI will use to transport different cargo types:
Offset Size Meaning
00 W[C] Vehicle types of railroad wagons, one for each cargo type
18 W[C] Vehicle types of monorail wagons, one for each cargo type
30 W[C] Vehicle types of maglev wagons, one for each cargo type
48 W[C] First road vehicle type for each cargo type
60 B[C] Number of road vehicle types following the first type, for each cargo type (may include vehicles not available in the current climate)
6C W[C] First ship type for each cargo type
84 B[C] Number of ship types following the first type, for each cargo type (may include vehicles not available in the current climate; may be 0, indicating that there are no ship types to carry this cargo type)
770F8+X B Company index of the player 1 (10 if there is no player 1, i.e. in the scenario editor)
770F9+X B Company index of the player 2, i.e. the remote player in a two-player game (FF in single-player game)
770FA+X B Index of the next station that will be subject to the periodic status update on the next tick
770FB+X B Player's currency unit: 0 = British pound, 1 = dollar, 2 = French franc, 3 = Deutschmark, 4 = yen, 5 = peseta
(Note: internally everything is calculated in pounds)
770FC+X B Player's measurement system: 0 = imperial, 1 = metric
770FD+X B Index of the next company that will be subject to the periodic status update on the next tick
770FE+X B Current year (offset from +1920)
770FF+X B Current month (0 = January, 1 = February etc.)
77100+X B[8] Colour schemes of all the 8 possible companies
77108+X B Yearly inflation rate for all prices except cargo payments, in percent
77109+X B Yearly inflation rate for cargo payments, in percent
7710A+X B Yearly loan interest rate in percent
7710B+X B bit 0 set: small airports available for building
bit 1 set: large airports available for building
bit 2 set: heliports available for building
7710C+X B Side of road for vehicles to drive on:
bit 4: clear = left, set = right
bit 7 clear: cannot be changed by the player
7710D+X B Style of town names: 0 = English, 1 = French, 2 = German, 3 = American, 4 = Latin-American, 5 = Silly
7710E+X W Maximum number of AI competitors
77110+X W Competitor start time in quarters (relevant only at the game start)
77112+X W Number of towns: 0 = low, 1 = medium, 2 = high (relevant only at the game start)
77114+X W Number of industries: 0 = low, 1 = medium, 2 = high (relevant only at the game start)
77116+X W Maximum initial loan in thousand pounds (relevant only at the game start, obviously)
77118+X W Initial interest rate in percent (relevant only at the game start, obviously)
7711A+X W Vehicle running costs: 0 = low, 1 = medium, 2 = high (relevant only at the game start, non-obviously)
7711C+X W Construction speed of the AI: 0 = very slow, 1 = slow, 2 = medium, 3 = fast, 4 = very fast
7711E+X W 'Intelligence' of the AI: 0 = low, 1 = medium, 2 = high
77120+X W Vehicle breakdowns: 0 = none, 1 = reduced, 2 = normal
77122+X W Subsidy multiplier: 0 = 1.5x, 1 = 2x, 2 = 3x, 3 = 4x
77124+X W Costs of construction: 0 = low, 1 = medium, 2 = high (relevant only at the game start)
77126+X W Terrain type: 0 = very flat, 1 = flat, 2 = hilly, 3 = mountainous (relevant only at the game start or in the scenario editor, obviously)
77128+X W Quantity of sea/lakes: 0 = low, 1 = medium, 2 = high (relevant only at the game start or in the scenario editor, obviously)
7712A+X W Economy: 0 = stable, 1 = fluctuating
7712C+X W Train reversing: 0 = at end of line and at stations, 1 = at end of line only
7712E+X W Disasters: 0 = off, 1 = on
77130+X B Difficulty level: 0 = easy, 1 = medium, 2 = hard, 3 = custom
77131+X B Landscape style, a.k.a. climate: 0 = temperate, 1 = sub-arctic, 2 = sub-tropical, 3 = toyland
77132+X B Decremented on every tick, when wraps around (i.e. every +256 ticks) TTD tries to plant a new tree on a randomly chosen tile (which succeeds only if that tile is bare land, grass, rough land or snow-covered land)
77133+X B Names of vehicle types:
bit 0: clear = default, set = custom
bit 1 clear: cannot be changed in the options window (no custom names defined yet)
77134+X B Altitude of the snow line in the sub-arctic climate
77135+X B[20] List of random industry types. Occasionally at the start of a new month TTD picks a type from this list at random and attempts to build a new industry of this type.
77155+X B[C] Weights of 1 unit of each cargo type; 10 = 1 tonne
77161+X B[C] First transit time thresholds for each cargo type
7716D+X B[C] Second transit time thresholds for each cargo type

If n units of cargo are delivered over a distance of dist tiles in t units of time (a unit of time is +185 ticks, or ca. 2.5 days), then the payment is calculated as (C notation)

((((dist/2) * timefactor * n) >> 7) * cargopricefactor) >> 13

where cargopricefactor is taken from the table at 04C5A, and timefactor is calculated as (C notation again)

if (t <= T1) timefactor = 255;
  else if (t <= (T1 + T2)) timefactor = 255 - (t - T1);
  else timefactor = 255 - (t - T1) - (t - T1 - T2);

if (timefactor < 31) timefactor = 31;

where T1 and T2 are the transit time thresholds for this cargo type. As a special case, there's no payment for transporting valuables over less than +10 tiles.

77179+X B[10000] The 'L4' landscape array. This holds the class of each tile in bits 7..4, and the height of the north corner in bits 3..0. See the section "Landscape" for the list of classes and other details.
87179+X B[10000] The 'L5' landscape array. The meaning depends on the class of the tile. See the section "Landscape" for details.
97179+X variable [TTDPatch] Extra chunks of data, if any. The total number of extra chunks is stored at location 44CB8.

Each chunk consists of a 6-byte header followed by variable-size contents.

TTDPatch extra chunk header format
Offset Size Meaning
0 W Unique chunk type identifier. As of TTDPatch 2.0 the following chunk identifiers are defined:
0000   TTD vehicle type data (cost multipliers, default maximum speeds, default cargo capacities, sprite sets etc.)
0001  TTDPatch additional vehicle type data (e.g. powers and weights of road vehicles)
0002  List of GRFIDs, i.e. identifiers of extra .GRF files (loaded by TTDPatch) used in the savegame
0003  TTDPatch version and configuration (the format is version-specific)
8000  Extended town data
If bit 15 of the chunk identifier is clear, the chunk is optional, i.e. it is possible to play the game without loading it. If bit 15 is set, the chunk is mandatory, i.e. it contains data required for the game to work.
2 L Length of the chunk contents after the header, in bytes

The extra chunks were introduced in TTDPatch version 1.9.1 alpha 32.


Landscape

Five arrays are used to encode the information of the contents of each tile. These arrays are referred to as L1, L2, L3, L4 and L5. The known encodings are listed in the table below. The most important value is the class of a tile, stored in the upper 4 bits of the L4 array.

Owner values 00 through 07 are companies (they're indices into the array of companies), 10 is no owner, 11 appears to be reserved for water, 80 and above are towns (in this case the low 7 bits contain an index into the town array).

TTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.

ClassMeaning & details of encoding
0
  • L5 bits 4..0: tile type:
    00  bare land
    01  1/3 grass
    02  2/3 grass
    03  full grass
    07  rough land
    0B  rocks
    0F  fields; type of fields in L3 bits 3..0 (legal values: 0 through 9)
    10  1/4 snow
    11  2/4 snow
    12  3/4 snow
    13  full snow
    15  partial desert
    17  full desert
  • L5 bits 7..5: update counter, incremented on every periodic processing for tile types other than 03, 07, 0B and 10 and above, on wraparound the tile is updated (for fields, the type of fields in L3 is increased, for other types the tile type in L5 is increased)
    (for snow and desert, these bits are not used, tile is updated on every periodic processing)
  • L1: owner of the tile (normally 10)
  • L3 bits 15..13: type of hedge on the SW border of the tile (1 through 6, or 0=none); bits 12..10: same for the SE border
1 L5 bit 7 clear: railway track
  • L5 bits 0..5: track layout: bit set = track present:
    bit 0: in the X direction
    bit 1: in the Y direction
    bit 2: in the north corner (direction W-E)
    bit 3: in the south corner (direction W-E)
    bit 4: in the west corner (direction N-S)
    bit 5: in the east corner (direction N-S)
  • L5 bit 6 set = with signals:
    • L3 bits 7..4: bit set = signal present:
      • For track in the X direction:
        bit 6: signal in the SW direction
        bit 7: signal in the NE direction
      • For track in the Y direction:
        bit 6: signal in the NW direction
        bit 7: signal in the SE direction
      • For tracks in the W-E direction:
        bit 4: signal in the W direction on the track in the S corner
        bit 5: signal in the E direction on the track in the S corner
        bit 6: signal in the W direction on the track in the N corner
        bit 7: signal in the E direction on the track in the N corner
      • For tracks in the N-S direction:
        bit 4: signal in the S direction on the track in the E corner
        bit 5: signal in the N direction on the track in the E corner
        bit 6: signal in the S direction on the track in the W corner
        bit 7: signal in the N direction on the track in the W corner
    • L2 bits 7..4: bit clear = signal shows red; same bits as in L3
    • TTDPatch bits in L3:
      bit 8: set if pre-signal bits are valid (used for automatic pre-signal setups)
      bit 9: set for pre-signals and combo signals
      bit 10: set for exit signals and combo signals
      bit 11: set = semaphore signals, clear = light signals
      bit 15: set = manual pre-signal setup
  • L1: owner of the track
  • L2 bits 0..3:
    0  on bare land
    1  on grass, no fences
    2  fence on the NW side
    3  fence on the SE side
    4  fences on the NW and SE sides
    5  fence on the NE side
    6  fence on the SW side
    7  fences on the NE and SW sides
    8  fence on the E side (track in the W corner)
    9  fence on the W side (track in the E corner)
    A  fence on the S side (track in the N corner)
    B  fence on the N side (track in the S corner)
    C  on snow or desert
  • L3 bits 0..3 = track type: 0 - conventional railway, 1 - monorail, 2 - maglev
L5 bits 7 and 6 set: railway depot
  • L5 bits 5..0 - direction: exit towards: 00 = NE, 01 = SE, 02 = SW, 03 = NW
  • L1: owner of the depot
  • L3 bits 0..3 = track type
2 L5 bits 7..4 clear: road
  • L5 bits 3..0: road layout: bit set = road piece present:
    bit 0: NW piece
    bit 1: SW piece
    bit 2: SE piece
    bit 3: NE piece
  • L1: owner of the road
  • L2 bits 0..2: 0 - on bare land, 1 - on grass, 2 - paved, 3 - with streetlights, 5 - tree-lined, 6 - on grass with road works, 7 - paved with road works
  • L3 bit 15 set = on snow or desert
L5 bit 4 set, bits 7..5 clear: level crossing
  • L5 bit 3: clear - road in the X direction, set - road in the Y direction (railway track always perpendicular)
  • L5 bit 2: set if crossing lights are on
  • L1: owner of the railway track
  • L2 bits 0..2: 0 - on bare land, 1 - on grass, 2 or higher - paved
  • L3 bits 0..7: owner of the road
  • L3 bits 11..8: track type
  • L3 bit 15 set = on snow or desert
L5 bit 5 set: road depot
  • L5 bits 3..0 - direction: exit towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
  • L1: owner of the depot
  • L3 bit 15 set = on snow or desert (not displayed, but set internally)
3 Town building
  • L2: town building type:

    Note: In the climate list, 'sub-arctic' means below the snow line, and 'snow' means above the snow line in the sub-arctic climate.

    Type Size Climates Description
    00  1×1temperatetall office block
    01  1×1temperateoffice block
    02  1×1temperatesmall block of flats
    03  1×1temperatechurch
    04  1×1temperate, sub-arctic, sub-tropicallarge office block
    05  1×1snowlarge office block
    06  1×1temperatetown houses
    07..08  1×2temperatehotel
    09  1×1temperate, sub-arctic, sub-tropical  statue
    0A  1×1temperate, sub-arctic, sub-tropicalfountain
    0B  1×1temperatepark (with a pond)
    0C  1×1temperatepark (with an alley)
    0D  1×1temperateoffice block
    0E..10  1×1temperatevarious types of shops and offices
    11  1×1temperate, sub-arctic, sub-tropicalmodern office building
    12  1×1temperatewarehouse
    13  1×1temperateoffice block (with spiral stairway on the side)
    14..17  2×2temperatestadium
    18  1×1temperateold houses
    19  1×1temperatecottages
    1A  1×1temperatehouses
    1B  1×1temperateflats
    1C  1×1temperatetall office block
    1D  1×1temperateshops and offices
    1E  1×1temperate, sub-tropicalshops and offices
    1F  1×1temperatetheatre
    20..23  2×2temperate, sub-arctic, sub-tropicalstadium (modern style)
    24  1×1temperate, sub-arctic, sub-tropicaloffices (the modern 'vertical tube' style)
    25  1×1sub-arctichouses
    26  1×1snowhouses
    27  1×1temperatecinema
    28..2B  2×2temperateshopping mall
    2C  1×1sub-arcticflats
    2D  1×1snowflats
    2E  1×1sub-arctichouses
    2F  1×1snowhouses
    30  1×1sub-arctichouses
    31  1×1snowhouses
    32  1×1sub-arctic, sub-tropicaltall office block
    33  1×1snowtall office block
    34  1×1sub-arctictall office block
    35  1×1snowtall office block
    36  1×1sub-arctic, sub-tropicaltall office block
    37  1×1snowtall office block
    38  1×1sub-arctichouses
    39  1×1snowhouses
    3A  1×1sub-arcticshops and offices
    3B  1×1snowshops and offices
    3C  1×1sub-arcticchurch
    3D  1×1snowchurch
    3E  1×1sub-arctichouses
    3F  1×1snowhouses
    40  1×1sub-arcticshops and offices
    41  1×1snowshops and offices
    42..43  1×2sub-arctichotel
    44..45  1×2snowhotel
    46  1×1sub-arctic, sub-tropicalshops and offices
    47  1×1snowshops and offices
    48  1×1sub-arctictall office block
    49  1×1snowtall office block
    4A..4B  2×1sub-arctictall office block
    4C..4D  2×1snowtall office block
    4E  1×1sub-tropicalhouses (with a tree in a corner)
    4F, 50  1×1sub-tropicalhouses
    51  1×1sub-tropicalhouses (suburb-type)
    52  1×1sub-tropicalflats
    53  1×1sub-tropicalchurch
    54  1×1sub-tropicalhouses (with two trees in front)
    55, 56  1×1sub-tropicalflats
    57..58  2×1sub-tropicaltall office block
    59  1×1sub-tropicalflats
    5A  1×1sub-tropicaltall office block
    5B  1×1toylandchurch
    5C..61  1×1toylandvarious types of toyland houses
    62  1×1toylandtall office block
    63..64  1×2toylandhouses ('shoe' style)
    65  1×1toylandtall office block
    66  1×1toylandigloo
    67  1×1toylandtepees
    68, 69  1×1toylandshops and offices
    6A  1×1toylandtall office block
    6B  1×1toylandstatue
    6C  1×1toylandteapot-house
    6D  1×1toylandpiggy-bank
  • L3 bits 7..6: stage of construction (3 = completed)
  • L5 bits 2..0: construction counter, for buildings under construction incremented on every periodic tile processing, on wraparound the stage of construction in L3 is increased
  • for large office blocks (types 04 and 05):
    • L1 bits 6..0: position of the lift
    • L1 bit 7: if set the lift is moving
    • L5 bit 7: if set then L5 bits 5..0 hold the final position of the lift divided by 6 (valid values 0..6 except 1)
4 Trees
  • L5 bits 7..6: number of trees minus one
  • L5 bits 2..0: growth status: 0..2 - one of trees is growing, 3 - all trees are fully grown, 4..6 - one of trees is withering
  • L3 bits 7..0: type of trees:
    00..0B  temperate climate trees
    0C..13  sub-arctic climate trees
    14..1A  rainforest trees
    1B cactus plants
    1C..1F  sub-tropical climate, non-rainforest, non-desert trees
    20..28  toyland trees
    (note: the actually displayed set of trees depends on both type and number of trees)
  • L3 bits 15..13: type of hedge on the SW border of the tile (1 through 6, or 0=none)
  • L3 bits 12..10: type of hedge on the SE border of the tile (1 through 6, or 0=none)
  • L2 bits 5..4:
    0  on grass
    1  on rough land
    2  on snow or desert; L2 bits 7..6 - amount of snow or desert (for desert always set to 3 in TTD)
  • L2 bits 3..0: update counter, incremented on every periodic processing, on wraparound the growth status is updated (or, if it's 3, a random action is taken)
  • L1: owner (normally 10)
5 Station tile
  • L5: tile type:
    00..07  railway station
    00..01 - open platform, 02..03 - open platform with station building, 04....07 - roofed platform
    bit 0: clear = in X direction, set = in Y direction
    08..33  large airport
    0B  pad 1
    16..19  runway middle
    1A  runway ending
    1C  control tower
    20  hangar
    21  pad 3
    22  pad 2
    27..32  radar (animated)
    33  transmitter
    The initial layout of a large airport is (rows in Y direction, columns in X direction):
    1F 1B 1E 33 26 1A
    09 24 0B 0C 0D 16
    21 1D 23 0E 0F 17
    09 22 0D 11 10 18
    09 08 14 13 12 19
    20 0A 15 1C 27 1A
    
    34..41  small airport
    3A..3D  field with the wind meter (animated)
    3E  runway south ending
    3F  runway middle
    40  runway north ending
    41  hangar
    The initial layout of a small airport is (rows in Y direction, columns in X direction):
    36 3A 40
    35 39 3F
    34 38 3F
    41 37 3E
    
    42 heliport
    43..46  lorry loading area; exit towards: 43 - NE, 44 - SE, 45 - SW, 46 - NW
    47..4A  bus station; exit towards: 47 - NE, 48 - SE, 49 - SW, 4A - NW
    4B oilfield
    4C..51  ship dock; 4C - SW coast part, 4D - NW coast part, 4E - NE coast part, 4F - SE coast part, 50 - X direction water part, 51 - Y direction water part
    52 buoy
  • L1: owner of the station
  • L2: index into the array of stations
  • L3 bits 0..3: track type for railway stations, must be 0 for all the other stations
6
  • L5: tile type:
    00  water
    01  coast or riverbank
    80  ship depot, NE part (X direction)
    81  ship depot, SW part (X direction)
    82  ship depot, NW part (Y direction)
    83  ship depot, SE part (Y direction)
  • L1: owner (for water and coasts normally 11)
7 Void

Tiles of this class form an invisible, one tile wide border at the south (bottom) edges of the map, so as to protect several algorithms from the consequences of a wraparound at the edges.

8 Industry tile
  • L5: type:
    (note: this is not the same as the industry type stored in the array of industries)
    00..06  coal mine
    00  wheel tower when not animated
    01  wheel tower when animated; animation state in L1 bits 5..0; L1 bit 6 set = sound already generated
    07..0A  power station
    08  chimney
    0A  transformer; animation progress in L1 bits 5..2 (valid range 0..7)
    0B..0F  sawmill
    10..11  forest
    11  trees cut down
    12..17  oil refinery
    18..1C  oil rig
    1D..20  oil wells
    1D  not animated
    1E..20  various stages of animation; progress of animation in L1 bits 1..0
    21..26  farm
    27..2A  factory (temperate climate)
    2B..2E  printing works
    2F..33  copper ore mine
    2F  wheel tower when not animated
    30  wheel tower when animated; animation state in L1 bits 5..0; L1 bit 6 set = sound already generated
    31  chimney
    34..39  steel mill
    3A..3B  bank (temperate climate)
    3C..3F  food processing plant
    40..47  paper mill
    48..58  gold mine
    4F  wheel tower when not animated
    58  wheel tower when animated; animation state in L1 bits 5..0; L1 bit 6 set = sound already generated
    59..5A  bank (sub-arctic or sub-tropical climate)
    5B..63  diamond mine
    64..73  iron ore mine
    74fruit plantation
    75rubber plantation
    76..77  water supply
    78water tower
    79..7C  factory (sub-tropical climate)
    7D..80  lumber mill
    81..82  candyfloss forest
    82  candyfloss 'trees' cut down
    83..86  sweet factory
    87..88  battery farm
    88  batteries 'reaped'
    89cola wells
    8A..8D  toy shop
    8E..93  toy factory
    8F  animated part; animation state in the low byte of L3 (valid range 00..31)
    tile animation is started (the high byte of L3 zeroed) on the periodic processing if field 2C in the corresponding industry array entry is nonzero
    while the animation is in progress (see the array at 04328) the high byte of L3 holds the number of animation cycles that have already taken place; when this number reaches 8 the animation is stopped
    94..9B  plastic fountains (various stages of cyclic animation)
    9C..9F  fizzy drink factory
    A0..A3  bubble generator
    A1  generators
    A2  bubble capture facility; animation state in the low byte of L3 (valid range 00..27)
    A4..A6  toffee quarry
    A5  animated part; animation state in the low byte of L3 (valid range 00..45)
    A7..AE  sugar mine
    AE  animated part; animation state in the low byte of L3 (valid range 00..5F)
  • L2: index into the array of industries
  • L1 bit 7: clear = under construction
    • L1 bits 4..2: construction counter, for buildings under construction incremented on every periodic tile processing
  • L1 bits 1..0: stage of construction (3 = completed), incremented when the construction counter wraps around
    the meaning is different for some animated tiles which are never under construction (types 01, 1E..20, 30, 58; see above)
9 L5 bits 7..4 clear: tunnel entrance/exit
  • L5 bits 3..2: 0 - railway tunnel, 1 - road tunnel
  • L5 bits 1..0 - direction: entrance towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
  • L1: owner of the tunnel
  • L3 bits 3..0 = track type for railway tunnel, must be 0 for road tunnel
  • L3 bit 15 set = on snow or desert
L5 bit 7 set: bridge
  • L5 bit 6 clear: bridge ending
    • L5 bit 5: clear - northern, set - southern ending
    • L3 bits 3..0 = type of track on the bridge, must be 0 for road bridge
    • L1: owner of the bridge
    L5 bit 6 set: bridge middle part
    • L5 bit 5 clear:
      • L5 bits 4..3: land under bridge: 0 - grass, snow or desert, 1 - water
      L5 bit 5 set:
      • L5 bits 4..3: transport route under bridge: 0 - railway, 1 - road
    • L3 bits 7..4 = type of track on the bridge, must be 0 for road bridge
    • L3 bits 3..0 = type of track under the bridge, if any
    • L2 bits 3..0: bridge piece (0..5)
    • L1: owner of the land under bridge
  • L5 bits 2..1: 0 - railway bridge, 1 - road bridge
  • L5 bit 0: clear - bridge in the X direction, set - bridge in the Y direction
  • L2 bits 7..4: bridge type:
    Type Max. speed (mph) Description
    0  20wooden
    1  30concrete
    2  40girder, steel
    3  50suspension, concrete
    4  60suspension, steel
    5  70suspension, steel
    6  100cantilever, steel
    7  130cantilever, steel
    8  150cantilever, steel
    9  160girder, steel
    A  200tubular, steel
  • L3 bit 15 set = on snow or desert
A
  • L5: tile type:
    00  transmitter
    01  lighthouse
    02  company statue
    03  company-owned land
    80..93  company headquarters (5 sets of 4 tiles each, updated quarterly depending on the company performance)
  • L1: owner of the object (for lighthouses and transmitters normally 10)
Classes B through F are reserved. The presence of a tile in one of the reserved classes will crash TTD.

Tips and tricks

For starters, be careful when editing TTD savegames, especially the landscape data. TTD savegames are essentially decompressed straight into TTD memory, with no error checking. Illegal values are likely to crash TTD, possibly as soon as you load the game, possibly when you least expect it.

Finding the coordinates of a tile

Tile coordinates are not displayed anywhere in TTD (yet -- a future version of TTDPatch may include such feature), so unless you use some external savegame editing tool like TTDX Editor (see Owen Rudge's website) you may find it difficult to find out exactly where in the landscape arrays the tiles you'd like to edit are. Counting tiles all the way from a corner of the map can be very tedious...

Here is a trick you can use to find out the coordinates of tiles using only SV1Codec and the file compare tool fc.exe, which is a part of MS-DOS and (as far as I know) all versions of Microsoft Windows since 95 and NT 4.0:

  1. Start TTD and load the game you intend to edit.
  2. Choose a tile close to the one you intend to edit (close enough that you won't have problems counting tiles from it) and start a bridge there. The bridge may be as short as 2 tiles. When the bridge type selection window appears, don't select a bridge type yet; pause the game.
  3. Save the game under some temporary name, let's say "Test 1", preferably in some temporary directory. Just make sure you don't overwrite the original game.
  4. Now use the bridge type selection window to complete building the bridge while the game is still paused. It doesn't matter which bridge type you select.
  5. Save the game again, under a different name (let's say "Test 2"), keeping the game paused all the time.
  6. Quit TTD. Use SV1Codec to uncompress both savegames. You'll get two uncompressed savegame files, "Test 1.big" and "Test 2.big" if you named the savegames as suggested above.
  7. Launch the command prompt ("MS-DOS prompt" in Windows 95/98) and type:

    fc /b "Test 1.big" "Test 2.big" > fc.txt

    (You can drag and drop the 'big' files to a Windows command prompt to paste their names.) Press Enter when done.
  8. If you've done all of the above correctly, you'll have a file named fc.txt which will list all the differences between the files. These will include landscape data, your company's cash and probably also a new text effect. The first, especially the ownership information in the L1 array, can be used to find out the coordinates of the tiles at which the change (building of the bridge) took place. Since the bridge was built while the game was paused, other tiles will remain unchanged, and thus data locations of the changed tiles are easy to identify.

    For example, if you've got 2 bytes changed between 4CBA and 14CBA, the first one at 7608, then the offset (the XY index) of the northern end of the 'test' bridge you've placed is 7608 - 4CBA = 294E, therefore its coordinates are X=4E, Y=29.

    At this point, you can remove the temporary savegames, they're no longer needed.

Keep in mind that the L3 array is an array of 2-byte words, not bytes, so data offsets in it are XY indices multiplied by 2.


Closing words

Acknowledgements

Thanks go to Josef Drexler for TTDPatch and everything, to Dale McCoy for help with vehicle movement states, and to everyone else who offered useful suggestions about this document, or just e-mailed me to say how they like it. You know who you are :-)

Things to do


Copyright © 2003-2006 by Marcin Grzegorczyk.
Transport Tycoon and Transport Tycoon Deluxe are Copyright © by Chris Sawyer. All the other trademarks are the property of their respective owners.
Last changed on 2006-02-27 by Marcin Grzegorczyk.