Everything I know about the RCT2 Ride Object Header

The .DAT files contained in the RCT2 ObjData folder all start with a sixteen byte header whose structure is documented here. Following this is an object header whose structure is different for each type of game object. The structure of the object header for rides isn't documented at the aforementioned link and I wasn't able to find much information elsewhere, so this is what I've been able to determine, mostly through trial and error. In this document, byte offsets are zero indexed from the start of the object header, so the first byte of the object header is 0, the second is 1, etc

The first eight bytes are zero for every ride in the game (I don't have any expansions, so I can't be sure about those) and don't appear to do anything, so they're probably just padding.

Bytes 8-11 contain flags. The following table lists each flag, along with a description for those I've been able to figure out. Bytes are specified here in the order they appear in the file. This is important because under x86, integers are represented in little endian order, and so if you want to represent this field with a single 32 bit integer, you need to reverse the order of the bytes given here.

FlagDescription
0x00000100Set on spinning wild mouse
0x00000200Set on inverted shuttle and inverted vertical shuttle
0x00000400Unknown
0x00000800Set only on sunglasses stall
0x00001000Set only on magic carpet
0x00010000Riders get wet
0x00020000Only set on coaster boats. If unset, they do not slow down in water.
0x00040000Ride is covered
0x00080000Unknown
0x00100000If set, this ride shows as a seperate ride instead of an alternate train type. If the track style doesn't support alternate train types, then this flag must be set or the ride won't show at all.
0x00200000Set iff 0x00100000 is set. Not sure why.
0x00400000Set on rowing boats, canoes and elevator
0x00800000Unknown
0x0100000Unknown
0x0200000Unknown
0x0800000Disallow remap colors on track. Used for trams and trains.
0x1000000Set on magic carpet and swinging inverter ship
0x2000000Set on twist and snow cups
0x4000000Set on enterprise

Bytes 12-14 store both the track style, and (strangely) the index of the frame containing the rides preview image. Two of these bytes are always 0xFF. The byte that is not gives the track type, and its position gives the index of the preview image. For example, if these three bytes were 13 FF FF, this means that the track type is 0x13 (corkscrew track), and the preview image is the first image in the file. If it were FF 34 FF, then the track style is 34 (wooden track), and the preview image is the second image in the file. Of the first three images in the file, one is the preview image and the others are single pixel images that don't appear to be used for anything except filler. I'm not sure why it's done this way, which suggests I'm missing something

Bytes 15 and 16 store the minimum and maximum number of cars per train, respectively. These values include zero cars that don't carry passengers- for example the wild mouse has a value of 3 here because the front and back wheels are rendered as seperate sprites. These values do not appear to be the only restrictions on car length - changing them sometimes has no effect, but I've not figured out what the others are.

Byte 17 is 0xFF for tracked rides. For flat rides it's the number of "cars". For most flat rides, this value is 1, and each frame of the animation shows the entire ride; but for some (such as the flying saucers), the data file contains animation data for a single car, and the rest of the ride is hardcoded.

Byte 18 is the number of zero cars. It is the difference between the number of cars in the train and the train length displayed in game

Byte 19 is the index of the car to display on the car icon in the ride editor window (See next paragraph)

Bytes 20-24 provide information on the makeup of the train. Each ride can have up to 3 (or possibly 4, but no default ride has this many) different car types. For example, the corkscrew coaster has a different front car with a sloped nose, and a back car which is just an extra set of wheels and carries no passengers. Another example of a ride using different car types is the mine train ride. An interesting special case is the flying and multi-dimension coasters. The second car type is just the first, but inverted. When the track switches from lie to fly or vice versa, the sprites are changed. Note that these car types are NOT the same as rides which provide multiple train types, like the wild mouse or suspended swinging coaster- each of these is a seperate .DAT file. The following is a description of each byte from 20-24.

Byte 25 is appears to be padding

The car structures

Following this are a series of 4 structures, each 101 bytes long, pertaining to each of the car types, respectively. These structures are zeroed out if not used. Each of these structures has the same format, and while describing it I'll use offsets from the start of the structure.

Byte 0 relates to the train rotation animation displayed in the editor window when the train tab is selected. For spinning rides, this is also used for the spinning animation. It is the highest sprite index to use before the animation loops. For most cars, this is either 31 or 15, but cars possessing rotational symmetry (such as the Virginia Reel) may loop earlier- I don't fully understand the animation sequence for these.

Bytes 4 is unknown.

Bytes 5 and 6 give the spacing between this car and the next. The value in this field measured in feet, but multiplied by 10 in order to represent it as an integer.

Bytes 8 and 9 give the car friction. A higher value means less friction, and a value of zero will crash the game. Setting a very high value appears to limit the length of the train, not sure why.

Byte 10 is unknown

Byte 11 gives information on the riders. Bit 0x80 is set if riders ride in pairs, i.e. one sprite is provided per two riders. The remaining bits give the number of riders per car. For example, if this byte is 0x02 then there are two riders per car, represented by seperate sprites, and if it's 0x86 then there are 6 riders per car, with three sprites provided each representing two riders.

Bytes 12 and 13 are flags that specify what sprites this file contains. Each flag corresponds to a specific set of sprites. They appear in this table in the same order that their corresponding sprites appear in the file. The two remaining flags are suspected of being corkscrews and inline twists, but this hasn't been checked. The following are known:

FlagDescription
0x0100Flat slopes. As far as I'm aware, this flag is set for any car that's actually used. It consists of one 32 frame rotation of the car.
0x0200Gentle slopes. This consists of two 4 frame rotations of the car at an angle halfway between flat and gentle, first up then down, and then two 32 frame rotations of the car angled at a gentle slope, first up then down.
0x0400Steep slopes. This consists of two 4 frame rotations of the car at an angle halfway between gentle and steep, first up then down, and then two 32 frame rotations of the car angled at a steep slope, first up then down
0x0800Vertical slopes. As for gentle and steep slopes, these consist of two 4 frame rotations at a halfway angle, up and down, then two 32 frame rotations of the car angled at a vertical slope, up and then down. However, this flag also includes a set of sprites used for loops/quarter-loops. These consist of 5 sets of two 4 frame rotations- each up and then down, with the angle increasing by PI/12 each time to form a smooth transition between vertical and inverted. There is then a 4 frame rotation of the car inverted.
0x1000Diagonal slopes. 4 frame rotations of the following:
  • The train at an angle halfway between flat and gentle (up then down)
  • The train at a gentle angle (up then down)
  • The train at a steep angle (up then down)
    • These frames are all diagonal, i.e. rotated by 45 degrees as compared to the other 4 frame rotations. Also note that theres no transition between gentle and steep; instead, the steep slopes flag contains an 8 frame transition rotation that includes diagonals.
0x2000Banking. Two 8 frame rotations of the train banked at a halfway angle, left then right, and then two 32 frame rotations of the train banked fully (left then right).
0x8000Slope,bank transitions. These are sprites shown when the train is transitioning from level to sloped and banked to unbanked (or vice versa) simultaneously. It consists of four 32 frame rotations of the train banked halfway and angled halfway between level and flat, first up then left, then up then right, then down and left, and finally down and right.
0x0001Diagonal bank transitions. Four 4 frame diagonal (i.e. rotated 45 degrees) rotations of the train angled at a gentle slope and banked at a halfway angle- up then left, up then right, down then left, and down and right.
0x0002Sloped bank transitions. Used when the train is transitioning from unbanked to banked-or vice versa, on sloped track. Consists of four 4 frame rotations of the car banked halfway, at a gentle slope- up and left,up and right,down and left then down and right.
0x0004Sloped, banked turns. 4 32 frame rotations of the train banked fully and angled at a gentle slope- up and left, up and right,down and left then down and right.
0x0008Banked slope transitions. Used when the train is transitioning from flat to sloped while banked. Consists of four 4 frame rotations of the train at an angle halfway between flat and gentle, and banked fully- up and left, up and right, down and left then down and right.
0x0020Restraint animation. Restraint animations consist of three frames, with a four frame rotation of each.

Bytes 14-16 are unknown

Bytes 17-20 are flags. The following table lists each flag along with a description if I have one:

FlagDescription
0x00000001Enable remap color 2
0x00000002This car is swinging
0x00000004This car is spinning
0x00000008 This car is powered
0x00000010Unknown
0x00000020Unknown
0x00000040Ride may not start unless car has passengers. I haven't actually tested this one as such rides don't appear in the coaster designer, but this flag is found in every such ride and no others, so I assume this is what it does.
0x00000080Unknown
0x00000200Unknown
0x00000400Unknown
0x00000800Set on Water Tricycles, Rowing Boats, Canoes and Swans (i.e. self powered rides). Not sure what it does
0x00001000Unknown
0x00002000Car may run inverted for extended periods. Such coasters must provide an inverted version of each car type. This is set on flying, lay down, and 4th dimension coasters.
0x00004000Unknown
0x00008000Enable remap color 3
0x00040000Car has no upstops -i.e negative g force will cause it to leave the track. This is set for the side friction coaster, bobsled coaster, and dingy slide.
0x00001000Unknown
0x00002000Unknown
0x00004000Unknown
0x00008000Unknown
0x00010000Unknown
0x00020000Unknown
0x00040000Set if and only if 0x002000 is set. I haven't tested what happens if you set one but not the other.
0x00080000Unknown
0x01000000This car is animated
0x02000000Unknown
0x04000000Unknown
0x08000000Unknown

Byte 21 is unknown

Bytes 24-79 are 4 byte offsets to images for the ride. I'm not really sure which images, apparently each corresponds to a different track piece. This data is populated by the loader and can be left blank

Byte 84 gives the number of rider sprites for this car type. This is equal to the number of riders if riders do not ride in pairs, else it is half the number of riders.

Bytes 85 and 86 are applicable only for spinning rides. When a spinning ride encounters a turn, its rotation is altered by an amount based on the radius of the turn (and possibly other factors). Byte 85 can be thought of as the "inertia"- a higher value results in a smaller change in angular velocity for the same turn radius. Byte 86 is the friction: a higher value will cause the spin to slow down faster.

Bytes 80-83 store the total number of images (not sure if this is for the car or in total). This is populated by the loader, no need to write it

Byte 95 affects draw order: Higher values cause the track to be drawn first, while low values cause the car to be drawn first. 0-2 is typical for an inverted ride, while 6-8 is typical for an above-track coaster.

Byte 96 is "special frames". Set only for the water trikes, 4D coaster, and submarine. It gives the number of frames per angle of the car. Not fully understood

Bytes 97-100 has to do with the position the peeps sit in. This is also populated by the loader; not sure precisely what it does

For powered rides, bytes 91 and 92 determine the velocity that the car will reach on level track

The remaining data

After these 4 structures, there's more fields. These refer to the ride as a whole, not individual car types, and begin at offset 434 from the start of the object header.

Bytes 434-436 affect the ride statistics: higher values increase the Excitement, Intensity, and Nausea respectively. Values above 0x50 are rejected by the game and will cause the ride not to appear in the ride window. These figures only alter the ride statistics- each track type has a hardcoded base value, but these allow you to tweak it somewhat.

Byte 437 increases the maximum height of the ride. Again, theres a base value determined by the track type, and this only adds to it

Bytes 438-445 are flags indicating which track sections should be available. It's not possible to have more track sections than the track style has sprites for; the missing sections are simply treated as though the flag wasn't set. I have not yet looked at what flags refer to what track sections

Byte 446 is the category that the ride belongs in- 0 for transport rides through to 5 for shops

If the ride belongs in two categories, then byte 447 is the other category that it belongs in, otherwise it is 0xFF

Byte 448 is the first item that this ride sells, or 0xFF if it doesn't sell anything. In the game this is only set for shops, but you can set it on any type of ride and it seems to work

Byte 449 is the second item sold, or 0xFF if it doesn't sell two items